Module references¶
Documentation of the different modules and classes used in ncbi-taxonomist
.
Contents
- Module references
- ncbi-taxonomist
- Analyzer
- Cache
- Converter
- Base converter:
ncbitaxonomist.convert.converter
- Attribute mapping:
ncbitaxonomist.convert.convertermap
- Local database accession converter:
ncbitaxonomist.convert.accessiondb
- NCBI accessions converter:
ncbitaxonomist.convert.ncbiaccession
- NCBI taxon converter:
ncbitaxonomist.convert.ncbitaxon
- Local database taxon converter:
ncbitaxonomist.convert.taxadb
- Base converter:
- Data models
- Database
- Entrez results
- Formatter
- Logging
- Mappers
- Parser
- Queries
- Payloads
- Resolver
- Lineage resolver
- Subtrees
- Subtree analyzer
- Utility functions used across modules
ncbi-taxonomist¶
This is the entry script for ncbi-taxonomist. It runs the requested command and checks its parameters.
Analyzer¶
Analyzer handle remote data from Entrez and are inherited from
entrezpy.base.analyzer.EutilsAnalyzer
.
Cache¶
Cache caches taxa to reuse already solved queries, avoiding unnessecary local or remote database lookups.
Accession cache module: ncbitaxonomist.cache.accession
¶
-
class
ncbitaxonomist.cache.accession.
AccessionCache
[source]¶ Class to handle caching of accessions. Accessions are stored mapping accessions as key and class:ncbitaxonomist.model.accession.AccessionData as value.
Converter¶
Converter convert between data models and pure attributes.
Base converter: ncbitaxonomist.convert.converter
¶
-
class
ncbitaxonomist.convert.converter.
ModelConverter
[source]¶ Base class for converters between attributes and models.
-
convert_from_model
(model: Type[ncbitaxonomist.model.datamodel.DataModel], outdict: Mapping[KT, VT_co] = None) → Dict[KT, VT][source]¶ Virtual method converts model to attributes
-
Attribute mapping: ncbitaxonomist.convert.convertermap
¶
Maps indicating which data attributes are convertred to which model attributes.
Local database accession converter: ncbitaxonomist.convert.accessiondb
¶
NCBI accessions converter: ncbitaxonomist.convert.ncbiaccession
¶
Local database taxon converter: ncbitaxonomist.convert.taxadb
¶
-
class
ncbitaxonomist.convert.taxadb.
TaxaDbConverter
[source]¶ Converts local database attributes into class:ncbitaxonomist.model.taxon.Taxon instances and vice versa
Data models¶
ncbi-taxonomist
data models implement taxonomic and accession data. Models use a
ncbitaxonomist.model.datamodel.DataModel
as base class.
Basic data model: ncbitaxonomist.model.datamodel
¶
-
class
ncbitaxonomist.model.datamodel.
DataModel
(cast, attributes: Mapping[KT, VT_co] = None)[source]¶ Base class for data models.
-
classmethod
new
(attributes: Mapping[str, any] = None) → ncbitaxonomist.model.datamodel.DataModel[source]¶ Return new instance with given attributes
-
classmethod
-
ncbitaxonomist.model.datamodel.
standardize_attributes
(attributes: Mapping[str, any])[source]¶ Convert None into empty dictionary. See Important warning at https://docs.python.org/3/tutorial/controlflow.html#default-argument-values
Accession Data model: ncbitaxonomist.model.accession
¶
-
class
ncbitaxonomist.model.accession.
Accession
(attributes: Mapping[KT, VT_co] = None)[source]¶ -
-
classmethod
new
(attributes: Mapping[str, any] = None) → ncbitaxonomist.model.datamodel.DataModel¶ Return new instance with given attributes
-
classmethod
new_from_json
(json_attributes: str) → ncbitaxonomist.model.datamodel.DataModel¶ Return new instance with attributes encoded in JSON
-
taxid
()¶
-
classmethod
Database¶
Database modules for a local ncbi-taxonomist
database
Database tables¶
Base table: ncbitaxonomist.db.table.basetable
¶
-
class
ncbitaxonomist.db.table.basetable.
BaseTable
(name: str, database: str)[source]¶ Implements a basic table in a taxonomist database.
-
create
(connection: Type[sqlite3.Connection]) → ncbitaxonomist.db.table.basetable.BaseTable[source]¶ Virtual function to create table
-
Taxa table: ncbitaxonomist.db.table.taxa
¶
-
class
ncbitaxonomist.db.table.taxa.
TaxaTable
(database: str)[source]¶ Implements taxa table for local taxonomy database.
-
create
(connection: Type[sqlite3.Connection]) → ncbitaxonomist.db.table.taxa.TaxaTable[source]¶ Virtual function to create table
-
create_index
(connection: Type[sqlite3.Connection]) → None[source]¶ Virtual function to create table index
-
get_lineage
(connection: Type[sqlite3.Connection], taxid: int, name_table: str) → Type[sqlite3.Cursor][source]¶ Recursive construction of lineage from given taxid to highest parent.
-
get_subtree
(connection: Type[sqlite3.Connection], taxid: int) → Type[sqlite3.Cursor][source]¶ Depth first search of taxon ids to find the subtree of taxid
-
Names table: ncbitaxonomist.db.table.names
¶
-
class
ncbitaxonomist.db.table.names.
NameTable
(database: str)[source]¶ Implements the name table in a taxonomist database.
-
create
(connection: Type[sqlite3.Connection]) → ncbitaxonomist.db.table.names.NameTable[source]¶ Virtual function to create table
-
Accession table: ncbitaxonomist.db.table.accessions
¶
-
class
ncbitaxonomist.db.table.accessions.
AccessionTable
(database)[source]¶ -
create
(connection: Type[sqlite3.Connection]) → ncbitaxonomist.db.table.accessions.AccessionTable[source]¶ Virtual function to create table
-
Accession table: ncbitaxonomist.db.table.groups
¶
-
class
ncbitaxonomist.db.table.groups.
GroupTable
(database: str)[source]¶ -
create
(connection: Type[sqlite3.Connection]) → ncbitaxonomist.db.table.groups.GroupTable[source]¶ Virtual function to create table
-
create_index
(connection: Type[sqlite3.Connection]) → None[source]¶ Virtual function to create table index
-
delete_from_group
(connection: Type[sqlite3.Connection], values: Iterable[Tuple[str, int]]) → None[source]¶
-
Entrez results¶
Implementations of Entrez results inherited from
entrezpy.base.result.EutilsResult
.
Mappers¶
Mappers handle the mapping of taxids, names, and accessions to each other. Analyzers are inherited and adjusted from entrezpy.
Parser¶
Parsers used in ncbi-taxonomist
Queries¶
Queries are modules implementing a specific taxonomic query, either remote or for a local database.
Collect queries¶
Queries to collect taxa remotely from Entrez.
Map queries¶
Queries to map taxa locally or remotely from Entrez.
Resolve queries¶
Queries to resolve taxa and accessions locally or remotely from Entrez.
Remote query pipelines¶
entrezpy.conduit
pipelines to fetch remote query data.
Payloads¶
Payloads implement the requested taxids, names, and accessions. They keep track what has been successfully analyzed.
Resolver¶
The resolver module implements the resolving of lineages for names, taxids, and accessions.
Lineage resolver¶
The lineage resolver resolves whole lineages or the lienage taxa between given ranks.
Subtree analyzer¶
The subtree analyzer manages subtrees