|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.biojava.bio.seq.SimpleSequence
A basic implementation of the Sequence
interface.
This class now implements all methods in the SymbolList interface by delegating to another SymbolList object. This avoids unnecessary copying, but means that any changes in the underlying SymbolList will be silently reflected in the SimpleSequence. In general, SimpleSequences should only be constructed from SymbolLists which are known to be immutable.
By default, features attached to a SimpleSequence are
realized as simple in-memory implementations using
SimpleFeatureRealizer.DEFAULT
. If you need
alternative feature realization behaviour, any
FeatureRealizer
implementation may be
supplied at construction-time.
Inner classes inherited from class org.biojava.bio.symbol.SymbolList |
SymbolList.EmptySymbolList |
Inner classes inherited from class org.biojava.bio.seq.FeatureHolder |
FeatureHolder.EmptyFeatureHolder |
Inner classes inherited from class org.biojava.bio.seq.FeatureHolder |
FeatureHolder.EmptyFeatureHolder |
Fields inherited from interface org.biojava.bio.symbol.SymbolList |
EMPTY_LIST |
Fields inherited from interface org.biojava.bio.seq.FeatureHolder |
EMPTY_FEATURE_HOLDER |
Fields inherited from interface org.biojava.bio.seq.FeatureHolder |
EMPTY_FEATURE_HOLDER |
Constructor Summary | |
SimpleSequence(SymbolList res,
java.lang.String urn,
java.lang.String name,
Annotation annotation)
Create a SimpleSequence with the symbols and alphabet of res, and the sequence properties listed. |
|
SimpleSequence(SymbolList res,
java.lang.String urn,
java.lang.String name,
Annotation annotation,
FeatureRealizer realizer)
Create a SimpleSequence using a specified FeatureRealizer. |
Method Summary | |
int |
countFeatures()
Count how many features are contained. |
Feature |
createFeature(Feature.Template template)
Create a new Feature, and add it to this FeatureHolder. |
Feature |
createFeature(FeatureHolder fh,
Feature.Template template)
Deprecated. Please use new 1-arg createFeature instead. |
protected boolean |
featureHolderAllocated()
|
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. |
protected SimpleFeatureHolder |
getFeatureHolder()
|
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(FeatureHolder parent,
Feature.Template template)
Realize a feature template. |
void |
removeFeature(Feature f)
Remove a feature attached to this sequence. |
java.lang.String |
seqString()
Stringify this symbol list. |
void |
setName(java.lang.String name)
Assign a name to this sequence |
void |
setURN(java.lang.String urn)
Provide the URN for this sequence |
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 |
Constructor Detail |
public SimpleSequence(SymbolList res, java.lang.String urn, java.lang.String name, Annotation annotation)
res
- the SymbolList to wrap as a sequenceurn
- the URNname
- the name - should be unique if practicalannotation
- the annotation object to use or nullpublic SimpleSequence(SymbolList res, java.lang.String urn, java.lang.String name, Annotation annotation, FeatureRealizer realizer)
res
- the SymbolList to wrap as a sequenceurn
- the URNname
- the name - should be unique if practicalannotation
- the annotation object to use or nullrealizer
- the FeatureRealizer implemetation to use when adding featuresMethod Detail |
public Alphabet getAlphabet()
Every symbol within this SymbolList is a member of this alphabet.
alphabet.contains(symbol) == true
for each symbol that is within this sequence.
public java.util.Iterator iterator()
This is an ordered iterator over the Symbols. It cannot be used to edit the underlying symbols.
public int length()
public java.lang.String seqString()
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.
public java.lang.String subStr(int start, int end)
This should use the same rules as seqString.
start
- the first symbol to includeend
- the last symbol to includepublic SymbolList subList(int start, int end)
The resulting SymbolList will count from 1 to (end-start + 1) inclusive, and refer to the symbols start to end of the original sequence.
start
- the first symbol of the new SymbolListend
- the last symbol (inclusive) of the new SymbolListpublic Symbol symbolAt(int index)
index
- the ofset into this SymbolListpublic java.util.List toList()
This is an immutable list of symbols. Do not edit it.
protected SimpleFeatureHolder getFeatureHolder()
protected boolean featureHolderAllocated()
public java.lang.String getURN()
urn:sequence/embl:U32766
or
urn:sequence/fasta:sequences.fasta|hox3
.public void setURN(java.lang.String urn)
public java.lang.String getName()
The name may contain spaces or odd characters.
public void setName(java.lang.String name)
public Annotation getAnnotation()
public int countFeatures()
public java.util.Iterator features()
public FeatureHolder filter(FeatureFilter ff, boolean recurse)
fc
- the FeatureFilter to applyrecurse
- 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.public Feature realizeFeature(FeatureHolder parent, Feature.Template template) throws BioException
createFeature
method of either
this FeatureHolder
or one of our child Features.public Feature createFeature(Feature.Template template) throws BioException
public Feature createFeature(FeatureHolder fh, Feature.Template template) throws BioException
public void removeFeature(Feature f)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |