|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.AbstractChangeable
org.biojava.bio.seq.db.AbstractSequenceDB
org.biojava.bio.seq.db.IndexedSequenceDB
public final class IndexedSequenceDB
This class implements SequenceDB on top of a set of sequence files and sequence offsets within these files.
This class is primarily responsible for managing the sequence
IO, such as calculating the sequence file offsets, and parsing
individual sequences based upon file offsets. The actual persistant
storage of all this information is delegated to an instance of
IndexStore
, such as TabIndexStore.
// create a new index store and populate it // this may take some time TabIndexStore indexStore = new TabIndexStore( storeFile, indexFile, dbName, format, sbFactory, symbolParser ); IndexedSequenceDB seqDB = new IndexedSequenceDB(indexStore); for(int i = 0; i < files; i++) { seqDB.addFile(files[i]); } // load an existing index store and fetch a sequence // this should be quite quick TabIndexStore indexStore = TabIndexStore.open(storeFile); SequenceDB seqDB = new IndexedSequenceDB(indexStore); Sequence seq = seqDB.getSequence(id);
Note: We may be able to improve the indexing speed further by discarding all feature creation & annotation requests during index parsing.
TabIndexStore
,
Serialized FormField Summary |
---|
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite |
---|
SEQUENCES |
Constructor Summary | |
---|---|
IndexedSequenceDB(IDMaker idMaker,
IndexStore indexStore)
Create an IndexedSequenceDB by specifying both the IDMaker and IndexStore used. |
|
IndexedSequenceDB(IndexStore indexStore)
Create an IndexedSequenceDB by specifying IndexStore used. |
Method Summary | |
---|---|
void |
addFile(File seqFile)
Add sequences from a file to the sequence database. |
IndexStore |
getIndexStore()
Retrieve the IndexStore. |
String |
getName()
Get the name of this sequence database. |
Sequence |
getSequence(String id)
Retrieve a single sequence by its id. |
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, 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 |
---|
public IndexedSequenceDB(IDMaker idMaker, IndexStore indexStore)
The IDMaker will be used to calculate the ID for each Sequence. It will delegate the storage and retrieval of the sequence offsets to the IndexStore.
idMaker
- the IDMaker used to calculate Sequence IDsindexStore
- the IndexStore delegatepublic IndexedSequenceDB(IndexStore indexStore)
IDMaker.byName will be used to calculate the ID for each Sequence. It will delegate the storage and retrieval of the sequence offsets to the IndexStore.
indexStore
- the IndexStore delegateMethod Detail |
---|
public IndexStore getIndexStore()
public void addFile(File seqFile) throws IllegalIDException, BioException, ChangeVetoException
seqFile
- the file containing the sequence or set of sequences
BioException
- if for any reason the sequences can't be read
correctly
ChangeVetoException
- if there is a listener that vetoes adding
the files
IllegalIDException
public String getName()
getName
in interface SequenceDBLite
public Sequence getSequence(String id) throws IllegalIDException, BioException
SequenceDBLite
getSequence
in interface SequenceDBLite
id
- the id to retrieve by
IllegalIDException
- if the database doesn't know about the id
BioException
- if there was a failure in retrieving the sequencepublic SequenceIterator sequenceIterator()
SequenceDB
sequenceIterator
in interface SequenceDB
sequenceIterator
in class AbstractSequenceDB
public Set ids()
SequenceDB
ids
in interface SequenceDB
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |