micom.workflows.db_media#

Test growth media for a model database.

Module Contents#

Functions#

_grow(args)

Get the maximum growth rate under a given medium.

_try_complete(args)

Try to complete the medium for a model.

check_db_medium(model_db, medium[, threads])

Complete a growth medium for all models in a database.

complete_db_medium(model_db, medium[, growth, ...])

Complete a growth medium for all models in a database.

_annotate(f)

Get annotation for a model.

db_annotations(model_db[, threads])

Get metabolite annotations from a model DB.

micom.workflows.db_media._grow(args)[source]#

Get the maximum growth rate under a given medium.

micom.workflows.db_media._try_complete(args)[source]#

Try to complete the medium for a model.

micom.workflows.db_media.check_db_medium(model_db, medium, threads=1)[source]#

Complete a growth medium for all models in a database.

Parameters:
  • model_db (str) – A pre-built model database. If ending in .qza must be a Qiime 2 artifact of type MetabolicModels[JSON]. Can also be a folder, zip (must end in .zip) file or None if the taxonomy contains a column file.

  • medium (pd.DataFrame) – A growth medium. Must have columns “reaction” and “flux” denoting exchange reactions and their respective maximum flux. Can not be sample specific.

  • threads (int >=1) – The number of parallel workers to use when building models. As a rule of thumb you will need around 1GB of RAM for each thread.

Returns:

Returns an annotated manifest file with a column can_grow that tells you whether the model can grow on the (fixed) medium, and a column growth_rate that gives the growth rate.

Return type:

pd.DataFrame

micom.workflows.db_media.complete_db_medium(model_db, medium, growth=0.001, max_added_import=1, minimize_components=False, weights=None, threads=1, strict=list())[source]#

Complete a growth medium for all models in a database.

Parameters:
  • model_db (str) – A pre-built model database. If ending in .qza must be a Qiime 2 artifact of type MetabolicModels[JSON]. Can also be a folder, zip (must end in .zip) file or None if the taxonomy contains a column file.

  • medium (pd.DataFrame) – A growth medium. Must have columns “reaction” and “flux” denoting exchange reactions and their respective maximum flux. Can not be sample specific.

  • growth (positive float or pandas.Series) – The minimum growth rate the model has to achieve with the (fixed) medium. If a Series will have a minimum growth rate for each id/taxon in the model db.

  • max_added_import (positive float) – Maximum import flux for each added additional import not included in the growth medium. If positive will expand the medium with additional imports in order to fulfill the growth objective.

  • minimize_components (boolean) – Whether to minimize the number of components instead of the total import flux. Might be more intuitive if set to True but may also be slow to calculate.

  • 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 >=1) – The number of parallel workers to use when building models. As a rule of thumb you will need around 1GB of RAM for each thread.

  • strict (list) – Whether to match the imports in the predefined medium exactly. For reactions IDs listed here will not allow additional import of the components in the provided medium. For example, if your input medium has a flux of 10 mmol/(gDW*h) defined and the requested growth rate can only be fulfilled by ramping this up that would be allowed in non-strict mode but forbidden in strict mode. To match all medium components to strict mode use strict=medium.global_id.

Returns:

Returns an annotated manifest file with a column can_grow that tells you whether the model can grow on the (fixed) medium, and a column added that gives the number of added imports apart from the ones in the medium.

Return type:

tuple of (manifest, import fluxes)

micom.workflows.db_media._annotate(f)[source]#

Get annotation for a model.

micom.workflows.db_media.db_annotations(model_db, threads=1)[source]#

Get metabolite annotations from a model DB.

Parameters:
  • model_db (str) – A pre-built model database. If ending in .qza must be a Qiime 2 artifact of type MetabolicModels[JSON]. Can also be a folder, zip (must end in .zip) file or None if the taxonomy contains a column file.

  • threads (int >=1) – The number of parallel workers to use when building models. As a rule of thumb you will need around 1GB of RAM for each thread.

Returns:

Annotations for all exchanged metabolites.

Return type:

pd.DataFrame