micom.taxonomy#

Helpers to convert external data to a MICOM taxonomy.

Module Contents#

Functions#

build_from_qiime(→ pandas.DataFrame)

Build the specification for the community models.

qiime_to_micom(feature_table, taxonomy[, collapse_on])

Load a micom taxonomy from Qiime 2 data.

rank_prefixes(→ pandas.Series)

Get the used prefixes for taxonomic ranks.

unify_rank_prefixes(→ pandas.DataFrame)

Handle taxonomic rank prefixes in the taxonomy or database manifest.

Attributes#

micom.taxonomy.RANKS = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species', 'strain'][source]#
micom.taxonomy.build_from_qiime(abundance: pandas.DataFrame, taxonomy: pandas.Series, collapse_on: str = 'genus', trim_rank_prefix: bool = False) pandas.DataFrame[source]#

Build the specification for the community models.

micom.taxonomy.qiime_to_micom(feature_table, taxonomy, collapse_on='genus')[source]#

Load a micom taxonomy from Qiime 2 data.

Parameters:
  • feature_table (str) – Path to a Qiime 2 FeatureTable artifact.

  • taxonomy (str) – Path to a Qiime 2 FeatureData[Taxonomy] artifact.

  • collapse_on (str or List[str]) – The taxa ranks to collapse on. This will dictate how strict the database matching will be as well.

Returns:

A micom taxonomy containing abundances and taxonomy calls in long format.

Return type:

pd.DataFrame

micom.taxonomy.rank_prefixes(manifest: pandas.DataFrame) pandas.Series[source]#

Get the used prefixes for taxonomic ranks.

Parameters:

manifest (pandas.DataFrame) – A model database manifest.

Returns:

The detected prefix for each taxonomic rank in the manifest.

Return type:

pandas.Series

micom.taxonomy.unify_rank_prefixes(taxonomy: pandas.DataFrame, manifest: pandas.DataFrame) pandas.DataFrame[source]#

Handle taxonomic rank prefixes in the taxonomy or database manifest.

Parameters:
  • taxonomy (pandas.DataFrame) – A taxonomy table.

  • manifest (pandas.DataFrame) – A database manifest.

Returns:

The taxonomy with adjusted taxa names consistent with the database.

Return type:

tuple of pandas.DataFrame