Package org.biojava.bio.seq.impl
Class RevCompSequence
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojava.bio.seq.impl.SimpleSequence
-
- org.biojava.bio.seq.impl.RevCompSequence
-
- All Implemented Interfaces:
Serializable,Annotatable,FeatureHolder,RealizingFeatureHolder,Sequence,SymbolList,Changeable
public class RevCompSequence extends SimpleSequence
A reverse complement view ontoSequenceinterface.All features of the underlying sequence are reflected onto the RevCompSequence using a ProjectedFeatureHolder
calling createFeature() on a RevCompSequence creates a feature on the underlying sequence. Non-Stranded features will return the reverse compemented view of the sequence when getSymbols() is called that is to say if you get what you expect as if your RevCompSequence was a regular Sequence.- Author:
- David Waring, Thomas Down
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
-
Nested classes/interfaces inherited from interface org.biojava.bio.seq.FeatureHolder
FeatureHolder.EmptyFeatureHolder
-
-
Field Summary
Fields Modifier and Type Field Description protected SequenceorigSeq-
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
-
Fields inherited from interface org.biojava.bio.seq.FeatureHolder
EMPTY_FEATURE_HOLDER, FEATURES, SCHEMA
-
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST
-
-
Constructor Summary
Constructors Constructor Description RevCompSequence(Sequence seq)URN, Name and Annotation are copied as is from the original Sequence, unless you use the the other contructor that sets these.RevCompSequence(Sequence seq, String urn, String name, Annotation annotation)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()clone() should make a complete copy of the Sequence with all features (and children) and return a SimpleSequence that is unconnected from the original sequence.booleancontainsFeature(Feature f)containsFeature() will return true if this seq contains the feature in question, or if if the original (non reverse complement) sequence contains the feature;intcountFeatures()Count how many features are contained.FeaturecreateFeature(Feature.Template ft)createFeature() will call createFeature() on the underlying Sequence.voidedit(Edit e)edit() will try to edit the underlying Sequence.Iteratorfeatures()Iterate over the features in no well defined order.FeatureHolderfilter(FeatureFilter ff)Query this set of features using a suppliedFeatureFilter.FeatureHolderfilter(FeatureFilter ff, boolean recurse)Return a new FeatureHolder that contains all of the children of this one that passed the filter fc.FeaturegetFeatureFromOriginal(Feature f)getFeatureFromOriginal() Since you can not create a feature on a projectedFeature at this time, I am including this method so that you can get the corresponding feature from the original sequence.voidremoveFeature(Feature f)Remove a feature attached to this sequence.-
Methods inherited from class org.biojava.bio.seq.impl.SimpleSequence
createFeature, featureHolderAllocated, getAlphabet, getAnnotation, getChangeSupport, getFeatureHolder, getName, getSchema, getURN, iterator, length, realizeFeature, seqString, setName, setURN, subList, subStr, symbolAt, toList, toString
-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
-
-
-
Constructor Detail
-
RevCompSequence
public RevCompSequence(Sequence seq) throws IllegalAlphabetException
URN, Name and Annotation are copied as is from the original Sequence, unless you use the the other contructor that sets these.- Throws:
IllegalAlphabetException
-
RevCompSequence
public RevCompSequence(Sequence seq, String urn, String name, Annotation annotation) throws IllegalAlphabetException
- Throws:
IllegalAlphabetException
-
-
Method Detail
-
edit
public void edit(Edit e) throws ChangeVetoException, IndexOutOfBoundsException
edit() will try to edit the underlying Sequence. So if it is editable this will be tooSince I have not seen and editable Sequence I have not tested this
- Specified by:
editin interfaceSymbolList- Overrides:
editin classSimpleSequence- Parameters:
e- the Edit to perform- Throws:
ChangeVetoException- if either the SymboList does not support the edit, or if the change was vetoedIndexOutOfBoundsException- if the edit does not lie within the SymbolList
-
features
public Iterator features()
Description copied from interface:FeatureHolderIterate over the features in no well defined order.- Specified by:
featuresin interfaceFeatureHolder- Overrides:
featuresin classSimpleSequence- Returns:
- an Iterator
-
countFeatures
public int countFeatures()
Description copied from interface:FeatureHolderCount how many features are contained.- Specified by:
countFeaturesin interfaceFeatureHolder- Overrides:
countFeaturesin classSimpleSequence- Returns:
- a positive integer or zero, equal to the number of features contained
-
filter
public FeatureHolder filter(FeatureFilter ff)
Description copied from interface:FeatureHolderQuery this set of features using a suppliedFeatureFilter.- Specified by:
filterin interfaceFeatureHolder- Overrides:
filterin classSimpleSequence- Parameters:
ff- theFeatureFilterto apply.- Returns:
- all features in this container which match
filter.
-
filter
public FeatureHolder filter(FeatureFilter ff, boolean recurse)
Description copied from interface:FeatureHolderReturn a new FeatureHolder that contains all of the children of this one that passed the filter fc. This method is scheduled for deprecation. Use the 1-arg filter instead.- Specified by:
filterin interfaceFeatureHolder- Overrides:
filterin classSimpleSequence- Parameters:
ff- 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.
-
containsFeature
public boolean containsFeature(Feature f)
containsFeature() will return true if this seq contains the feature in question, or if if the original (non reverse complement) sequence contains the feature;- Specified by:
containsFeaturein interfaceFeatureHolder- Overrides:
containsFeaturein classSimpleSequence- Parameters:
f- the Feature to check- Returns:
- true if f is in this set
-
removeFeature
public void removeFeature(Feature f) throws ChangeVetoException, BioException
Description copied from class:SimpleSequenceRemove a feature attached to this sequence.- Specified by:
removeFeaturein interfaceFeatureHolder- Overrides:
removeFeaturein classSimpleSequence- Throws:
ChangeVetoException- if this FeatureHolder does not support feature removal or if the change was vetoedBioException- if there was an error removing the feature
-
createFeature
public Feature createFeature(Feature.Template ft) throws ChangeVetoException, BioException
createFeature() will call createFeature() on the underlying Sequence. returns the feature as it will be projected onto the reverse complement sequence not the actual feature that was created.- Specified by:
createFeaturein interfaceFeatureHolder- Overrides:
createFeaturein classSimpleSequence- Throws:
ChangeVetoException- if this FeatureHolder does not support creation of new features, or if the change was vetoedBioException- if something went wrong during creating the feature
-
getFeatureFromOriginal
public Feature getFeatureFromOriginal(Feature f)
getFeatureFromOriginal() Since you can not create a feature on a projectedFeature at this time, I am including this method so that you can get the corresponding feature from the original sequence. (which is not projected) and do something with that such as createFeature().
-
-