Package org.biojavax.bio.db
Class AbstractRichSequenceDB
- java.lang.Object
-
- org.biojava.utils.AbstractChangeable
-
- org.biojavax.bio.db.AbstractBioEntryDB
-
- org.biojavax.bio.db.AbstractRichSequenceDB
-
- All Implemented Interfaces:
SequenceDB
,SequenceDBLite
,Changeable
,BioEntryDB
,BioEntryDBLite
,RichSequenceDB
,RichSequenceDBLite
- Direct Known Subclasses:
BioSQLRichSequenceDB
,GenbankRichSequenceDB
,GenpeptRichSequenceDB
,HashRichSequenceDB
public abstract class AbstractRichSequenceDB extends AbstractBioEntryDB implements RichSequenceDB
An abstract implementation of RichSequenceDB that provides the getRichSequenceIterator method.- Since:
- 1.5
- Author:
- Matthew Pocock, Thomas Down, Richard Holland
-
-
Field Summary
-
Fields inherited from interface org.biojavax.bio.db.BioEntryDBLite
BIOENTRYS
-
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
-
-
Constructor Summary
Constructors Constructor Description AbstractRichSequenceDB()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBioEntry(BioEntry seq)
Adds a sequence to the database.void
addRichSequence(RichSequence seq)
Adds a sequence to the database.void
addSequence(Sequence seq)
Adds a sequence to the database.FeatureHolder
filter(FeatureFilter ff)
Query features attached to all sequences in this database.BioEntry
getBioEntry(String id)
Retrieve a single BioEntry by its id.BioEntryIterator
getBioEntryIterator()
Returns a BioEntryIterator over all BioEntrys in the database.BioEntryDB
getBioEntrys(Set ids)
Retrieve multiple BioEntry by their ids.BioEntryDB
getBioEntrys(Set ids, BioEntryDB db)
Retrieve multiple BioEntry into a specific sequence database.RichSequenceIterator
getRichSequenceIterator()
Returns a RichSequenceIterator over all sequences in the database.Sequence
getSequence(String id)
Retrieve a single sequence by its id.void
removeBioEntry(String id)
Remove the BioEntry associated with an ID from the database.void
removeRichSequence(String id)
Remove the RichSequence associated with an ID from the database.void
removeSequence(String id)
Remove the sequence associated with an ID from the database.SequenceIterator
sequenceIterator()
Returns a SequenceIterator over all sequences in the database.-
Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, 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.biojavax.bio.db.BioEntryDB
ids
-
Methods inherited from interface org.biojavax.bio.db.BioEntryDBLite
getName
-
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
-
Methods inherited from interface org.biojavax.bio.db.RichSequenceDBLite
getRichSequence, getRichSequences, getRichSequences
-
Methods inherited from interface org.biojava.bio.seq.db.SequenceDB
ids
-
Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
getName
-
-
-
-
Constructor Detail
-
AbstractRichSequenceDB
public AbstractRichSequenceDB()
-
-
Method Detail
-
getSequence
public Sequence getSequence(String id) throws BioException, IllegalIDException
Description copied from interface:SequenceDBLite
Retrieve a single sequence by its id.- Specified by:
getSequence
in interfaceSequenceDBLite
- Parameters:
id
- the id to retrieve by- Returns:
- the Sequence with that id
- Throws:
IllegalIDException
- if the database doesn't know about the idBioException
- if there was a failure in retrieving the sequence
-
getBioEntry
public BioEntry getBioEntry(String id) throws BioException, IllegalIDException
Description copied from interface:BioEntryDBLite
Retrieve a single BioEntry by its id.- Specified by:
getBioEntry
in interfaceBioEntryDBLite
- Parameters:
id
- the id to retrieve by- Returns:
- the BioEntry with that id
- Throws:
IllegalIDException
- if the database doesn't know about the idBioException
- if there was a failure in retrieving the BioEntry
-
getBioEntrys
public BioEntryDB getBioEntrys(Set ids) throws BioException, IllegalIDException
Description copied from interface:BioEntryDBLite
Retrieve multiple BioEntry by their ids.- Specified by:
getBioEntrys
in interfaceBioEntryDBLite
- Parameters:
ids
- a set of ids to retrieve by- Returns:
- the BioEntrys with those ids
- Throws:
IllegalIDException
- if the database doesn't know about the idBioException
-
getBioEntrys
public BioEntryDB getBioEntrys(Set ids, BioEntryDB db) throws BioException, IllegalIDException
Description copied from interface:BioEntryDBLite
Retrieve multiple BioEntry into a specific sequence database. If that database is null, a new HashBioEntryDB is used.- Specified by:
getBioEntrys
in interfaceBioEntryDBLite
- Parameters:
ids
- a set of ids to retrieve bydb
- a database to load the seqs into- Returns:
- the BioEntrys with that id
- Throws:
IllegalIDException
- if the database doesn't know about the idBioException
-
addSequence
public void addSequence(Sequence seq) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:SequenceDBLite
Adds a sequence to the database.- Specified by:
addSequence
in interfaceSequenceDBLite
- Parameters:
seq
- the Sequence to add- Throws:
IllegalIDException
- if a uniqe ID could not be generated for seqBioException
- if something goes wrong with adding the sequenceChangeVetoException
- if either the database does not allow sequences to be added or the modification was vetoed
-
removeSequence
public void removeSequence(String id) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:SequenceDBLite
Remove the sequence associated with an ID from the database.- Specified by:
removeSequence
in interfaceSequenceDBLite
- Parameters:
id
- the ID of the sequence to remove- Throws:
IllegalIDException
- if there is no sequence for the IDBioException
- if something failed while removing the sequence for that IDChangeVetoException
- if either the database does not allow sequences to be removed or the modification was vetoed
-
addBioEntry
public void addBioEntry(BioEntry seq) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:BioEntryDBLite
Adds a sequence to the database.- Specified by:
addBioEntry
in interfaceBioEntryDBLite
- Overrides:
addBioEntry
in classAbstractBioEntryDB
- Parameters:
seq
- the BioEntry to add- Throws:
IllegalIDException
- if a uniqe ID could not be generated for BioEntryBioException
- if something goes wrong with adding the BioEntryChangeVetoException
- if either the database does not allow BioEntrys to be added or the modification was vetoed
-
removeBioEntry
public void removeBioEntry(String id) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:BioEntryDBLite
Remove the BioEntry associated with an ID from the database.- Specified by:
removeBioEntry
in interfaceBioEntryDBLite
- Overrides:
removeBioEntry
in classAbstractBioEntryDB
- Parameters:
id
- the ID of the BioEntry to remove- Throws:
IllegalIDException
- if there is no BioEntry for the IDBioException
- if something failed while removing the BioEntry for that IDChangeVetoException
- if either the database does not allow BioEntrys to be removed or the modification was vetoed
-
addRichSequence
public void addRichSequence(RichSequence seq) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:RichSequenceDBLite
Adds a sequence to the database.- Specified by:
addRichSequence
in interfaceRichSequenceDBLite
- Parameters:
seq
- the RichSequence to add- Throws:
IllegalIDException
- if a uniqe ID could not be generated for RichSequenceBioException
- if something goes wrong with adding the RichSequenceChangeVetoException
- if either the database does not allow RichSequences to be added or the modification was vetoed
-
removeRichSequence
public void removeRichSequence(String id) throws IllegalIDException, BioException, ChangeVetoException
Description copied from interface:RichSequenceDBLite
Remove the RichSequence associated with an ID from the database.- Specified by:
removeRichSequence
in interfaceRichSequenceDBLite
- Parameters:
id
- the ID of the RichSequence to remove- Throws:
IllegalIDException
- if there is no RichSequence for the IDBioException
- if something failed while removing the RichSequence for that IDChangeVetoException
- if either the database does not allow RichSequences to be removed or the modification was vetoed
-
sequenceIterator
public SequenceIterator sequenceIterator()
Description copied from interface:RichSequenceDB
Returns a SequenceIterator over all sequences in the database. The order of retrieval is undefined. Will always return an instance of RichSequenceIterator.- Specified by:
sequenceIterator
in interfaceRichSequenceDB
- Specified by:
sequenceIterator
in interfaceSequenceDB
- Returns:
- a SequenceIterator over all sequences
-
getBioEntryIterator
public BioEntryIterator getBioEntryIterator()
Description copied from interface:BioEntryDB
Returns a BioEntryIterator over all BioEntrys in the database. The order of retrieval is undefined.- Specified by:
getBioEntryIterator
in interfaceBioEntryDB
- Overrides:
getBioEntryIterator
in classAbstractBioEntryDB
- Returns:
- a BioEntryIterator over all BioEntrys
-
getRichSequenceIterator
public RichSequenceIterator getRichSequenceIterator()
Description copied from interface:RichSequenceDB
Returns a RichSequenceIterator over all sequences in the database. The order of retrieval is undefined.- Specified by:
getRichSequenceIterator
in interfaceRichSequenceDB
- Returns:
- a RichSequenceIterator over all sequences
-
filter
public FeatureHolder filter(FeatureFilter ff)
Description copied from interface:SequenceDB
Query features attached to all sequences in this database. This is equivalent to applyingfilter
to all sequences then merging the results.- Specified by:
filter
in interfaceSequenceDB
- Parameters:
ff
- aFeatureFilter
.
-
-