Class CircularView
- All Implemented Interfaces:
Serializable,Annotatable,FeatureHolder,RealizingFeatureHolder,Sequence,SymbolList,Changeable
A circular view onto another Sequence object. The class allows for reinterpretation of locations and indices onto the sequence to allow for overlapping of the origin. The origin is assumed to be the first symbol. Future versions may support changing the origin.
In biojavaxRichSequences intrinsicly know about
circularity. No view is required. We strongly recommend using RichSequence
if possible.- Since:
- 1.1
- Version:
- 1.2
- Author:
- Mark Schreiber
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarderNested classes/interfaces inherited from interface org.biojava.bio.seq.FeatureHolder
FeatureHolder.EmptyFeatureHolder -
Field Summary
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATIONFields inherited from interface org.biojava.bio.seq.FeatureHolder
EMPTY_FEATURE_HOLDER, FEATURES, SCHEMAFields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateFeature(Feature.Template template) Over rides ViewSequence to allow the use of locations that have coordinates outside of the sequence length (which are needed to describe locations that overlap the origin of a circular sequence).subList(int start, int end) Over rides ViewSequence.subStr(int start, int end) Over rides ViewSequence.symbolAt(int index) Over rides ViewSequence.Methods inherited from class org.biojava.bio.seq.impl.ViewSequence
containsFeature, countFeatures, edit, features, filter, filter, getAddedFeatures, getAlphabet, getAnnotation, getName, getSchema, getURN, iterator, length, realizeFeature, removeFeature, seqString, toListMethods inherited from class org.biojava.utils.Unchangeable
addChangeListener, addChangeListener, addForwarder, getForwarders, getListeners, isUnchanging, removeChangeListener, removeChangeListener, removeForwarderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Constructor Details
-
CircularView
-
CircularView
-
-
Method Details
-
symbolAt
Over rides ViewSequence. Allows any integer index, positive or negative to return a symbol via the equation
val = (val % length);Note that base zero is the base immediately before base 1 which is of course the last base of the sequence.- Specified by:
symbolAtin interfaceSymbolList- Overrides:
symbolAtin classViewSequence- Parameters:
index- the index of theSymbolrequested.- Returns:
- the
Symbolspecified by theindex.
-
subStr
Over rides ViewSequence. Allows any integer index, positive or negative to return a symbol via the equation
val = (val % length);Will return a linear String which can, if nescessary, span the origin.
- Specified by:
subStrin interfaceSymbolList- Overrides:
subStrin classViewSequence- Parameters:
start- the index of the fist baseend- the index of the last base- Returns:
- a
Stringrepresentation of the tokenizedSymbols
-
createFeature
Over rides ViewSequence to allow the use of locations that have coordinates outside of the sequence length (which are needed to describe locations that overlap the origin of a circular sequence).- Specified by:
createFeaturein interfaceFeatureHolder- Overrides:
createFeaturein classViewSequence- Parameters:
template- the template of the feature to be created.- Returns:
- the feature created you can use the template of the returned feature to create another of the same type.
- Throws:
BioException- if a non circular location is added that exceeds the 'boundaries' of the sequence.ChangeVetoException- if the sequence is locked.- Since:
- 1.2
-
subList
Over rides ViewSequence. Allows any integer index, positive or negative to return a symbol via the equation
index = ((index -1) % length)+1Will return a linear SymbolList which can ,if nescessary, span the origin.
- Specified by:
subListin interfaceSymbolList- Overrides:
subListin classViewSequence- Parameters:
start- the first base of the sublistend- the last base of the sublist- Returns:
- a
SymbolListcontaining theSymbolsfromstarttoendinclusive
-