micom.workflows.media

Example workflows for micom.

Attributes

Functions

process_medium(medium, samples)

Prepare a medium for simulation.

_medium(args)

Get minimal medium for a single model.

minimal_media(→ pandas.DataFrame)

Calculate the minimal medium for a set of community models.

_fix_medium(args)

Get the fixed medium for a model.

complete_community_medium(→ pandas.DataFrame)

Augment a growth medium so a community or specific taxa can grow on it.

Module Contents

micom.workflows.media.DIRECTION[source]
micom.workflows.media.process_medium(medium, samples)[source]

Prepare a medium for simulation.

micom.workflows.media._medium(args)[source]

Get minimal medium for a single model.

micom.workflows.media.minimal_media(manifest: pandas.DataFrame, model_folder: str, community_growth: float = 0.0, growth: float = 0.1, minimize_components: bool = False, weights: str = None, summarize: bool = True, solution: bool = False, threads: int = 1) pandas.DataFrame[source]

Calculate the minimal medium for a set of community models.

This requires a minimim

Parameters:
  • manifest (pandas.DataFrame) – The manifest as returned by the build workflow.

  • model_folder (str) – The folder in which to find the files mentioned in the manifest.

  • medium (pandas.Series or pandas.DataFrame) – A growth medium with exchange reaction IDs as index and positive import fluxes as values. If a DataFrame needs columns flux and reaction.

  • community_growth (positive float) – The minimum community-wide growth rate that has to be achieved on the created medium.

  • growth (positive float, dict, or pd.Series) – The taxon-specific growth rates that have to be achieved. If a single float gives the growth rate for each individual taxon. If a dict or Series gives the growth rate for each taxon specified that way. Here keys are the IDs for the taxon.

  • minimize_components (boolean) – Whether to minimize the number of media components rather than the total flux. This will ignore the weight argument and might be very slow.

  • weights (str) – Will scale the fluxes by a weight factor. Can either be “mass” which will scale by molecular mass, a single element which will scale by the elemental content (for instance “C” to scale by carbon content). If None every metabolite will receive the same weight. Will be ignored if minimize_components is True.

  • summarize (boolean) – Whether to summarize the medium across all samples. If False will return a medium for each sample.

  • threads (int) – The number of processes to use.

Returns:

Either the medium or, if solution=True a tuple of the medium and the growth results.

Return type:

pandas.DataFrame or tuple of pandas.DataFrame and GrowthResult

micom.workflows.media._fix_medium(args)[source]

Get the fixed medium for a model.

micom.workflows.media.complete_community_medium(manifest: pandas.DataFrame, model_folder: str, medium: pandas.DataFrame, community_growth: float = 0.1, min_growth: float = 0.001, max_import: float = 1, minimize_components: float = False, summarize: bool = True, weights: str = None, threads: int = 1) pandas.DataFrame[source]

Augment a growth medium so a community or specific taxa can grow on it.

Note

This will complete a growth medium for a single community/sample. For building growth media that work for arbitrary samples/compositions of taxa see complete_db_medium In contrast to complete_db_medium this will account for taxon-taxon interactions. However, growth rates will no longer be an emergent property of the simulation, because one needs to specify the community growth rate or growth rates for individual taxa.

Parameters:
  • manifest (pandas.DataFrame) – The manifest as returned by the build workflow.

  • model_folder (str) – The folder in which to find the files mentioned in the manifest.

  • medium (pandas.Series or pandas.DataFrame) – A growth medium with exchange reaction IDs as index and positive import fluxes as values. If a DataFrame needs columns flux and reaction.

  • community_growth (positive float) – The minimum community-wide growth rate that has to be achieved on the created medium.

  • min_growth (positive float) – The minimum biomass production required for growth.

  • max_import (positive float) – The maximum import rate for added imports.

  • minimize_components (boolean) – Whether to minimize the number of media components rather than the total flux.

  • summarize (boolean) – Whether to summarize the medium across all samples. If False will return a medium for each sample.

  • weights (str) – Will scale the fluxes by a weight factor. Can either be “mass” which will scale by molecular mass, a single element which will scale by the elemental content (for instance “C” to scale by carbon content). If None every metabolite will receive the same weight. Will be ignored if minimize_components is True.

  • threads (int) – The number of processes to use.

Returns:

A new growth medium with the smallest amount of augmentations such that all members of the community can grow in it.

Return type:

pandas.DataFrame