micom.interaction.focal

Quantify metabolic interactions between taxa.

Functions

sample_interactions(→ pandas.DataFrame)

Quantify interactions in a single sample.

_interact(→ pandas.DataFrame)

Quantify interactions of a focal taxon with other taxa.

interactions(→ pandas.DataFrame)

Quantify interactions of a focal/reference taxon with other taxa.

Module Contents

micom.interaction.focal.sample_interactions(fluxes: pandas.DataFrame, taxon: str) → pandas.DataFrame[source]

Quantify interactions in a single sample.

This attempts to quantify the interactions of a focal taxon with other taxa in a single sample. It does so by comparing the direction of fluxes of the focal taxon with those of other taxa.

The interaction is classified as follows:

  • co-consumed: both the focal taxon and the partner taxon are consuming the same metabolite (both have import fluxes).

  • provided: the focal taxon is producing a metabolite that the partner taxon is consuming (focal has export flux, partner has import flux).

  • received: the focal taxon is consuming a metabolite that the partner taxon is producing (focal has import flux, partner has export flux).

Parameters:
  • fluxes (pd.DataFrame) – The fluxes of a single sample.

  • taxon (str) – The focal taxon to quantify interactions for.

Returns:

A dataframe with the interactions of the focal taxon with other taxa in the sample. If there are no interactions, returns None.

Return type:

pd.DataFrame or None

micom.interaction.focal._interact(args: List) → pandas.DataFrame[source]

Quantify interactions of a focal taxon with other taxa.

micom.interaction.focal.interactions(results: micom.batch.GrowthResults, taxa: None | str | List[str], threads: int = 1, progress: bool = True) → pandas.DataFrame[source]

Quantify interactions of a focal/reference taxon with other taxa.

This parallelizes across taxa. Samples are not parallelized, as sample interactions can be vectorized quite well.

Note

The function will attempt to resolve taxa names to taxon IDs. If a taxon name cannot be resolved, a ValueError will be raised.

Parameters:
  • results (GrowthResults) – The growth results to use.

  • taxa (str, list of str, or None) – The focal taxa to use. Can be a single taxon, a list of taxa or None in which case all taxa are considered.

Returns:

The mapped interactions between the focal taxon and all other taxa.

Return type:

pandas.DataFrame

Raises:

ValueError – If a taxon name cannot be resolved to a taxon ID.