Package BioSQL :: Module BioSeqDatabase :: Class BioSeqDatabase
[hide private]
[frames] | no frames]

Class BioSeqDatabase

source code

object --+
         |
        BioSeqDatabase

Represents a namespace (sub-database) within the BioSQL database.

i.e. One row in the biodatabase table, and all all rows in the bioentry table associated with it.

Instance Methods [hide private]
 
__init__(self, adaptor, name)
Create a BioDatabase object.
source code
 
__repr__(self)
Return a short summary of the BioSeqDatabase.
source code
 
get_Seq_by_id(self, name)
Get a DBSeqRecord object by its name.
source code
 
get_Seq_by_acc(self, name)
Get a DBSeqRecord object by accession number.
source code
 
get_Seq_by_ver(self, name)
Get a DBSeqRecord object by version number.
source code
 
get_Seqs_by_acc(self, name)
Get a list of DBSeqRecord objects by accession number.
source code
 
get_all_primary_ids(self)
All the primary_ids of the sequences in the database (OBSOLETE).
source code
 
__getitem__(self, key)
Return a DBSeqRecord for one of the sequences in the sub-database.
source code
 
__delitem__(self, key)
Remove an entry and all its annotation.
source code
 
__len__(self)
Return number of records in this namespace (sub database).
source code
 
__contains__(self, value)
Check if a primary (internal) id is this namespace (sub database).
source code
 
__iter__(self)
Iterate over ids (which may not be meaningful outside this database).
source code
 
iterkeys(self)
Iterate over ids (which may not be meaningful outside this database).
source code
 
itervalues(self)
Iterate over DBSeqRecord objects in the namespace (sub database).
source code
 
iteritems(self)
Iterate over (id, DBSeqRecord) for the namespace (sub database).
source code
 
keys(self)
List of ids which may not be meaningful outside this database.
source code
 
values(self)
List of DBSeqRecord objects in the namespace (sub database).
source code
 
items(self)
List of (id, DBSeqRecord) for the namespace (sub database).
source code
 
lookup(self, **kwargs)
Return a DBSeqRecord using an acceptable identifier.
source code
 
get_Seq_by_primary_id(self, seqid)
Get a DBSeqRecord by the primary (internal) id (OBSOLETE).
source code
 
load(self, record_iterator, fetch_NCBI_taxonomy=False)
Load a set of SeqRecords into the BioSQL database.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, adaptor, name)
(Constructor)

source code 

Create a BioDatabase object.

Arguments:
  • adaptor - A BioSQL.Adaptor object
  • name - The name of the sub-database (namespace)
Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 
Return a short summary of the BioSeqDatabase.
Overrides: object.__repr__

get_Seq_by_id(self, name)

source code 

Get a DBSeqRecord object by its name.

Example: seq_rec = db.get_Seq_by_id('ROA1_HUMAN')

The name of this method is misleading since it returns a DBSeqRecord rather than a DBSeq ojbect, and presumably was to mirror BioPerl.

get_Seq_by_acc(self, name)

source code 

Get a DBSeqRecord object by accession number.

Example: seq_rec = db.get_Seq_by_acc('X77802')

The name of this method is misleading since it returns a DBSeqRecord rather than a DBSeq ojbect, and presumably was to mirror BioPerl.

get_Seq_by_ver(self, name)

source code 

Get a DBSeqRecord object by version number.

Example: seq_rec = db.get_Seq_by_ver('X77802.1')

The name of this method is misleading since it returns a DBSeqRecord rather than a DBSeq ojbect, and presumably was to mirror BioPerl.

get_Seqs_by_acc(self, name)

source code 

Get a list of DBSeqRecord objects by accession number.

Example: seq_recs = db.get_Seq_by_acc('X77802')

The name of this method is misleading since it returns a list of DBSeqRecord objects rather than a list of DBSeq ojbects, and presumably was to mirror BioPerl.

get_all_primary_ids(self)

source code 

All the primary_ids of the sequences in the database (OBSOLETE).

These maybe ids (display style) or accession numbers or something else completely different - they are not meaningful outside of this database implementation.

Please use .keys() instead of .get_all_primary_ids()

__getitem__(self, key)
(Indexing operator)

source code 

Return a DBSeqRecord for one of the sequences in the sub-database.

Arguments:
  • key - The internal id for the sequence

lookup(self, **kwargs)

source code 

Return a DBSeqRecord using an acceptable identifier.

Arguments:
  • kwargs - A single key-value pair where the key is one of primary_id, gi, display_id, name, accession, version

get_Seq_by_primary_id(self, seqid)

source code 

Get a DBSeqRecord by the primary (internal) id (OBSOLETE).

Rather than db.get_Seq_by_primary_id(my_id) use db[my_id]

The name of this method is misleading since it returns a DBSeqRecord rather than a DBSeq ojbect, and presumably was to mirror BioPerl.

load(self, record_iterator, fetch_NCBI_taxonomy=False)

source code 

Load a set of SeqRecords into the BioSQL database.

record_iterator is either a list of SeqRecord objects, or an Iterator object that returns SeqRecord objects (such as the output from the Bio.SeqIO.parse() function), which will be used to populate the database.

fetch_NCBI_taxonomy is boolean flag allowing or preventing connection to the taxonomic database on the NCBI server (via Bio.Entrez) to fetch a detailed taxonomy for each SeqRecord.

Example:

from Bio import SeqIO
count = db.load(SeqIO.parse(open(filename), format))

Returns the number of records loaded.