micom.viz.exchanges

Visualization for exchanges.

Attributes

Classes

Visualization

A visualization object.

Functions

plot_exchanges_per_sample(.strftime[, direction, cluster])

Plot the per sample exchange fluxes.

plot_exchanges_per_taxon(.strftime[, direction, ...])

Plot the exchange fluxes per taxon.

Module Contents

micom.viz.exchanges.logger[source]
class micom.viz.exchanges.Visualization(filename, data, template)[source]

Bases: object

A visualization object.

filename

The filename of trhe saved visualization.

Type:

str

data

The data used to create the Visualization.

Type:

dict

template

The jinja template used to render the visualization.

Type:

jinja2.Template

view()[source]

Open the visualization in a browser.

Parameters:

None.

Return type:

nothing

save(**kwargs)[source]

Render and and save the visualization.

micom.viz.exchanges.plot_exchanges_per_sample(results, filename='sample_exchanges_%s.html' % datetime.now().strftime('%Y%m%d'), direction='import', cluster=True) None[source]

Plot the per sample exchange fluxes.

Parameters:
  • results (micom.workflows.GrowthResults) – The results returned by the grow workflow.

  • filename (str) – The HTML file where the visualization will be saved.

  • direction (str either "import" or "export") – The direction of fluxes to plot.

  • cluster (bool) – Whether to reorder samples so that samples with similar exchange fluxes are close to another.

Returns:

A MICOM visualization. Can be served with viz.serve.

Return type:

Visualization

micom.viz.exchanges.plot_exchanges_per_taxon(results, filename='taxon_exchanges_%s.html' % datetime.now().strftime('%Y%m%d'), direction='import', use_total_flux=False, **tsne_args) None[source]

Plot the exchange fluxes per taxon.

Parameters:
  • results (micom.workflows.GrowthResults) – The exchanges returned by the grow workflow.

  • filename (str) – The HTML file where the visualization will be saved.

  • direction (str either "import" or "export") – The direction of fluxes to plot.

  • use_total_fluxes (bool) – Whether to use fluxes normalized to 1gDW of bacteria or the total flux.

  • tsne_args (dict) – Additional arguments passed to TSNE.

Returns:

A MICOM visualization. Can be served with viz.serve.

Return type:

Visualization