rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (!((Stack) this.matrixStack.get(this.currentMatrixKey)) .isEmpty()) ((Collection) ((Stack) this.matrixStack .get(this.currentMatrixKey)).peek()).add(token);
if (!stack.isEmpty()) ((Collection) stack.peek()).add(token);
public void parseToken(String token) throws ParseException { final String trimmed = token.trim(); if (this.expectingMatrixContent && NexusFileFormat.NEW_LINE.equals(token)) { // Special handling for new lines inside matrix data. if (this.currentMatrixBracket != null) { ((CharactersBlockListener) this.getBl...
if (!((Stack) this.matrixStack .get(this.currentMatrixKey)).isEmpty()) ((Collection) ((Stack) this.matrixStack .get(this.currentMatrixKey)).peek()) .add(tok);
if (!stack.isEmpty()) ((Collection) stack.peek()).add(tok);
public void parseToken(String token) throws ParseException { final String trimmed = token.trim(); if (this.expectingMatrixContent && NexusFileFormat.NEW_LINE.equals(token)) { // Special handling for new lines inside matrix data. if (this.currentMatrixBracket != null) { ((CharactersBlockListener) this.getBl...
((ct == null) || (ct.isMatchingType(Distribution.NULL_MODEL))) &&
((Distribution.NULL_MODEL.isMatchingType(ct)) || (ct.isMatchingType(Distribution.NULL_MODEL))) &&
protected ChangeSupport getChangeSupport(ChangeType ct) { ChangeSupport changeSupport = super.getChangeSupport(ct); if( ((ct == null) || (ct.isMatchingType(Distribution.NULL_MODEL))) && nullModelForwarder == null ) { nullModelForwarder = new Distribution.NullModelForwarder(this, changeSuppor...
return supC.isAssignableFrom(this.getClass());
return supC.isAssignableFrom(this.getTestClass());
public boolean isProperSubset(FeatureFilter sup) { if(sup instanceof ByClass) { Class supC = ((ByClass) sup).getTestClass(); return supC.isAssignableFrom(this.getClass()); } return (sup instanceof AcceptAllFilter); }
if (nsURI == null || nsURI.length() == 0) { throw new IOException("Invalid namespace URI: "+nsURI); }
public void openTag(String nsURI, String localName) throws IOException { _openTag(); boolean alloced = false; String prefix = (String) namespacePrefixes.get(nsURI); if (prefix == null) { prefix = allocPrefix(nsURI); alloced = true; } writer.p...
private String getCircularChar() {
String getCircularChar() {
private String getCircularChar() { return getCircular()?ISCIRCULAR:null; }
private void setCircularChar(final String isHiddenChar) throws ChangeVetoException {
void setCircularChar(final String isHiddenChar) throws ChangeVetoException {
private void setCircularChar(final String isHiddenChar) throws ChangeVetoException { setCircular(isHiddenChar!=null || (isHiddenChar!=null && isHiddenChar.length() > 0));// any character will set }
if(protease == null){ throw new BioException("Protease is null"); }
public void addDigestFeatures() throws BioException, ChangeVetoException { peptideQue = new LinkedList(); String cleaveSites = protease.getCleaveageResidues(); boolean endoProtease = protease.isEndoProtease(); String notCleave = protease.getNotCleaveResidues(); int nTerm = 1; ...
ann.setProperty(key, value);
ann.setProperty(key, newValue);
protected void addProperty(Annotation ann, Object key, Object value) { if (value == null) return; Object oldValue = null; Object newValue = value; try { oldValue = ann.getProperty(key); } catch (NoSuchElementException ex) {} if (oldValue != null) { if (oldValue instanceof String) { newValue = ((String)...
actualReturn=actualReturn==null?null:actualReturn;
public void testGetAmbiguity(){ Set s = null; try{ Symbol actualReturn = softMaskedAlphabet.getAmbiguity(s); }catch(UnsupportedOperationException ex){ return; } fail("Should have thrown and UnsupportedOperationException"); }
private int countChar(String s, char c)
private int countChar(final String s, final char c)
private int countChar(String s, char c) { int cnt = 0; for (int i = 0; i < s.length(); ++i) if (s.charAt(i) == c) ++cnt; return cnt; }
Object [] parseLocation(String location)
Object [] parseLocation(final String location)
Object [] parseLocation(String location) throws BioException { this.location = location; if ((countChar(location, '(')) != (countChar(location, '('))) throw new BioException("Unbalanced parentheses in location: " + location); startCoords = new ArrayList(); endCoords = new ArrayList(); instructSta...
unboundMin = unboundMax = false; isPointLoc = true; fuzzyCoord = false;
isPointLoc = true; unboundMin = false; unboundMax = false; fuzzyCoord = false; isComplement = false;
private void processCoords() throws BioException { int outerMin, innerMin, innerMax, outerMax; // This is expected where two calls to processCoords() are // made sequentially e.g. where two levels of parens are // closed. The second call will have no data to process. if (startCoords.isEmpty() && endCoords.isEmpt...
String str = "" ; ArrayList gr = getGroups("amino"); for (int i=0 ; i<gr.size();i++){ AminoAcid a = (AminoAcid)gr.get(i); str += a.getPDBName() ; } return str ;
List aminos = getGroups("amino"); StringBuffer sequence = new StringBuffer() ; for ( int i=0 ; i< aminos.size(); i++){ AminoAcid a = (AminoAcid)aminos.get(i); sequence.append( a.getAminoType()); } String s = sequence.toString(); return s ;
public String getSequence(){ String str = "" ; ArrayList gr = getGroups("amino"); for (int i=0 ; i<gr.size();i++){ AminoAcid a = (AminoAcid)gr.get(i); str += a.getPDBName() ; } return str ; }
orthologyTmpl.percentIdentity = Integer.parseInt(value);
orthologyTmpl.percentIdentity = Double.parseDouble(value);
public void addOrthologyProperty(String key, String value) { if (level != 3) return; if (key.equals(SIMILARITYTYPE)) { String type = value.trim(); if (type.equals(TWIN)) { orthologyTmpl.type = SimilarityType.TWIN; } else i...
if ((orthologueTmpl.taxonID != -9999) || (orthologueTmpl.homologeneID != null) || (orthologueTmpl.accession != null))
if ((orthologueTmpl.taxonID == -9999) || (orthologueTmpl.homologeneID == null) || (orthologueTmpl.accession == null)) {
public void endOrthologue() { if (level != 4) return; // validate the template if ((orthologueTmpl.taxonID != -9999) || (orthologueTmpl.homologeneID != null) || (orthologueTmpl.accession != null)) return; // get the taxon Taxon taxon; if (...
}
public void endOrthologue() { if (level != 4) return; // validate the template if ((orthologueTmpl.taxonID != -9999) || (orthologueTmpl.homologeneID != null) || (orthologueTmpl.accession != null)) return; // get the taxon Taxon taxon; if (...
if ((taxon = HomologeneTools.getTaxon(orthologueTmpl.taxonID)) == null) return;
if ((taxon = HomologeneTools.getTaxon(orthologueTmpl.taxonID)) == null) { try { taxon = HomologeneTools.createTaxon(orthologueTmpl.taxonID, "Unknown species " + orthologueTmpl.taxonID); } catch (DuplicateTaxonException dte) {} }
public void endOrthologue() { if (level != 4) return; // validate the template if ((orthologueTmpl.taxonID != -9999) || (orthologueTmpl.homologeneID != null) || (orthologueTmpl.accession != null)) return; // get the taxon Taxon taxon; if (...
level--;
public void endOrthologue() { if (level != 4) return; // validate the template if ((orthologueTmpl.taxonID != -9999) || (orthologueTmpl.homologeneID != null) || (orthologueTmpl.accession != null)) return; // get the taxon Taxon taxon; if (...
if (orthologyTmpl.type == null) return; if ((orthologyTmpl.firstOrtho == null) || (orthologyTmpl.secondOrtho == null)) return;
if ((orthologyTmpl.type == null) || (orthologyTmpl.firstOrtho == null) || (orthologyTmpl.secondOrtho == null)) { System.out.println(orthologyTmpl.type + " " + orthologyTmpl.firstOrtho + " " + orthologyTmpl.secondOrtho); System.out.println("endOrthology test failed"); return; }
public void endOrthology() { if (level !=3) return; // validate template if (orthologyTmpl.type == null) return; if ((orthologyTmpl.firstOrtho == null) || (orthologyTmpl.secondOrtho == null)) return; if (orthologyTmpl.type == SimilarityType.CURATED) { Orthology ortho...
if (orthologyTmpl.ref == null) return;
public void endOrthology() { if (level !=3) return; // validate template if (orthologyTmpl.type == null) return; if ((orthologyTmpl.firstOrtho == null) || (orthologyTmpl.secondOrtho == null)) return; if (orthologyTmpl.type == SimilarityType.CURATED) { Orthology ortho...
level--;
public void endOrthology() { if (level !=3) return; // validate template if (orthologyTmpl.type == null) return; if ((orthologyTmpl.firstOrtho == null) || (orthologyTmpl.secondOrtho == null)) return; if (orthologyTmpl.type == SimilarityType.CURATED) { Orthology ortho...
if(!hasListeners()) {
if(!hasListeners(BioEntryDBLite.BIOENTRYS)) {
public void addBioEntry(BioEntry seq) throws IllegalIDException, BioException, ChangeVetoException { if(!hasListeners()) { this._addBioEntry(seq); } else { ChangeSupport changeSupport = getChangeSupport(BioEntryDBLite.BIOENTRYS); synchronized(changeSupport) { ...
if(!hasListeners()) {
if(!hasListeners(BioEntryDBLite.BIOENTRYS)) {
public void removeBioEntry(String id) throws IllegalIDException, BioException, ChangeVetoException { if(!hasListeners()) { this._removeBioEntry(id); } else { ChangeSupport changeSupport = getChangeSupport(BioEntryDBLite.BIOENTRYS); synchronized(changeSupport) { ...
if(rec.getSeqName() == seq.getName()) {
if(rec.getSeqName().equals(seq.getName())) {
public Annotator getAnnotator() { return new AbstractAnnotator() { public boolean annotate(Sequence seq) throws SeqException { Feature.Template plain = new Feature.Template(); StrandedFeature.Template stranded = new StrandedFeature.Template(); boolean addedAny = false; for(Iterator...
if(rec.getSeqName() == seq.getName()) {
if(rec.getSeqName().equals(seq.getName())) {
public boolean annotate(Sequence seq) throws SeqException { Feature.Template plain = new Feature.Template(); StrandedFeature.Template stranded = new StrandedFeature.Template(); boolean addedAny = false; for(Iterator i = lineIterator(); i.hasNext(); ) { Object o = i.next(); ...
Class c = getClass().forName(className);
Class c = Class.forName(className);
public Object readResolve() throws ObjectStreamException { try { Class c = getClass().forName(className); Field f = c.getDeclaredField(fieldName); return f.get(null); } catch (Exception e) { throw new InvalidObjectException( "Unable to retrieve static field " + fieldName + "fo...
List fKeys = new ArrayList(t.annotation.keys());
List fKeys = comparableList(t.annotation.keys());
void getSeqIOEvents(Sequence seq, SeqIOListener listener) { try { // Inform listener of sequence start listener.startSequence(); // Pass name to listener listener.setName(seq.getName()); // Pass URN to listener listener.setURI(seq.ge...
assert(LocationTools.areEqual(r1, r1));
assertTrue(LocationTools.areEqual(r1, r1));
public void testAreEqual() { assert(LocationTools.areEqual(r1, r1)); assertEquals(r1, LocationTools.buildLoc(locs1)); }
assert(LocationTools.contains(r1, r2)); assert(! LocationTools.contains(r1, r3)); assert(r1.contains(1)); assert(r1.contains(100)); assert(r1.contains(150)); assert(r1.contains(200));
assertTrue(LocationTools.contains(r1, r2)); assertTrue(! LocationTools.contains(r1, r3)); assertTrue(r1.contains(1)); assertTrue(r1.contains(100)); assertTrue(r1.contains(150)); assertTrue(r1.contains(200));
public void testContains() { assert(LocationTools.contains(r1, r2)); assert(! LocationTools.contains(r1, r3)); assert(r1.contains(1)); assert(r1.contains(100)); assert(r1.contains(150)); assert(r1.contains(200)); // Between contained ranges assert(! r1.contains(101)); // Outside contained ranges assert(! r1.cont...
assert(! r1.contains(101));
assertTrue(! r1.contains(101));
public void testContains() { assert(LocationTools.contains(r1, r2)); assert(! LocationTools.contains(r1, r3)); assert(r1.contains(1)); assert(r1.contains(100)); assert(r1.contains(150)); assert(r1.contains(200)); // Between contained ranges assert(! r1.contains(101)); // Outside contained ranges assert(! r1.cont...
assert(! r1.contains(201));
assertTrue(! r1.contains(201));
public void testContains() { assert(LocationTools.contains(r1, r2)); assert(! LocationTools.contains(r1, r3)); assert(r1.contains(1)); assert(r1.contains(100)); assert(r1.contains(150)); assert(r1.contains(200)); // Between contained ranges assert(! r1.contains(101)); // Outside contained ranges assert(! r1.cont...
assert(! r1.isContiguous());
assertTrue(! r1.isContiguous());
public void testIsContiguous() { assert(! r1.isContiguous()); List single = new ArrayList(); single.add(new RangeLocation(1, 100)); Location contig = LocationTools.buildLoc(single); assert(contig.isContiguous()); }
assert(contig.isContiguous());
assertTrue(contig.isContiguous());
public void testIsContiguous() { assert(! r1.isContiguous()); List single = new ArrayList(); single.add(new RangeLocation(1, 100)); Location contig = LocationTools.buildLoc(single); assert(contig.isContiguous()); }
assert(LocationTools.overlaps(r1, r2)); assert(! LocationTools.overlaps(r1, r3));
assertTrue(LocationTools.overlaps(r1, r2)); assertTrue(! LocationTools.overlaps(r1, r3));
public void testOverlaps() { assert(LocationTools.overlaps(r1, r2)); assert(! LocationTools.overlaps(r1, r3)); }
SequenceFactory sFact = new SimpleSequenceFactory();
SequenceBuilderFactory sFact = new EmblProcessor.Factory(SimpleSequenceBuilder.FACTORY);
private static SequenceDB loadSequences(File seqFile) throws Exception { HashSequenceDB seqDB = new HashSequenceDB(IDMaker.byName); Alphabet alpha = AlphabetManager.alphabetForName("DNA"); SymbolParser rParser = alpha.getParser("token"); SequenceFactory sFact = new SimpleSequenceFactory(); SequenceFor...
symbol = new FundamentalAtomicSymbol(name, '?', annotation);
symbol = new FundamentalAtomicSymbol(name, annotation);
public void endTree() { symbol = new FundamentalAtomicSymbol(name, '?', annotation); }
char token, String name, Annotation annotation
String name, Annotation annotation
static public AtomicSymbol createSymbol( char token, String name, Annotation annotation ) { AtomicSymbol as = new FundamentalAtomicSymbol(name, token, annotation); return as; }
AtomicSymbol as = new FundamentalAtomicSymbol(name, token, annotation);
AtomicSymbol as = new FundamentalAtomicSymbol(name, annotation);
static public AtomicSymbol createSymbol( char token, String name, Annotation annotation ) { AtomicSymbol as = new FundamentalAtomicSymbol(name, token, annotation); return as; }
} } } catch (BioException ex) { mBadFeature = true; ParseErrorEvent offendingLineEvent = new ParseErrorEvent(this, "This line could not be parsed: " + value.toString()); this.notifyParseErrorEvent(offendingLineEvent); } catch (IndexOutOfBoundsException ex) { mBadFeature = true; ParseErrorEvent offendingLineEvent = ne...
} } } catch (BioException ex) { mBadFeature = true; ParseErrorEvent offendingLineEvent = new ParseErrorEvent(this, "This line could not be parsed: " + value.toString()); this.notifyParseErrorEvent(offendingLineEvent); } catch (IndexOutOfBoundsException ex) { mBadFeature = true; ParseErrorEvent offendingLineEvent = ne...
public void addSequenceProperty(Object key, Object value) throws ParseException { try { if (mBadFeature) { // If this feature is bad in some way, ignore it. if (value != null) { String featureLine = value.toString(); if((key.equals("FT")) && (featureLine.charAt(0) != ' ')) { // If the...
}
public void addSequenceProperty(Object key, Object value) throws ParseException { try { if (mBadFeature) { // If this feature is bad in some way, ignore it. if (value != null) { String featureLine = value.toString(); if((key.equals("FT")) && (featureLine.charAt(0) != ' ')) { // If the...
String oMode = null; boolean tStrict = true;
public static void main(String[] args) throws Exception { String oInput = null; String oClassName = null; String oMode = null; boolean tStrict = true; // Catch wrong number of arguments or help requests if ( (args.length != 2) || (args[0].equals("-help")) || (args[0].equals("-h")) )...
ei[j] = eCache.getEmissions(symList);
ei[j] = eCache.getEmissions(symList, !((i < 1 && j < 1) || (i > seq1.length() && j <= seq2.length())) );
public AbstractMatrixPairDPCursor( SymbolList seq1, SymbolList seq2, int start1, int start2, int depth1, int depth2, PairDPMatrix matrix, EmissionCache eCache ) throws IllegalSymbolException { this.numStates = matrix.states().length; this.zeroCol = new double[thi...
for (int i = 0; i < syms.length; i++)
int end = start + length - 1; for (int i = start; i <= end; i++)
public void addSymbols(Alphabet alpha, Symbol [] syms, int start, int length) throws IllegalAlphabetException { int aCount = 0; int cCount = 0; int gCount = 0; int tCount = 0; int oCount = 0; for (int i = 0; i < syms.length; i++) { char c = syms[i].getToken(); switch (c) {...
int fullLine = syms.length / 60; int partLine = syms.length % 60;
int fullLine = length / 60; int partLine = length % 60;
public void addSymbols(Alphabet alpha, Symbol [] syms, int start, int length) throws IllegalAlphabetException { int aCount = 0; int cCount = 0; int gCount = 0; int tCount = 0; int oCount = 0; for (int i = 0; i < syms.length; i++) { char c = syms[i].getToken(); switch (c) {...
System.arraycopy(syms, (i * 60), sa, 0, len);
System.arraycopy(syms, start + (i * 60), sa, 0, len);
public void addSymbols(Alphabet alpha, Symbol [] syms, int start, int length) throws IllegalAlphabetException { int aCount = 0; int cCount = 0; int gCount = 0; int tCount = 0; int oCount = 0; for (int i = 0; i < syms.length; i++) { char c = syms[i].getToken(); switch (c) {...
try { SymbolTokenization toke = alfa.getTokenization("token");
public String toString() { StringBuffer output = new StringBuffer(); // dump nodes output.append("Nodes: "); int count = 0; for (Iterator nodeI = nodes.iterator(); nodeI.hasNext(); ) { Node node = (Node) nodeI.next(); if (count++ != 0) output.append(", ");...
}
/*}
public String toString() { StringBuffer output = new StringBuffer(); // dump nodes output.append("Nodes: "); int count = 0; for (Iterator nodeI = nodes.iterator(); nodeI.hasNext(); ) { Node node = (Node) nodeI.next(); if (count++ != 0) output.append(", ");...
}
}*/
public String toString() { StringBuffer output = new StringBuffer(); // dump nodes output.append("Nodes: "); int count = 0; for (Iterator nodeI = nodes.iterator(); nodeI.hasNext(); ) { Node node = (Node) nodeI.next(); if (count++ != 0) output.append(", ");...
throws IllegalAlphabetException {
throws IllegalResidueException {
public CrossProductResidue getResidue(List rList) throws IllegalAlphabetException { if(rList.size() != alphas.size()) { throw new IllegalAlphabetException( "List of residues is the wrong length (" + alphas.size() + ":" + rList.size() + ")" ); } Iterator ai = alphas.iterator(); ...
throw new IllegalAlphabetException(
throw new IllegalResidueException(
public CrossProductResidue getResidue(List rList) throws IllegalAlphabetException { if(rList.size() != alphas.size()) { throw new IllegalAlphabetException( "List of residues is the wrong length (" + alphas.size() + ":" + rList.size() + ")" ); } Iterator ai = alphas.iterator(); ...
if(name.equals("token")){
if(name.equals("token") || name.equals("default")){
public SymbolTokenization getTokenization(String name) { if(name.equals("token")){ return new IntegerTokenization(); }else{ throw new NoSuchElementException(name + " parser not supported by IntegerAlphabet yet"); } }
if (context.getDirection() == context.HORIZONTAL)
if (context.getDirection() == SequenceRenderContext.HORIZONTAL)
public void renderBead(Graphics2D g2, Feature f, SequenceRenderContext context) { Location loc = f.getLocation(); int min = loc.getMin(); int max = loc.getMax(); int dif = max - min; Shape shape; if (context.getDirection() == context.HO...
public void testGetMass()
public void testGetMass() throws IllegalSymbolException
public void testGetMass() { double delta = 0.0; MassCalc mCalc; mCalc = new MassCalc(SymbolPropertyTable.MONO_MASS, false); assertEquals(monoAla + (monoO + monoH) + monoH, mCalc.getMass(syms1, false), delta); assertEquals(monoAla + (monoO + monoH) + monoH + ...
public void testGetTermMass()
public void testGetTermMass() throws IllegalSymbolException
public void testGetTermMass() { double delta = 0.0; MassCalc mCalc; mCalc = new MassCalc(SymbolPropertyTable.MONO_MASS, false); assertEquals(monoO + monoH + monoH, mCalc.getTermMass(), delta); mCalc = new MassCalc(SymbolPropertyTable.MONO_MASS, true); ...
MarkovModel.PARAMETER.isMatchingType(ChangeType.UNKNOWN) &&
(MarkovModel.PARAMETER.isMatchingType(ct) || ct.isMatchingType(MarkovModel.PARAMETER)) &&
protected ChangeSupport getChangeSupport(ChangeType ct) { ChangeSupport changeSupport = super.getChangeSupport(ct); if( MarkovModel.PARAMETER.isMatchingType(ChangeType.UNKNOWN) && distForwarder == null ) { distForwarder = new MarkovModel.DistributionForwarder( this, changeSupport ...
1,
0,
public static void getSeqIOEvents(final Sequence seq, final SeqIOListener listener) throws BioException { try { // Inform listener of sequence start listener.startSequence(); // Pass name to listener listener.setName(seq.getName()); // Pass URN to listener listener.setURI(se...
int end)
int length)
public void ignorableWhitespace(char[] ch, int start, int end) throws SAXException { }
valList.add(attValList.substring(1, quoteIndx)); attValList = attValList.substring(quoteIndx+1).trim();
if(quoteIndx > 0){ valList.add(attValList.substring(1, quoteIndx)); attValList = attValList.substring(quoteIndx+1).trim(); }else{ valList.add(attValList); attValList = ""; }
protected Map parseAttribute(String attValList) { Map attMap = new HashMap(); StringTokenizer sTok = new StringTokenizer(attValList, ";", false); while(sTok.hasMoreTokens()) { String attVal = sTok.nextToken().trim(); String attName; List valList = new ArrayList(); int spaceIndx = attVal.indexOf(" "...
for (Iterator i = syms.iterator(); i.hasNext(); ) { validate((Symbol) i.next()); }
public Symbol getAmbiguity(Set syms) throws IllegalSymbolException { return AlphabetManager.createSymbol( '*', Annotation.EMPTY_ANNOTATION, syms, this ); }
seq = new SimpleSequence(DNATools.createDNA("aacgtaggttccatgc"), "fragment1", "fragment1", Annotation.EMPTY_ANNOTATION); Feature.Template sft = new Feature.Template(); sft.type = "test"; sft.source = "test"; sft.annotation = Annotation.EMPTY_ANNOTATION; sft.location = new RangeLocation(1, 3); seq.createFeature(sft);
seq = new SimpleSequence(DNATools.createDNA("aacgtaggttccatgc"), "fragment1", "fragment1", Annotation.EMPTY_ANNOTATION);
protected void setUp() throws Exception { seq = new SimpleSequence(DNATools.createDNA("aacgtaggttccatgc"), "fragment1", "fragment1", Annotation.EMPTY_ANNOTATION); Feature.Template sft = new Feature.Template(); sft.type = "test"; sft.source = "test"; sft.annotation = Annotation.EMPTY_A...
sft.location = new RangeLocation(10, 12); seq.createFeature(sft); seq = new CircularView(seq); sft.location = new RangeLocation(5,8); seq.createFeature(sft);
Feature.Template sft = new Feature.Template(); sft.type = "test"; sft.source = "test"; sft.annotation = Annotation.EMPTY_ANNOTATION; sft.location = new RangeLocation(1, 3); seq.createFeature(sft);
protected void setUp() throws Exception { seq = new SimpleSequence(DNATools.createDNA("aacgtaggttccatgc"), "fragment1", "fragment1", Annotation.EMPTY_ANNOTATION); Feature.Template sft = new Feature.Template(); sft.type = "test"; sft.source = "test"; sft.annotation = Annotation.EMPTY_A...
File f = File.createTempFile("ViewSeqSerTest",".tmp"); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(f))); oos.writeObject(seq); oos.flush(); oos.close(); ObjectInputStream ois = new ObjectInputStream(new BufferedInputStream(new FileInputStream(f))); seq2 = (Sequence)ois....
sft.location = new RangeLocation(10, 12); seq.createFeature(sft); seq = new CircularView(seq); sft.location = new RangeLocation(5,8); seq.createFeature(sft); File f = File.createTempFile("ViewSeqSerTest",".tmp"); ObjectOutputStream oos = new ObjectOutputStream(new BufferedOutputStream(new FileOutputStream(f))); oos.wr...
protected void setUp() throws Exception { seq = new SimpleSequence(DNATools.createDNA("aacgtaggttccatgc"), "fragment1", "fragment1", Annotation.EMPTY_ANNOTATION); Feature.Template sft = new Feature.Template(); sft.type = "test"; sft.source = "test"; sft.annotation = Annotation.EMPTY_A...
HashSet features = new HashSet(); for(Iterator i = seq.features(); i.hasNext();){ features.add(i.next()); } for(Iterator i = seq2.features(); i.hasNext();){ assertTrue(features.contains(i.next())); }
assertTrue(seq.countFeatures() == seq2.countFeatures());
public void testFeatures() throws Exception{ HashSet features = new HashSet(); for(Iterator i = seq.features(); i.hasNext();){ features.add(i.next()); } for(Iterator i = seq2.features(); i.hasNext();){ assertTrue(features.contains(i.next())); } }
tLastWriteStartElement = false;
public BaseXMLWriter() { oElementStack = new Stack(); oStr = new StringBuffer(); oIndent = new StringBuffer(); oSpaceStore = new StringBuffer(); oLineSeparator = System.getProperty("line.separator"); oIndent.setLength(0); tLastWritePCData = false; }
if (!tLastWritePCData)
if (!tLastWriteStartElement && !tLastWritePCData)
public String endElement() { decreaseIndent(); oStr.setLength(0); if (!tLastWritePCData) { oStr.append(nl()); oStr.append(indent()); } oStr.append("</"); oStr.append((String)oElementStack.pop()); oStr.append(">"); tLastWritePCDa...
tLastWriteStartElement = false;
public String endElement() { decreaseIndent(); oStr.setLength(0); if (!tLastWritePCData) { oStr.append(nl()); oStr.append(indent()); } oStr.append("</"); oStr.append((String)oElementStack.pop()); oStr.append(">"); tLastWritePCDa...
tLastWriteStartElement = true;
public String startElement(String string) { oElementStack.push(string); oStr.setLength(0); if (!tLastWritePCData) oStr.append(nl()); oStr.append(indent()); oStr.append("<"); oStr.append(string); oStr.append(">"); increaseIndent(); tLastWri...
tLastWriteStartElement = false;
public String writeEmptyElement(String string) { oStr.setLength(0); if (!tLastWritePCData) oStr.append(nl()); oStr.append(indent()); oStr.append("<"); oStr.append(string); oStr.append("/>"); tLastWritePCData = false; return oStr.toString(); }
tLastWriteStartElement = false;
public String writePCData(String poPCData) { oStr.setLength(0); oStr.append(poPCData); tLastWritePCData = true; return oStr.toString(); }
if (usCutPositions.length > 0)
if (usCutPositions != null)
RestrictionEnzyme createEnzyme() { RestrictionEnzyme enzyme = null; try { if (usCutPositions.length > 0) { enzyme = new RestrictionEnzyme(name, site, usCutPositions[0], ...
if (isoCount == 0) { isoschizomers = Collections.EMPTY_SET; } else if (isoCount < 30)
if (isoCount < 30)
public void endRecord() throws ParserException { if (! getRecordState()) return; int isoCount = isoBuffer.size(); if (isoCount == 0) { isoschizomers = Collections.EMPTY_SET; } else if (isoCount < 30) ...
dsCutPositions = new int [2];
private void processSite(Object value) throws ParserException { sb.setLength(0); sb.append((String) value); int div, forIdx, revIdx; if (sb.charAt(0) == '(') { // Index separator div = sb.indexOf("/"); try...
dsCutPositions = new int [2]; usCutPositions = new int [2];
site = null; dsCutPositions = null; usCutPositions = null; unknownSite = false;
public void startRecord() throws ParserException { isoBuffer = new ArrayList(30); dsCutPositions = new int [2]; usCutPositions = new int [2]; }
List scorel = new ArrayList();
public StatePath viterbi(SymbolList[] seqs, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException { if (seqs.length != 2) { throw new IllegalArgumentException("This DP object only runs on pairs."); } lockModel(); SymbolList seq0 = seqs[0]...
DoubleAlphabet dAlpha = DoubleAlphabet.getInstance();
public StatePath viterbi(SymbolList[] seqs, ScoreType scoreType) throws IllegalSymbolException, IllegalAlphabetException, IllegalTransitionException { if (seqs.length != 2) { throw new IllegalArgumentException("This DP object only runs on pairs."); } lockModel(); SymbolList seq0 = seqs[0]...
StringBuffer sb = new StringBuffer();
protected void readColourMapFromProperties( String poFileName ) { // load in properties Properties oColourProps = new Properties(); try{ FileInputStream fis = new FileInputStream( poFileName ); oColourProps.load(fis); fis.close(); } catch (java.lang.Exception e) { System.out.println(...
float min = (float) src.sequenceToGraphics(loc.getMin()); float max = (float) src.sequenceToGraphics(loc.getMax());
public void renderFeature( Graphics2D g, Feature f, SequenceRenderContext src ) { Shape s = null; Location loc = f.getLocation(); float min = (float) src.sequenceToGraphics(loc.getMin()); float max = (float) src.sequenceToGraphics(loc.getMax()); float depth = (float) (arrowSize + 2.0 * arrow...
if ( (outline != null) && ( (max - min) > 4.0) ) {
if ( (outline != null) && ( (maxD - minD) > 4.0) ) {
public void renderFeature( Graphics2D g, Feature f, SequenceRenderContext src ) { Shape s = null; Location loc = f.getLocation(); float min = (float) src.sequenceToGraphics(loc.getMin()); float max = (float) src.sequenceToGraphics(loc.getMax()); float depth = (float) (arrowSize + 2.0 * arrow...
} else {
public void renderFeature( Graphics2D g, Feature f, SequenceRenderContext src ) { Shape s = null; Location loc = f.getLocation(); float min = (float) src.sequenceToGraphics(loc.getMin()); float max = (float) src.sequenceToGraphics(loc.getMax()); float depth = (float) (arrowSize + 2.0 * arrow...
try{ alphaList.remove(getOrder(label)); this.alphabet = AlphabetManager.getCrossProductAlphabet(alphaList); } catch (Throwable e){ e.printStackTrace(); }
public synchronized void removeSequence(Object label) throws ChangeVetoException{ ChangeSupport cs; ChangeEvent cevt; // give the listeners a change to veto this // create a new change event ->the EDIT is a static final variable of type ChangeType in SymbolList interface...
IntegerAlphabet alpha = IntegerAlphabet.getInstance(); Alphabet a1 = alpha.getSubAlphabet(min, max); Alphabet a2 = alpha.getSubAlphabet(min, max);
Alphabet a1 = IntegerAlphabet.getSubAlphabet(min, max); Alphabet a2 = IntegerAlphabet.getSubAlphabet(min, max);
public void testCanonicalSubAlphabet() { int min = 200; int max = 300; IntegerAlphabet alpha = IntegerAlphabet.getInstance(); Alphabet a1 = alpha.getSubAlphabet(min, max); Alphabet a2 = alpha.getSubAlphabet(min, max); assertEquals(a1, a2); }
IntegerAlphabet.SubIntegerAlphabet a1 = alpha.getSubAlphabet(min, max);
IntegerAlphabet.SubIntegerAlphabet a1 = IntegerAlphabet.getSubAlphabet(min, max);
public void testSubAlphabetSymbolsCanonical() throws IllegalSymbolException { int min = 400; int max = 500; IntegerAlphabet alpha = IntegerAlphabet.getInstance(); IntegerAlphabet.SubIntegerAlphabet a1 = alpha.getSubAlphabet(min, max); for(int i = min; i <= max; i++) { assertEquals( a1.getS...
buffPos = buffFill;
buffPos += skipInBuffer;
public long skip(long n) throws IOException { int skipInBuffer; if (n < buffer.length) { skipInBuffer = Math.min((int) n, buffFill - buffPos); } else { skipInBuffer = buffFill - buffPos; } position += skipInBuffer; buffPos = buffFill; if (n > skipInBuffer) { long skippedInStream; if...
public IndexedSequenceDB(IndexStore indexStore) { this(IDMaker.byName, indexStore);
public IndexedSequenceDB(IDMaker idMaker, IndexStore indexStore) { this.idMaker = idMaker; this.indexStore = indexStore;
public IndexedSequenceDB(IndexStore indexStore) { this(IDMaker.byName, indexStore); }
pos = bReader.getFilePointer();
public void addFile(File seqFile) throws IllegalIDException, BioException, ChangeVetoException { boolean completed = false; // initialy assume that we will fail try { seqFile = seqFile.getAbsoluteFile(); CountedBufferedReader bReader = new CountedBufferedReader(new FileReader(seqFile)); ...
}
pos = bReader.getFilePointer(); }
public void addFile(File seqFile) throws IllegalIDException, BioException, ChangeVetoException { boolean completed = false; // initialy assume that we will fail try { seqFile = seqFile.getAbsoluteFile(); CountedBufferedReader bReader = new CountedBufferedReader(new FileReader(seqFile)); ...
public static void getSeqIOEvents(Sequence seq, SeqIOListener listener)
public static void getSeqIOEvents(final Sequence seq, final SeqIOListener listener)
public static void getSeqIOEvents(Sequence seq, SeqIOListener listener) throws BioException { try { // Inform listener of sequence start listener.startSequence(); // Pass name to listener listener.setName(seq.getName()); // Pass URN to listener listener.setURI(seq.getURN()); // Pass s...
private static List getSubFeatures(FeatureHolder fh)
private static List getSubFeatures(final FeatureHolder fh)
private static List getSubFeatures(FeatureHolder fh) { List subfeat = new ArrayList(); for (Iterator fi = fh.features(); fi.hasNext();) { FeatureHolder sfh = (FeatureHolder) fi.next(); subfeat.addAll((Collection) getSubFeatures(sfh)); subfeat.add(sfh); } return subfeat; }
((Long) enRecord[1]).longValue(), entryRecordLength, id);
((Long) enRecord[1]).longValue(), -1, id);
public Index fetch(String id) throws IllegalIDException, BioException { Index index = null; try { Object [] enRecord = entryRandomAccess.findRecord(id); if (enRecord.length == 0) throw new IllegalIDException("Failed to find ID: " + id); // Append curr...
if (line.charAt(0)=='>') {
if (line.length() > 0 && line.charAt(0)=='>') {
public boolean readRichSequence( BufferedReader reader, SymbolTokenization symParser, RichSeqIOListener rsiol, Namespace ns ) throws IllegalSymbolException, IOException, ParseException { String line = reader.readL...
public SimpleAlignment(Map labelToResList) throws IllegalArgumentException {
public SimpleAlignment(Map labelToResList) throws IllegalArgumentException { if(labelToResList.isEmpty()) { throw new IllegalArgumentException("Can't create an alignment with no sequences"); };
public SimpleAlignment(Map labelToResList) throws IllegalArgumentException { this.labels = Collections.unmodifiableList(new ArrayList(labelToResList.keySet())); this.labelToSymbolList = labelToResList; int length = -1; List alphaList = new ArrayList(); for(Iterator li = labels.iterator(); li.hasNext();...
if (isComplement)
if (complementing)
private Location parseLocation(String loc) throws SeqException { boolean joining = false; boolean complementing = false; boolean isComplement = false; boolean ranging = false; int start = -1; Location result = null; StringTokenizer toke = new StringTokenizer(loc, "(),. ><", true); int level = 0; while (toke.hasMo...
for (Iterator i = this.getEvents().iterator(); i.hasNext(); ) { Event event = (Event)i.next(); sb.append("\n"); sb.append("Event="); sb.append(event.getType()); if (event.getType().equals("Alternative splicing")) { sb.append("; Named isoforms="); sb.append(""+event.getNamedIsoforms()); } sb.append(";\n Comment="); sb....
public String getCommentText() throws ParseException { StringBuffer sb = new StringBuffer(); sb.append(PREFIX); sb.append(" "); sb.append(this.getCommentType()); sb.append(": "); // output the specifics if (this.getCommentType().equals(BIOPHYSICOCHEMICAL_PROP...
GappedSymbolListBuilder(FiniteAlphabet alpha)
GappedSymbolListBuilder(final FiniteAlphabet alpha)
GappedSymbolListBuilder(FiniteAlphabet alpha) { this.parser = new TokenParser(alpha); }
SymbolList makeGappedSymbolList(StringBuffer tokeBuffer)
SymbolList makeGappedSymbolList(final StringBuffer tokeBuffer)
SymbolList makeGappedSymbolList(StringBuffer tokeBuffer) { gapIndices = new int [128]; // Record and delete the gaps in reverse order so each // operation won't affect the indices of the remaining gaps int gapCount = 0; for (int i = tokeBuffer.length() - 1; i >= 0; i--) { if (tokeBuffer.charAt(i) == '-') ...
private void recordGap(int gapCount, int gapIndex)
private void recordGap(final int gapCount, final int gapIndex)
private void recordGap(int gapCount, int gapIndex) { // System.out.println("Recording gap at: " + gapIndex); // There is room to record another gap index if (gapCount <= gapIndices.length) { gapIndices[gapCount] = gapIndex; } // The array needs to be extended first else { int [] extGapIndices = new int [...
if(strand != POSITIVE && strand != NEGATIVE) {
if(template.strand != POSITIVE && template.strand != NEGATIVE) {
public SimpleStrandedFeature(Sequence sourceSeq, StrandedFeature.Template template) throws IllegalArgumentException, IllegalAlphabetException { super(sourceSeq, template); if(strand != POSITIVE && strand != NEGATIVE) { throw new IllegalArgumentException( "strand was no...
unboundMin = true;
unboundMax = true;
Object [] parseLocation(String location) throws BioException { this.location = location; if ((countChar(location, '(')) != (countChar(location, '('))) throw new BioException("Unbalanced parentheses in location: " + location); startCoords = new ArrayList(); endCoords = new ArrayList(); instructSta...
}
Object [] parseLocation(String location) throws BioException { this.location = location; if ((countChar(location, '(')) != (countChar(location, '('))) throw new BioException("Unbalanced parentheses in location: " + location); startCoords = new ArrayList(); endCoords = new ArrayList(); instructSta...