org.biojava.bio.seq.db
Class AnnotatedSequenceDB

java.lang.Object
  |
  +--org.biojava.bio.seq.db.AnnotatedSequenceDB

public class AnnotatedSequenceDB
extends java.lang.Object
implements SequenceDB, java.io.Serializable

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

Author:
Thomas Down
See Also:
Serialized Form

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 imutable set of all of the IDs in the database.
 SequenceIterator sequenceIterator()
          Returns a SequenceTterator over all sequences in the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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: SequenceDB
Get the name of this sequence database.
Specified by:
getName in interface SequenceDB
Tags copied from interface: SequenceDB
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: SequenceDB
Retrieve a single sequence by its id.
Specified by:
getSequence in interface SequenceDB
Tags copied from interface: SequenceDB
Parameters:
the - id to retrieve by
Returns:
the Sequence with that id
Throws:
BioException - if for any reason the sequence could not be retrieved

ids

public java.util.Set ids()
Description copied from interface: SequenceDB
Get an imutable set of all of the IDs in the database. The ids are legal arguments to getSequence.
Specified by:
ids in interface SequenceDB
Tags copied from interface: SequenceDB
Returns:
a Set of ids - at the moment, strings

sequenceIterator

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

doAnnotation

protected Sequence doAnnotation(Sequence seq)
                         throws BioException
Apply the annotation to a sequence.
Parameters:
seq - the sequence to annotate.