Package org.biojavax.bio.db
Class HashRichSequenceDB
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.bio.db.AbstractBioEntryDB
org.biojavax.bio.db.AbstractRichSequenceDB
org.biojavax.bio.db.HashRichSequenceDB
- All Implemented Interfaces:
SequenceDB,SequenceDBLite,Changeable,BioEntryDB,BioEntryDBLite,RichSequenceDB,RichSequenceDBLite
An implementation of RichSequenceDB that uses an underlying HashMap to store the
RichSequence objects.
- Since:
- 1.5
- Author:
- Matthew Pocock, Gerald Loeffler, Richard Holland
-
Field Summary
Fields inherited from interface org.biojavax.bio.db.BioEntryDBLite
BIOENTRYSFields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES -
Constructor Summary
ConstructorsConstructorDescriptionGenerate a HashRichSequenceDB object that will use byName to generate ids for sequences and have a null name.HashRichSequenceDB(String name) Generate a HashRichSequenceDB object that will use byName to generate ids and will have the requested name.HashRichSequenceDB(IDMaker idMaker) Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have a null name.HashRichSequenceDB(IDMaker idMaker, String name) Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have the requested name. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddRichSequence(String id, RichSequence seq) voidAdd a sequence.Retrieve the IDMaker associated with this database.getName()Get the name of this sequence database.Retrieve a single RichSequence by its id.getRichSequences(Set ids) Retrieve multiple RichSequence by its id.getRichSequences(Set ids, RichSequenceDB db) Retrieve multiple RichSequence into a specific sequence database.ids()Get an immutable set of all of the IDs in the database.voidremoveSequence(String id) Remove the sequence associated with an ID from the database.Methods inherited from class org.biojavax.bio.db.AbstractRichSequenceDB
addBioEntry, addSequence, filter, getBioEntry, getBioEntryIterator, getBioEntrys, getBioEntrys, getRichSequenceIterator, getSequence, removeBioEntry, removeRichSequence, sequenceIteratorMethods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.biojavax.bio.db.BioEntryDB
getBioEntryIteratorMethods inherited from interface org.biojavax.bio.db.BioEntryDBLite
addBioEntry, getBioEntry, getBioEntrys, getBioEntrys, removeBioEntryMethods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from interface org.biojavax.bio.db.RichSequenceDB
getRichSequenceIterator, sequenceIteratorMethods inherited from interface org.biojavax.bio.db.RichSequenceDBLite
removeRichSequenceMethods inherited from interface org.biojava.bio.seq.db.SequenceDB
filterMethods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
addSequence, getSequence
-
Constructor Details
-
HashRichSequenceDB
public HashRichSequenceDB()Generate a HashRichSequenceDB object that will use byName to generate ids for sequences and have a null name. -
HashRichSequenceDB
Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have a null name.- Parameters:
idMaker- the object that will work out the default id for a sequence
-
HashRichSequenceDB
Generate a HashRichSequenceDB object that will use byName to generate ids and will have the requested name.- Parameters:
name- the name for this database
-
HashRichSequenceDB
Generate a HashRichSequenceDB object that will use idMaker to generate ids for sequences and have the requested name.- Parameters:
idMaker- the object that will work out the default id for a sequencename- the name for this database
-
-
Method Details
-
getName
Description copied from interface:SequenceDBLiteGet the name of this sequence database.- Specified by:
getNamein interfaceBioEntryDBLite- Specified by:
getNamein interfaceSequenceDBLite- Returns:
- the name of the sequence database, which may be null.
-
getIDMaker
Retrieve the IDMaker associated with this database.- Returns:
- the current IDMaker object
-
getRichSequence
Description copied from interface:RichSequenceDBLiteRetrieve a single RichSequence by its id.- Specified by:
getRichSequencein interfaceRichSequenceDBLite- Parameters:
id- the id to retrieve by- Returns:
- the Sequence with that id
- Throws:
IllegalIDException- if the database doesn't know about the idBioException
-
getRichSequences
Description copied from interface:RichSequenceDBLiteRetrieve multiple RichSequence by its id.- Specified by:
getRichSequencesin interfaceRichSequenceDBLite- Parameters:
ids- a set of ids to retrieve by- Returns:
- the RichSequences with that id
- Throws:
IllegalIDException- if the database doesn't know about the idBioException
-
getRichSequences
public RichSequenceDB getRichSequences(Set ids, RichSequenceDB db) throws BioException, IllegalIDException Description copied from interface:RichSequenceDBLiteRetrieve multiple RichSequence into a specific sequence database. If that database is null, a new HashRichSequenceDB is used.- Specified by:
getRichSequencesin interfaceRichSequenceDBLite- Parameters:
ids- a set of ids to retrieve bydb- a database to load the seqs into- Returns:
- the RichSequences with that id
- Throws:
IllegalIDException- if the database doesn't know about the idBioException
-
ids
Description copied from interface:SequenceDBGet an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.- Specified by:
idsin interfaceBioEntryDB- Specified by:
idsin interfaceSequenceDB- Returns:
- a Set of ids - at the moment, strings
-
addRichSequence
public void addRichSequence(RichSequence seq) throws IllegalIDException, BioException, ChangeVetoException Add a sequence.- Specified by:
addRichSequencein interfaceRichSequenceDBLite- Overrides:
addRichSequencein classAbstractRichSequenceDB- Parameters:
seq- the RichSequence to add- Throws:
ChangeVetoException- if this addition was vetoedIllegalIDException- if a uniqe ID could not be generated for RichSequenceBioException- if something goes wrong with adding the RichSequence
-
addRichSequence
protected void addRichSequence(String id, RichSequence seq) throws IllegalIDException, BioException, ChangeVetoException -
removeSequence
Description copied from interface:SequenceDBLiteRemove the sequence associated with an ID from the database.- Specified by:
removeSequencein interfaceSequenceDBLite- Overrides:
removeSequencein classAbstractRichSequenceDB- 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
-