:py:mod:`micom.workflows.db_media` ================================== .. py:module:: micom.workflows.db_media .. autoapi-nested-parse:: Test growth media for a model database. Module Contents --------------- Functions ~~~~~~~~~ .. autoapisummary:: micom.workflows.db_media._grow micom.workflows.db_media._try_complete micom.workflows.db_media.check_db_medium micom.workflows.db_media.complete_db_medium micom.workflows.db_media._annotate micom.workflows.db_media.db_annotations .. py:function:: _grow(args) Get the maximum growth rate under a given medium. .. py:function:: _try_complete(args) Try to complete the medium for a model. .. py:function:: check_db_medium(model_db, medium, threads=1) Complete a growth medium for all models in a database. :param model_db: 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`. :type model_db: str :param medium: A growth medium. Must have columns "reaction" and "flux" denoting exchange reactions and their respective maximum flux. Can not be sample specific. :type medium: pd.DataFrame :param threads: 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. :type threads: int >=1 :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. :rtype: pd.DataFrame .. py:function:: complete_db_medium(model_db, medium, growth=0.001, max_added_import=1, minimize_components=False, weights=None, threads=1, strict=list()) Complete a growth medium for all models in a database. :param model_db: 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`. :type model_db: str :param medium: A growth medium. Must have columns "reaction" and "flux" denoting exchange reactions and their respective maximum flux. Can not be sample specific. :type medium: pd.DataFrame :param growth: 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. :type growth: positive float or pandas.Series :param max_added_import: 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. :type max_added_import: positive float :param minimize_components: 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. :type minimize_components: boolean :param weights: 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. :type weights: str :param threads: 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. :type threads: int >=1 :param strict: 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`. :type strict: list :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. :rtype: tuple of (manifest, import fluxes) .. py:function:: _annotate(f) Get annotation for a model. .. py:function:: db_annotations(model_db, threads=1) Get metabolite annotations from a model DB. :param model_db: 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`. :type model_db: str :param threads: 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. :type threads: int >=1 :returns: Annotations for all exchanged metabolites. :rtype: pd.DataFrame