rotifer.db.methods.GenomeCursor#

class rotifer.db.methods.GenomeCursor[source]#

Bases: object

Mixin for cursors that return annotated genome sequences.

Genomes are retrieved as GenBank flat files and parsed into Bio.SeqRecord objects, one per contig, each carrying the source assembly accession in an assembly attribute.

fetcher(accession)[source]#

Open the data streams for one or more genomes.

Parameters:
accessionstr or iterable of str

Assembly accessions.

Returns:
list

Open file-like objects, one per genome found. Each stream carries the assembly accession in an assembly attribute.

getids(obj)[source]#

Extract assembly accessions from genome records.

Parameters:
objBio.SeqRecord.SeqRecord, list, set or None

Sequence records produced by the cursor, or a set of assembly accessions, which is returned unchanged.

Returns:
set of str

Assembly accessions, read from each record’s assembly attribute or from Assembly: entries in dbxrefs.

parser(stream, accession)[source]#

Parse GenBank streams into sequence records.

Parameters:
streamlist

Open file-like objects returned by fetcher().

accessionstr or iterable of str

Assembly accessions, kept for interface compatibility.

Returns:
list of Bio.SeqRecord.SeqRecord

One record per contig, each annotated with the source assembly accession in the assembly attribute.