rotifer.db.ncbi.mirror.GeneNeighborhoodCursor#

class rotifer.db.ncbi.mirror.GeneNeighborhoodCursor(column='pid', before=7, after=7, min_block_distance=0, strand=None, fttype='same', eukaryotes=False, path='/databases/genomes', exclude_type=['source', 'gene', 'mRNA'], autopid=False, codontable='Bacterial', progress=False, tries=3, batch_size=None, threads=2, *args, **kwargs)[source]#

Bases: GeneNeighborhoodCursor, GeneNeighborhoodCursor, GenomeFeaturesCursor

Fetch gene neighborhoods from genomes in a local mirror.

Target proteins are resolved to genome assemblies through identical protein group (IPG) reports, the genomes are read from the mirror and the annotated regions around each target gene are returned as dataframes.

Parameters:
columnstr, default ‘pid’

Name of the column to scan for matches to the accessions. See rotifer.genome.data.NeighborhoodDF.

beforeint, default 7

Keep at most this number of features, of the same type as the target, before each target.

afterint, default 7

Keep at most this number of features, of the same type as the target, after each target.

min_block_distanceint, default 0

Minimum distance between two consecutive blocks.

strandstr, optional

How to evaluate rows concerning the value of the strand column. Supported values:

  • None : ignore strand

  • same : same strand as the targets

  • + : positive strand features and targets only

  • - : negative strand features and targets only

fttype{‘same’, ‘any’}, default ‘same’

How to process feature types of neighbors. With same, only features of the same type as the target are considered. With any, all features count when setting neighborhood boundaries.

eukaryotesbool, default False

Whether to process eukaryotic genomes.

pathstr, optional

Path to a mirror of the genomes section of the NCBI FTP site.

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 False

Whether to print a progress bar.

triesint, default 3

Number of attempts to process each batch.

batch_sizeint, optional

Number of accessions per batch.

threadsint, optional

Number of processes used for parallel reads.

See also

rotifer.db.ncbi.GeneNeighborhoodCursor

delegator that combines this backend with the FTP and Entrez backends

Examples

>>> from rotifer.db.ncbi import mirror
>>> gnc = mirror.GeneNeighborhoodCursor(progress=True)
>>> df = gnc.fetchall(["EEE9598493.1"])