rotifer.db.methods.GenomeFeaturesCursor#

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

Bases: GenomeCursor

Mixin for cursors that return genome annotation as dataframes.

Genomes are parsed into feature tables, one row per annotated genomic feature, using rotifer.genome.utils.seqrecords_to_dataframe().

fetchall(accessions, *args, **kwargs)[source]#

Fetch all accessions as a single dataframe.

Parameters:
accessionslist of str

Assembly accessions.

Returns:
pandas.DataFrame

The concatenated feature table for every genome found. Empty when nothing could be retrieved.

getids(obj)[source]#

Extract assembly accessions from feature tables.

Parameters:
objpandas.DataFrame, list, set or None

Feature tables produced by the cursor, a list of objects with an assembly attribute, or a set of assembly accessions, which is returned unchanged.

Returns:
set of str

Assembly accessions.

Raises:
TypeError

If obj is of an unsupported type.

parser(stream, accession)[source]#

Parse GenBank streams into a feature table.

Parameters:
streamfile-like or list of file-like

Open data streams returned by GenomeCursor.fetcher().

accessionstr or iterable of str

Assembly accessions, kept for interface compatibility.

Returns:
pandas.DataFrame

Concatenated feature table for all input genomes. The exclude_type, autopid and codontable attributes of the cursor control the conversion.