org.biojava.bio.seq.db
Class AnnotatedSequenceDB

java.lang.Object
  extended byorg.biojava.utils.AbstractChangeable
      extended byorg.biojava.bio.seq.db.AbstractSequenceDB
          extended byorg.biojava.bio.seq.db.AnnotatedSequenceDB
All Implemented Interfaces:
Changeable, SequenceDB, SequenceDBLite, java.io.Serializable

public class AnnotatedSequenceDB
extends AbstractSequenceDB
implements SequenceDB, java.io.Serializable

SequenceDB implementation which lazily applies a SequenceAnnotator to sequences retrieved from a SequenceDB.

Author:
Thomas Down, Matthew Pocock
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
 
Constructor Summary
AnnotatedSequenceDB(SequenceDB parent, SequenceAnnotator a)
           
 
Method Summary
protected  Sequence doAnnotation(Sequence seq)
          Apply the annotation to a sequence.
 java.lang.String getName()
          Get the name of this sequence database.
 SequenceDB getParent()
          Get the original sequenceDB from this annotated sequenceDB.
 Sequence getSequence(java.lang.String id)
          Retrieve a single sequence by its id.
 java.util.Set ids()
          Get an immutable set of all of the IDs in the database.
 SequenceIterator sequenceIterator()
          Returns a SequenceIterator over all sequences in the database.
 
Methods inherited from class org.biojava.bio.seq.db.AbstractSequenceDB
addSequence, filter, removeSequence
 
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
filter
 
Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
addSequence, removeSequence
 
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
 

Constructor Detail

AnnotatedSequenceDB

public AnnotatedSequenceDB(SequenceDB parent,
                           SequenceAnnotator a)
Method Detail

getParent

public SequenceDB getParent()
Get the original sequenceDB from this annotated sequenceDB.


getName

public java.lang.String getName()
Description copied from interface: SequenceDBLite
Get the name of this sequence database.

Specified by:
getName in interface SequenceDBLite
Returns:
the name of the sequence database, which may be null.

getSequence

public Sequence getSequence(java.lang.String id)
                     throws BioException
Description copied from interface: SequenceDBLite
Retrieve a single sequence by its id.

Specified by:
getSequence in interface SequenceDBLite
Returns:
the Sequence with that id
Throws:
BioException - if there was a failure in retrieving the sequence

ids

public java.util.Set ids()
Description copied from interface: SequenceDB
Get an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.

Specified by:
ids in interface SequenceDB
Returns:
a Set of ids - at the moment, strings

sequenceIterator

public SequenceIterator sequenceIterator()
Description copied from interface: SequenceDB
Returns a SequenceIterator over all sequences in the database. The order of retrieval is undefined.

Specified by:
sequenceIterator in interface SequenceDB
Overrides:
sequenceIterator in class AbstractSequenceDB

doAnnotation

protected Sequence doAnnotation(Sequence seq)
                         throws BioException
Apply the annotation to a sequence.

Parameters:
seq - the sequence to annotate.
Throws:
BioException