org.biojava.bio.seq.impl
Class RevCompSequence

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.seq.impl.SimpleSequence
          extended byorg.biojava.bio.seq.impl.RevCompSequence
All Implemented Interfaces:
Annotatable, Changeable, FeatureHolder, RealizingFeatureHolder, Sequence, java.io.Serializable, SymbolList

public class RevCompSequence
extends SimpleSequence

A reverse complement view onto Sequence interface.

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 inherited from class org.biojava.bio.symbol.SymbolList
SymbolList.EmptySymbolList
 
Nested classes inherited from class org.biojava.bio.seq.FeatureHolder
FeatureHolder.EmptyFeatureHolder
 
Nested classes inherited from class org.biojava.bio.Annotatable
Annotatable.AnnotationForwarder
 
Field Summary
protected  Sequence origSeq
           
 
Fields inherited from interface org.biojava.bio.symbol.SymbolList
EDIT, EMPTY_LIST
 
Fields inherited from interface org.biojava.bio.seq.FeatureHolder
EMPTY_FEATURE_HOLDER, FEATURES, SCHEMA
 
Fields inherited from interface org.biojava.bio.Annotatable
ANNOTATION
 
Constructor Summary
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, java.lang.String urn, java.lang.String name, Annotation annotation)
           
 
Method Summary
 java.lang.Object clone()
          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.
 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;
 int countFeatures()
          Count how many features are contained.
 Feature createFeature(Feature.Template ft)
          createFeature() will call createFeature() on the underlying Sequence.
 void edit(Edit e)
          edit() will try to edit the underlying Sequence.
 java.util.Iterator features()
          Iterate over the features in no well defined order.
 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.
 void removeFeature(Feature f)
          Remove a feature attached to this sequence.
 
Methods inherited from class org.biojava.bio.seq.impl.SimpleSequence
createFeature, featureHolderAllocated, filter, filter, getAlphabet, getAnnotation, getChangeSupport, getFeatureHolder, getName, getSchema, getURN, iterator, length, realizeFeature, seqString, setName, setURN, subList, subStr, symbolAt, toList
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Field Detail

origSeq

protected Sequence origSeq
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.


RevCompSequence

public RevCompSequence(Sequence seq,
                       java.lang.String urn,
                       java.lang.String name,
                       Annotation annotation)
                throws IllegalAlphabetException
Method Detail

edit

public void edit(Edit e)
          throws ChangeVetoException,
                 java.lang.IndexOutOfBoundsException
edit() will try to edit the underlying Sequence. So if it is editable this will be too

Since I have not seen and editable Sequence I have not tested this

Specified by:
edit in interface SymbolList
Overrides:
edit in class SimpleSequence
Throws:
ChangeVetoException
java.lang.IndexOutOfBoundsException

features

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

Specified by:
features in interface FeatureHolder
Overrides:
features in class SimpleSequence

countFeatures

public int countFeatures()
Description copied from interface: FeatureHolder
Count how many features are contained.

Specified by:
countFeatures in interface FeatureHolder
Overrides:
countFeatures in class SimpleSequence

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:
containsFeature in interface FeatureHolder
Overrides:
containsFeature in class SimpleSequence

removeFeature

public void removeFeature(Feature f)
                   throws ChangeVetoException
Description copied from class: SimpleSequence
Remove a feature attached to this sequence.

Specified by:
removeFeature in interface FeatureHolder
Overrides:
removeFeature in class SimpleSequence
Throws:
ChangeVetoException

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:
createFeature in interface FeatureHolder
Overrides:
createFeature in class SimpleSequence
Throws:
ChangeVetoException
BioException

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().


clone

public java.lang.Object clone()
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.