schema API reference¶
-
class
taxadb.schema.Accession(*args, **kwargs)[source]¶ table Accession.
- Each row is a sequence from nucl_*.accession2taxid.gz. Each sequence
- has a taxid.
-
id¶ the primary key
Type: pw.PrimaryKeyField
-
taxid¶ reference to a taxon in the table Taxa.
Type: pw.ForeignKeyField
-
accession¶ the accession number of the sequence.
Type: pw.CharField
-
DoesNotExist¶ alias of
AccessionDoesNotExist
-
class
taxadb.schema.DatabaseFactory(config=None, **kwargs)[source]¶ Database factory to support multiple database type.
- This class may be used to create a database for different type (SQLite,
- PostgreSQL, MySQL).
Parameters: - config (
str) – Path to configuration file. - **kwargs – Arbitrary arguments. Supported (username, password, port, hostname)
Raises: AttributeError– If error occurred during database object build-
__init__(config=None, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__weakref__¶ list of weak references to the object (if defined)
-
_load_config(config=None)[source]¶ Load configuration file
Parameters: config ( str) – Path to configuration fileReturns: True
-
_set_args(args)[source]¶ Set database connection settings and info as config
Parameters: args ( dict) – Dictionary for database settingsReturns: True
-
get(name, section='DBSETTINGS')[source]¶ Get a database connection setting
First checks if the configuration has been set and if the setting is in here. Otherwise, check if this setting is set as an attribute.
Parameters: - name (
str) – Database setting to request - section (
str) – Section to look for, default ‘DBSETTINGS’
Returns: value (
str) if set, None otherwise- name (
-
get_database()[source]¶ Returns the correct database driver
Returns: pw.DatabaseRaises: AttributeError– if –username or –password not passed (if –dbtype [postgres|mysql])
-
class
taxadb.schema.Taxa(*args, **kwargs)[source]¶ table Taxa.
Each row is a taxon.
-
ncbi_taxid¶ the TaxID of the taxon (from nodes.dmp)
Type: pw.IntegerField
-
parent_taxid¶ the TaxID of the parent taxon (from nodes.dmp)
Type: pw.IntegerField
-
tax_name¶ the scientific name of the taxon (from names.dmp)
Type: pw.CharField
-
lineage_level¶ the level of lineage of the taxon (from nodes.dmp)
Type: pw.CharField
-
DoesNotExist¶ alias of
TaxaDoesNotExist
-