org.acedb.seq
Class AceSequence

java.lang.Object
  |
  +--org.acedb.seq.AceSequence

public class AceSequence
extends java.lang.Object
implements Sequence

Sequence extracted from an ACeDB database.

Author:
Matthew Pocock, Thomas Down

Inner classes inherited from class org.biojava.bio.symbol.SymbolList
SymbolList.EmptySymbolList
 
Inner classes inherited from class org.biojava.bio.seq.FeatureHolder
FeatureHolder.EmptyFeatureHolder
 
Field Summary
protected  AceObject seqObj
           
 
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EMPTY_LIST
 
Fields inherited from interface org.biojava.bio.seq.FeatureHolder
EMPTY_FEATURE_HOLDER
 
Constructor Summary
AceSequence(AceObject seqObj)
           
 
Method Summary
 int countFeatures()
          Count how many features are contained.
 Feature createFeature(Feature.Template template)
          Add a new feature to this sequence.
 Feature createFeature(FeatureHolder fh, Feature.Template template)
          Add a new feature to this sequence.
 java.util.Iterator features()
          Iterate over the features in no well defined order.
 FeatureHolder filter(FeatureFilter ff, boolean recurse)
          Return a new FeatureHolder that contains all of the children of this one that passed the filter fc.
 Alphabet getAlphabet()
          The alphabet that this SymbolList is over.
 Annotation getAnnotation()
          Should return the associated annotation object.
 java.lang.String getName()
          The name of this sequence.
 java.lang.String getURN()
          The URN for this sequence.
 java.util.Iterator iterator()
          An Iterator over all Symbols in this SymbolList.
 int length()
          The number of symbols in this SymbolList.
 Feature realizeFeature(Feature.Template template)
           
 void removeFeature(Feature f)
          Remove a feature from this FeatureHolder.
 java.lang.String seqString()
          Stringify this symbol list.
 SymbolList subList(int start, int end)
          Return a new SymbolList for the symbols start to end inclusive.
 java.lang.String subStr(int start, int end)
          Return a region of this symbol list as a String.
 Symbol symbolAt(int index)
          Return the symbol at index, counting from 1.
 java.util.List toList()
          Returns a List of symbols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seqObj

protected AceObject seqObj
Constructor Detail

AceSequence

public AceSequence(AceObject seqObj)
            throws AceException,
                   BioException
Method Detail

getName

public java.lang.String getName()
Description copied from interface: Sequence
The name of this sequence.

The name may contain spaces or odd characters.

Specified by:
getName in interface Sequence
Tags copied from interface: Sequence
Returns:
the name as a String

getURN

public java.lang.String getURN()
Description copied from interface: Sequence
The URN for this sequence. This will be something like urn:sequence/embl:U32766 or urn:sequence/fasta:sequences.fasta|hox3.
Specified by:
getURN in interface Sequence
Tags copied from interface: Sequence
Returns:
the urn as a String

getAlphabet

public Alphabet getAlphabet()
Description copied from interface: SymbolList
The alphabet that this SymbolList is over.

Every symbol within this SymbolList is a member of this alphabet. alphabet.contains(symbol) == true for each symbol that is within this sequence.

Tags copied from interface: SymbolList
Returns:
the alphabet

getAnnotation

public Annotation getAnnotation()
Description copied from interface: Annotatable
Should return the associated annotation object.
Tags copied from interface: Annotatable
Returns:
an Annotation object, never null

iterator

public java.util.Iterator iterator()
Description copied from interface: SymbolList
An Iterator over all Symbols in this SymbolList.

This is an ordered iterator over the Symbols. It cannot be used to edit the underlying symbols.

Tags copied from interface: SymbolList
Returns:
an iterator

length

public int length()
Description copied from interface: SymbolList
The number of symbols in this SymbolList.
Tags copied from interface: SymbolList
Returns:
the length

symbolAt

public Symbol symbolAt(int index)
Description copied from interface: SymbolList
Return the symbol at index, counting from 1.
Tags copied from interface: SymbolList
Parameters:
index - the ofset into this SymbolList
Returns:
the Symbol at that index
Throws:
java.lang.IndexOutOfBoundsException - if index is less than 1, or greater than the length of the symbol list

toList

public java.util.List toList()
Description copied from interface: SymbolList
Returns a List of symbols.

This is an immutable list of symbols. Do not edit it.

Tags copied from interface: SymbolList
Returns:
a List of Symbols

subList

public SymbolList subList(int start,
                          int end)
Description copied from interface: SymbolList
Return a new SymbolList for the symbols start to end inclusive.

The resulting SymbolList will count from 1 to (end-start + 1) inclusive, and refer to the symbols start to end of the original sequence.

Tags copied from interface: SymbolList
Parameters:
start - the first symbol of the new SymbolList
end - the last symbol (inclusive) of the new SymbolList

subStr

public java.lang.String subStr(int start,
                               int end)
Description copied from interface: SymbolList
Return a region of this symbol list as a String.

This should use the same rules as seqString.

Tags copied from interface: SymbolList
Parameters:
start - the first symbol to include
end - the last symbol to include
Returns:
the string representation
Throws:
java.lang.IndexOutOfBoundsException - if either start or end are not within the sequence

seqString

public java.lang.String seqString()
Description copied from interface: SymbolList
Stringify this symbol list.

It is expected that this will use the symbol's token to render each symbol. It should be parsable back into a SymbolList using the default token parser for this alphabet.

Tags copied from interface: SymbolList
Returns:
a string representation of the symbol list

countFeatures

public int countFeatures()
Description copied from interface: FeatureHolder
Count how many features are contained.
Tags copied from interface: FeatureHolder
Returns:
a positive integer or zero, equal to the number of features contained

features

public java.util.Iterator features()
Description copied from interface: FeatureHolder
Iterate over the features in no well defined order.
Tags copied from interface: FeatureHolder
Returns:
an Iterator

filter

public FeatureHolder filter(FeatureFilter ff,
                            boolean recurse)
Description copied from interface: FeatureHolder
Return a new FeatureHolder that contains all of the children of this one that passed the filter fc.
Tags copied from interface: FeatureHolder
Parameters:
fc - the FeatureFilter to apply
recurse - true if all features-of-features should be scanned, and a single flat collection of features returned, or false if just immediate children should be filtered.

createFeature

public Feature createFeature(FeatureHolder fh,
                             Feature.Template template)
                      throws java.lang.UnsupportedOperationException
Add a new feature to this sequence.

Ace sequences are currently immutable. This may be changed in the future. This method will always throw an UnsupportedOperationException.


createFeature

public Feature createFeature(Feature.Template template)
                      throws java.lang.UnsupportedOperationException
Add a new feature to this sequence.

Ace sequences are currently immutable. This may be changed in the future. This method will always throw an UnsupportedOperationException.

Tags copied from interface: FeatureHolder
Throws:
java.lang.UnsupportedOperationException - if this FeatureHolder does not support addition of new features.

realizeFeature

public Feature realizeFeature(Feature.Template template)

removeFeature

public void removeFeature(Feature f)
Description copied from interface: FeatureHolder
Remove a feature from this FeatureHolder.
Tags copied from interface: FeatureHolder
Throws:
java.lang.UnsupportedOperationException - if this FeatureHolder does not support feature removal.