rotifer.db.ncbi.TaxonomyCursor#
- class rotifer.db.ncbi.TaxonomyCursor(readers=['ete3', 'entrez'], writers=[], progress=True, tries=3, sleep_between_tries=1, batch_size=None, threads=None, *args, **kwargs)[source]#
Bases:
SequentialDelegatorCursorFetch NCBI Taxonomy data as dataframes.
Taxonomy identifiers are first searched in the local ETE toolkit copy of the NCBI Taxonomy database and only the identifiers not found there are sent to NCBI Entrez.
- Parameters:
- readerslist of str, default
['ete3', 'entrez'] Backend reader modules, tried in order.
- writerslist of str, default []
Backend writer modules.
- progressbool, default True
Whether to print a progress bar.
- triesint, default 3
Number of attempts to download data.
- sleep_between_triesint, default 1
Number of seconds to wait between download attempts.
- batch_sizeint, optional
Number of accessions per batch.
- threadsint, optional
Number of simultaneous threads.
- readerslist of str, default
- Attributes:
- taxcolslist of str
Columns of the returned dataframes:
taxid,organism,superkingdom,lineage,classificationandalternative_taxids.
See also
rotifer.db.local.ete3.TaxonomyCursorthe local backend
rotifer.db.ncbi.entrez.TaxonomyCursorthe remote backend
Examples
>>> from rotifer.db import ncbi >>> tc = ncbi.TaxonomyCursor(progress=False) >>> t = tc.fetchall([2599])
- __getitem__(accessions, *args, **kwargs)[source]#
Fetch taxonomy data for one or more taxids, dictionary style.
- Parameters:
- accessionsint, str or iterable
NCBI Taxonomy identifiers.
- Returns:
- pandas.DataFrame
One row per taxon, with the columns listed in
taxcols.
Examples
>>> from rotifer.db import ncbi >>> tc = ncbi.TaxonomyCursor(progress=False) >>> t = tc[2599]