micom.viz.interactions¶
Visualizations for interactions.
Attributes¶
Functions¶
|
Plot metabolic interactions between a focal taxa and all other taxa. |
|
Plot metabolic interactions between a focal taxa and all other taxa. |
Module Contents¶
- micom.viz.interactions.plot_focal_interactions(results: micom.workflows.GrowthResults, taxon: str, filename: str = 'focal_interactions_%s.html' % datetime.now().strftime('%Y%m%d'), kind: str = 'mass') None [source]¶
Plot metabolic interactions between a focal taxa and all other taxa.
This will visualize metabolic interaction between a taxon of interest (focal taxon) and all other taxa across all samples.
- Parameters:
results (micom.workflows.GrowthResults) – The results returned by the grow workflow.
taxon (str) – The focal taxon to use as a reference. Must be one of the taxa appearing in results.growth_rates.taxon.
filename (str) – The HTML file where the visualization will be saved.
kind (str) – Which kind of flux to use. Either - “flux”: molar flux of a metabolite - “mass” (default): the mass flux (flux normalized by molecular weight) - “C”: carbon flux - “N”: nitrogen flux
- Returns:
A MICOM visualization. Can be served with viz.serve.
- Return type:
- micom.viz.interactions.plot_mes(results: micom.workflows.GrowthResults, filename: str = 'mes_%s.html' % datetime.now().strftime('%Y%m%d'), groups: pandas.Series = None, prevalence: float = 0.5) None [source]¶
Plot metabolic interactions between a focal taxa and all other taxa.
This will plot the metabolic exchange score across samples and metabolites. The metabolic exchange score (MES) is defined as the geometric mean of the number of producers and consumers for a given metabolite in a sample.
$$ MES = 2cdot
- rac{|p||c|}{|p| + |c|}
$$
- resultsmicom.workflows.GrowthResults
The results returned by the grow workflow.
- filenamestr
The HTML file where the visualization will be saved.
- groupspandas.Series
Additional metadata to stratify MES score. The index must correspond to the sample_id in the results and values must be categorical. The .name attribute will be used to name the groups.
- prevalencefloat in [0, 1]
In what proportion of samples the metabolite has to have a non-zero MES to be shown on the plots. Can be used to show only very commonly exchanged metabolites.
The CSV files will always include all MES scores independent of the prevalence filter which is only used for visualization.
- Visualization
A MICOM visualization. Can be served with viz.serve.