RepTaxonomy

class RepTaxonomy(taxonomy, taxonomy_columns=None, **kwargs)[source]

An essential class for handling taxonomy data.

Constructor for RepTaxonomy

Parameters
  • taxonomy (Union[pandas.core.frame.DataFrame, pandas.core.series.Series, str]) – Data containing feature taxonomy

  • taxonomy_columns (Union[str, int, Sequence[Union[int, str]]]) – Column(s) containing taxonomy data

  • kwargs (Any) – Passed to read_csv() or biome loader.

Return type

None

Attributes

avail_ranks

List of available taxonomic ranks.

controller

Active essentials controller instance.

data

Actual data representation as pd.DataFrame.

duplicated

List of duplicated feature indices.

is_buckled

Is current essentials instance is mounted or not.

is_mounted

True if current essentials instance is mounted or not.

metadata

The essential instance metadata.

name

The essential instance name.

shape

Return the shape/size of the essential instance.

xrid

Feature indices as pd.Index.

Methods

copy()

Copy of the instance.

drop_feature_by_id(ids, **kwargs)

Remove features by feature ids.

drop_features_without_ranks(ranks[, any])

Remove features that do not contain ranks

drop_features_without_taxa(**kwargs)

Remove features that do not contain taxonomy.

export(output_fp, *args[, _add_ext, sep])

Exports the taxonomy into the specified file.

find_features_by_pattern(pattern_str[, …])

Searches for features with taxa that matches pattern_str

find_features_without_taxa()

Find features without taxa.

from_biom(filepath, **kwargs)

Factory method to construct a RepTaxonomy from biom file.

from_csv(filepath[, taxonomy_columns])

Factory method to construct a RepTaxonomy from CSV file.

get_feature_ids([dtype])

This function and its sample twin is a rescue method to fix RepPhylogeny index problem.

get_lineage_by_id([ids, missing_rank, …])

Get taxonomy lineages by feature ids.

get_subset([rids])

Get subset of the RepTaxonomy.

get_taxonomy_by_id([ids])

Get taxonomy DataFrame by feature ids.

merge_duplicated_features(**kwargs)

Merge features with duplicated taxonomy.

merge_features_by_rank(level, **kwargs)

Merge features by taxonomic rank/level.