rotifer.db.local.easel.FastaCursor#
- class rotifer.db.local.easel.FastaCursor(database_path=['/databases/fadb/nr/nr'], progress=True, tries=1, batch_size=200, threads=2, *args, **kwargs)[source]#
Bases:
SimpleParallelProcessCursorFetch biomolecular sequences with Easel’s
esl-sfetch.Each database file is checked at construction time: files that do not exist are dropped and missing
.ssiindices are built by runningesl-sfetch --index.- Parameters:
- database_pathstr or list of str, optional
Paths to FASTA files. Defaults to the
local_database_pathconfiguration entry.- progressbool, default True
Whether to print a progress bar.
- triesint, default 1
Accepted for interface compatibility; local reads are attempted only once.
- batch_sizeint, default 200
Number of accessions per batch.
- threadsint, optional
Number of simultaneous processes. Defaults to half of the CPU count.
See also
rotifer.db.ncbi.FastaCursordelegator that falls back to NCBI
Examples
>>> from rotifer.db.local import easel >>> fc = easel.FastaCursor("/databases/fadb/nr/nr") >>> seqs = fc.fetchall(["WP_063732599.1"])
- fetcher(accession, *args, **kwargs)[source]#
Run
esl-sfetchand collect its FASTA output.Each configured database file is searched in turn until every accession is found or every file was tried. Accessions not found in any database are registered as missing.
- Parameters:
- accessionstr or iterable of str
Sequence accessions.
- Returns:
- io.StringIO
The concatenated FASTA output.
- getids(obj)[source]#
Extract accessions from sequence records.
- Parameters:
- objBio.SeqRecord.SeqRecord or list of Bio.SeqRecord.SeqRecord
Sequence records produced by the cursor.
- Returns:
- set of str
The record identifiers.
- parser(stream, accession, *args, **kwargs)[source]#
Parse a FASTA stream into sequence records.
NCBI style concatenated descriptions are trimmed to the first entry.
- Parameters:
- streamfile-like
Stream returned by
fetcher().- accessionstr or iterable of str
Sequence accessions, kept for interface compatibility.
- Returns:
- list of Bio.SeqRecord.SeqRecord
The parsed records.