rotifer.db.ncbi.GenomeFeaturesCursor#

class rotifer.db.ncbi.GenomeFeaturesCursor(readers=['mirror', 'ftp'], writers=[], exclude_type=['source', 'gene', 'mRNA'], autopid=False, codontable='Bacterial', progress=True, tries=3, sleep_between_tries=1, batch_size=None, threads=None, timeout=10, path='/databases/genomes', cache='/tmp', *args, **kwargs)[source]#

Bases: GenomeFeaturesCursor, SequentialDelegatorCursor

Fetch genome annotation as feature tables.

Genomes are located by their assembly accession and converted to dataframes with one row per annotated feature. A local mirror of the NCBI genomes repository, when available, is tried before the NCBI FTP site.

Parameters:
readerslist of str, default ['mirror', 'ftp']

Backend reader modules, tried in order.

writerslist of str, default []

Backend writer modules.

exclude_typelist of str, default ['source', 'gene', 'mRNA']

Feature types to ignore.

autopidbool, default False

Automatically set protein identifiers.

codontablestr or int, default ‘Bacterial’

Codon table used when the data does not define one.

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 processes used for parallel downloads.

timeoutint, default 10

Maximum time, in seconds, to wait for a server connection.

pathstr, optional

Path to a local mirror of the NCBI FTP genomes repository. Defaults to the mirror configuration entry.

cachestr, optional

Directory for temporary files. Defaults to the rotifer cache directory.

See also

GenomeCursor

genomes as annotated sequence records

GeneNeighborhoodCursor

only the regions around target genes

Examples

Load the feature tables of two genomes:

>>> from rotifer.db import ncbi
>>> g = ['GCA_018744545.1', 'GCA_901308185.1']
>>> gfc = ncbi.GenomeFeaturesCursor(progress=True)
>>> df = gfc.fetchall(g)