Package org.biojava.bio.seq.db
Class HashSequenceDB
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.seq.db.AbstractSequenceDB
org.biojava.bio.seq.db.HashSequenceDB
- All Implemented Interfaces:
Serializable,SequenceDB,SequenceDBLite,Changeable
An implementation of SequenceDB that uses an underlying HashMap to store the
sequence objects.
- Author:
- Matthew Pocock, Gerald Loeffler, Matias Pilpari (LinkedHashMap)
- See Also:
-
Field Summary
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES -
Constructor Summary
ConstructorsConstructorDescriptionGenerate a HashSequenceDB object that will use byName to generate ids for sequences and have a null name.HashSequenceDB(String name) Generate a HashSequenceDB object that will use byName to generate ids and will have the requested name.HashSequenceDB(IDMaker idMaker) Generate a HashSequenceDB object that will use idMaker to generate ids for sequences and have a null name.HashSequenceDB(IDMaker idMaker, String name) Generate a HashSequenceDB object that will use idMaker to generate ids for sequences and have the requested name. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSequence(String id, Sequence seq) Add a sequence under a particular id.voidaddSequence(Sequence seq) Adds a sequence to the database.Retrieve the IDMaker associated with this database.getName()Get the name of this sequence database.getSequence(String id) Retrieve a single sequence by its id.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.Returns a SequenceIterator over all sequences in the database.Methods inherited from class org.biojava.bio.seq.db.AbstractSequenceDB
filterMethods 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.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListenerMethods inherited from interface org.biojava.bio.seq.db.SequenceDB
filter
-
Constructor Details
-
HashSequenceDB
public HashSequenceDB()Generate a HashSequenceDB object that will use byName to generate ids for sequences and have a null name. -
HashSequenceDB
Generate a HashSequenceDB 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
-
HashSequenceDB
Generate a HashSequenceDB object that will use byName to generate ids and will have the requested name.- Parameters:
name- the name for this database
-
HashSequenceDB
Generate a HashSequenceDB 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 interfaceSequenceDBLite- Returns:
- the name of the sequence database, which may be null.
-
getSequence
Description copied from interface:SequenceDBLiteRetrieve a single sequence by its id.- Specified by:
getSequencein interfaceSequenceDBLite- Parameters:
id- the id to retrieve by- Returns:
- the Sequence with that id
- Throws:
IllegalIDException- if the database doesn't know about the id
-
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 interfaceSequenceDB- Returns:
- a Set of ids - at the moment, strings
-
sequenceIterator
Description copied from interface:SequenceDBReturns a SequenceIterator over all sequences in the database. The order of retrieval is undefined.- Specified by:
sequenceIteratorin interfaceSequenceDB- Overrides:
sequenceIteratorin classAbstractSequenceDB- Returns:
- a SequenceIterator over all sequences
-
addSequence
Add a sequence under a particular id.- Parameters:
id- the id to useseq- the Sequence to add- Throws:
ChangeVetoException- if this addition was vetoed
-
getIDMaker
Retrieve the IDMaker associated with this database.- Returns:
- the current IDMaker object
-
addSequence
Description copied from interface:SequenceDBLiteAdds a sequence to the database.- Specified by:
addSequencein interfaceSequenceDBLite- Overrides:
addSequencein classAbstractSequenceDB- Parameters:
seq- the Sequence to add- Throws:
ChangeVetoException- if either the database does not allow sequences to be added or the modification was vetoed
-
removeSequence
Description copied from interface:SequenceDBLiteRemove the sequence associated with an ID from the database.- Specified by:
removeSequencein interfaceSequenceDBLite- Overrides:
removeSequencein classAbstractSequenceDB- 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
-