rotifer.db.proteins#

rotifer.db.proteins(query, methods=['esl_sfetch', 'entrez'], local_database_path='/databases/fadb/nr/nr', entrez_database='protein', batch_size=200, threads=None, tries=3, progress=True)[source]#

Fetch protein sequences from local or remote databases.

Each retrieval method listed in methods is tried in order and receives only the identifiers that the previous methods could not resolve. Identifiers that remain unresolved after the last method are reported through the logging system.

Parameters:
querylist of str

Sequence identifiers.

methodslist of str, default ['esl_sfetch', 'entrez']

Retrieval methods, tried in order. Supported keywords:

esl_sfetch

Local indexed FASTA files, using rotifer.db.local.easel.FastaCursor.

entrez

NCBI Entrez, using rotifer.db.ncbi.entrez.FastaCursor.

local_database_pathstr, optional

Path to a sequence file, usually a FASTA file indexed by esl-sfetch. Defaults to the local_database_path entry of the rotifer.db configuration.

entrez_databasestr, default ‘protein’

Name of the NCBI Entrez sequence database.

batch_sizeint, default 200

Number of sequences to retrieve per batch.

threadsint, optional

Number of simultaneous threads used while fetching data. Each cursor applies its own default when not set.

triesint, default 3

Maximum number of attempts to download from remote databases.

progressbool, default True

Whether to print progress messages.

Returns:
list of Bio.SeqRecord.SeqRecord

One record per sequence found.

See also

rotifer.db.local.easel.FastaCursor

the local backend

rotifer.db.ncbi.entrez.FastaCursor

the remote backend

Notes

This function is optimized for speed and does not provide access to sequence annotation, because all data is fetched as FASTA formatted streams. Use rotifer.db.ncbi.SequenceCursor when annotations are needed.

Examples

Fetch two proteins, trying the local database first and falling back to NCBI Entrez:

>>> import rotifer.db as rdb
>>> seqs = rdb.proteins(["WP_063732599.1", "YP_009724395.1"])
>>> [s.id for s in seqs]
['WP_063732599.1', 'YP_009724395.1']