micom.workflows.media¶
Example workflows for micom.
Attributes¶
Functions¶
|
Prepare a medium for simulation. |
|
Get minimal medium for a single model. |
|
Calculate the minimal medium for a set of community models. |
|
Get the fixed medium for a model. |
|
Augment a growth medium so a community or specific taxa can grow on it. |
Module Contents¶
- 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 specification of either the minimal community growth rate, a minimal taxon growth rate that has to be reachable by all taxa in the sample simultaneously, or a combination of both. All imports will be opened and the minimal medium allowing those growth rates will be returned. What exactly is being minimized (mass flux, carbon flux, number of components) can be specified through the weights and minimize_components options.
Note
A common usage example would be to request some realistic growth rate for the entire community and a very low growth rate for all taxa to ensure they are growing (“alive”) in the medium. The returned solution comes from the medium minimization problem and does not have to correspond to the cooperative tradeoff solution with the same medium.
- 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.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