Package org.biojavax.bio.db.ncbi
Class GenbankRichSequenceDB
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojavax.bio.db.AbstractBioEntryDB
org.biojavax.bio.db.AbstractRichSequenceDB
org.biojavax.bio.db.ncbi.GenbankRichSequenceDB
- All Implemented Interfaces:
SequenceDB
,SequenceDBLite
,Changeable
,BioEntryDB
,BioEntryDBLite
,RichSequenceDB
,RichSequenceDBLite
This class contains functions accessing DNA sequences in Genbank format.
It adds methods to return RichSequences instead of plain Sequences.
- Since:
- 1.5
- Author:
- Lei Lai, Matthew Pocock, Laurent Jourdren, Shuvankar Mukherjee, Mark Schreiber, Richard Holland
-
Field Summary
FieldsFields inherited from interface org.biojavax.bio.db.BioEntryDBLite
BIOENTRYS
Fields inherited from interface org.biojava.bio.seq.db.SequenceDBLite
SEQUENCES
-
Constructor Summary
ConstructorsConstructorDescriptionThe default constructor delegates to the parent class. -
Method Summary
Modifier and TypeMethodDescriptionprotected URL
getAddress
(String id) Get the URL object for locating sequence object using eutils.getEmail()
Get the email for Entrez.Getter for property factory.getName()
Get the name of this sequence database.Getter for property namespace.Given the appropriate Genbank ID, return the matching RichSequence object.getRichSequence
(String id, Namespace nsp) Given the appropriate Genbank ID, return the matching RichSequence object.getRichSequences
(Set list) Retrieve rich sequences from a GenbankgetRichSequences
(Set list, RichSequenceDB database) Retrieve rich sequences from a GenbankgetTool()
Get the tool identifier for Entrez.ids()
Get an immutable set of all of the IDs in the database.protected String
makeBatchRequest
(URL url, Set list) Create the Http Post Request to fetch (in batch mode) a list of sequence with Genbank.void
Set the email for Entrez.void
setFactory
(RichSequenceBuilderFactory factory) Setter for property factory.void
setNamespace
(Namespace namespace) Setter for property namespace.void
Set the tool identifier for Entrez.Methods inherited from class org.biojavax.bio.db.AbstractRichSequenceDB
addBioEntry, addRichSequence, addSequence, filter, getBioEntry, getBioEntryIterator, getBioEntrys, getBioEntrys, getRichSequenceIterator, getSequence, removeBioEntry, removeRichSequence, removeSequence, sequenceIterator
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.BioEntryDBLite
addBioEntry, getBioEntry, getBioEntrys, getBioEntrys, removeBioEntry
Methods inherited from interface org.biojava.utils.Changeable
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener
Methods inherited from interface org.biojavax.bio.db.RichSequenceDBLite
addRichSequence, removeRichSequence
Methods inherited from interface org.biojava.bio.seq.db.SequenceDBLite
addSequence, getSequence, removeSequence
-
Field Details
-
urlBatchSequences
- See Also:
-
-
Constructor Details
-
GenbankRichSequenceDB
public GenbankRichSequenceDB()The default constructor delegates to the parent class. The constructor refers to RichObjectFactory.getDefaultNamespace() so make sure your factory is initialised before calling this constructor. Sets the default factory to THRESHOLD.
-
-
Method Details
-
getAddress
Get the URL object for locating sequence object using eutils. The default value of the return format of the sequence object is text.- Throws:
MalformedURLException
-
makeBatchRequest
Create the Http Post Request to fetch (in batch mode) a list of sequence with Genbank.- Parameters:
url
- URL of the requestlist
- List of sequence identifier- Returns:
- The Post request.
-
getRichSequence
Given the appropriate Genbank ID, return the matching RichSequence object.- Specified by:
getRichSequence
in interfaceRichSequenceDBLite
- Parameters:
id
- the Genbank ID to retrieve.- Returns:
- the matching RichSequence object, or null if not found.
- Throws:
Exception
- if the sequence could not be retrieved for reasons other than the identifier not being found.IllegalIDException
- if the database doesn't know about the idBioException
-
getRichSequence
public RichSequence getRichSequence(String id, Namespace nsp) throws BioException, IllegalIDException Given the appropriate Genbank ID, return the matching RichSequence object. Additionally define a new Namespace for the received RichSequence object.- Parameters:
id
- the Genbank ID to retrieve.nsp
- the Namespace to define.- Returns:
- the matching RichSequence object, or null if not found.
- Throws:
Exception
- if the sequence could not be retrieved for reasons other than the identifier not being found.BioException
IllegalIDException
-
getRichSequences
Retrieve rich sequences from a Genbank- Specified by:
getRichSequences
in interfaceRichSequenceDBLite
- Parameters:
list
- List of NCBI sequence number (GI), accession, accession.version, fasta or seqid.- Returns:
- The rich database object (HashSequenceDB) with downloaded rich sequences. You will need to cast the sequences you get from this database object into RichSequence objects if you want to access their full features.
- Throws:
IllegalIDException
- if the database doesn't know about the idBioException
-
getRichSequences
public RichSequenceDB getRichSequences(Set list, RichSequenceDB database) throws BioException, IllegalIDException Retrieve rich sequences from a Genbank- Specified by:
getRichSequences
in interfaceRichSequenceDBLite
- Parameters:
list
- List of NCBI sequence number (GI), accession, accession.version, fasta or seqid.database
- Where to store rich sequences. If database is null, use an HashSequenceDB Object.- Returns:
- The database object with downloaded rich sequences. You will need to cast the sequences you get from this database object into RichSequence objects if you want to access their full features.
- Throws:
IllegalIDException
- if the database doesn't know about the idBioException
-
getName
Description copied from interface:BioEntryDBLite
Get the name of this sequence database.- Specified by:
getName
in interfaceBioEntryDBLite
- Specified by:
getName
in interfaceSequenceDBLite
- Returns:
- the name of the sequence database, which may be null.
-
ids
Description copied from interface:SequenceDB
Get an immutable set of all of the IDs in the database. The ids are legal arguments to getSequence.- Specified by:
ids
in interfaceBioEntryDB
- Specified by:
ids
in interfaceSequenceDB
- Returns:
- a Set of ids - at the moment, strings
-
getFactory
Getter for property factory.- Returns:
- Value of property factory.
-
setFactory
Setter for property factory.- Parameters:
factory
- New value of property factory.
-
getNamespace
Getter for property namespace.- Returns:
- Value of property namespace.
-
setNamespace
Setter for property namespace.- Parameters:
namespace
- New value of property namespace.
-
setTool
Set the tool identifier for Entrez. Defaults to 'biojavax'.- Parameters:
tool
- the new identifier.
-
getTool
Get the tool identifier for Entrez. Defaults to 'biojavax'.- Returns:
- the identifier.
-
setEmail
Set the email for Entrez. Defaults to 'anonymous@biojava.org'.- Parameters:
email
- the new email.
-
getEmail
Get the email for Entrez. Defaults to 'anonymous@biojava.org'.- Returns:
- the email.
-