rotifer.db.ncbi.ftp.GeneNeighborhoodCursor#

class rotifer.db.ncbi.ftp.GeneNeighborhoodCursor(column='pid', before=7, after=7, min_block_distance=0, strand=None, fttype='same', eukaryotes=False, exclude_type=['source', 'gene', 'mRNA'], autopid=False, codontable='Bacterial', progress=True, tries=3, batch_size=4, threads=15, timeout=10, cache='/tmp', *args, **kwargs)[source]#

Bases: GeneNeighborhoodCursor, GeneNeighborhoodCursor, GenomeFeaturesCursor

Fetch gene neighborhoods from genomes at the NCBI FTP site.

Target proteins are resolved to genome assemblies through identical protein group (IPG) reports, the genomes are downloaded from the FTP site 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.

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.

batch_sizeint, default 4

Number of accessions per batch.

threadsint, default 15

Number of processes used for parallel downloads.

timeoutint, default 10

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

cachestr, optional

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

See also

rotifer.db.ncbi.GeneNeighborhoodCursor

delegator that combines this backend with mirrors and Entrez

Examples

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