|
| 1 | +dFBA Package |
| 2 | +-------------- |
| 3 | + |
| 4 | +++++++++++ |
| 5 | +dFBAPkg() |
| 6 | +++++++++++ |
| 7 | + |
| 8 | +This class defines and executes dynamic FBA simulations of COBRA models: |
| 9 | + |
| 10 | +.. code-block:: python |
| 11 | +
|
| 12 | + from modelseedpy.fbapkg import dFBAPkg |
| 13 | + dfba = dFBAPkg(model, modelseed_db_path, solver = 'glpk', warnings = True, verbose = False, printing = False, jupyter = False) |
| 14 | +
|
| 15 | +- *model* ``cobra.core.model.Model``: the CobraKBase model that will be simulated. The conversion from `standard COBRA models <https://cobrapy.readthedocs.io/en/latest/autoapi/cobra/core/model/index.html>`_ to CobraKBase models is facilitated by the `cobrakbase` package. |
| 16 | +- *modelseed_db_path* ``str``: specifies the path to a local version of the ModelSEED Database. |
| 17 | +- *solver* ``str``: specifies which linear programmating algorithm will be used to simulate the FBA model. The `glpk` solver is selected by default since it is free and universally accessible. |
| 18 | +- *warnings*, *verbose*, & *printing* ``bool``: specifies whether simulation warnings, details and calculations, or results will be printed, respectively. These options are valuable for troubleshooting. |
| 19 | +- *jupyter* ``bool``: specifies whether simulation is being conducted in a Jupyter notebook, in which case the printed DataFrames will be expressed with the ``display()`` function. |
| 20 | + |
| 21 | + |
| 22 | +---------------------- |
| 23 | +simulate() |
| 24 | +---------------------- |
| 25 | + |
| 26 | +A cobrakbase model is simulated with the parameterized kinetics data over the defined time and conditions: |
| 27 | + |
| 28 | +.. code-block:: python |
| 29 | +
|
| 30 | + dfba.simulate(kinetics_path = None, initial_concentrations_M: dict = {}, total_time = 200, timestep = 20, export_name = None, |
| 31 | + export_directory = None, kinetics_data = {}, temperature = 25, p_h = 7, cellular_dry_mass_fg = 222, cellular_fL = 1, |
| 32 | + figure_title = 'Metabolic perturbation', included_metabolites = [], labeled_plots = True, visualize = True, export = True) |
| 33 | +
|
| 34 | +- *kinetics_path* & *kinetics_data* ``str`` & ``dict``: either the path to a `JSON` file that can be imported or a dictionary argument that provide the kinetics data that will constrain the model in the simulation. The `JSON` structure in both means of providing the data, and possesses the following nesting: ``<reaction>`` -> ``<source>`` -> ``substituted_rate_law`` + ``initial_concentrations_M`` + optional keys (such as ``metadata``). The ``substituted_rate_law`` key must contain the mathematically valid rate law expression as a string that can be evaluated through the `eval() built-in function <https://pythongeeks.org/python-eval-function/>`_ of Python, where each metabolite in the rate law is represented by a **single letter variable** that is defined with a `ModelSEED Compound ID <https://modelseed.org/biochem/compounds>`_ in the ``met_id`` key. The concentrations of the ``initial_concentrations_M`` key must be provided in units of Molar and defined for the rate law variable letters. |
| 35 | + |
| 36 | +.. code-block:: json |
| 37 | +
|
| 38 | + { |
| 39 | + "R_3OAS140": { |
| 40 | + "source_1": { |
| 41 | + "substituted_rate_law": "(68.0*A*B)/(50.0*0.34*C+360.0*B+0.34*A+A*B*C)", |
| 42 | + "initial_concentrations_M": { |
| 43 | + "A": 0.0200, |
| 44 | + "C": 0.022, |
| 45 | + "B": 0.0014 |
| 46 | + }, |
| 47 | + "met_id": { |
| 48 | + "A": "cpd11468", |
| 49 | + "B": "cpd00067", |
| 50 | + "C": "cpd11492" |
| 51 | + } |
| 52 | + } |
| 53 | + }, |
| 54 | + "rxn2": { |
| 55 | + "source_1": { |
| 56 | + "substituted_rate_law": "(A*B)/(50.0*0.34*C+3*B+0.34*A+C)", |
| 57 | + "initial_concentrations_M": { |
| 58 | + "A": 0.0200, |
| 59 | + "C": 0.022, |
| 60 | + "B": 0.0012 |
| 61 | + }, |
| 62 | + "met_id": { |
| 63 | + "A": "cpd11468", |
| 64 | + "B": "cpd00011", |
| 65 | + "C": "cpd11492" |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | +The additional keys can provide provenance of the datum source: |
| 72 | + |
| 73 | +.. code-block:: json |
| 74 | +
|
| 75 | + { |
| 76 | + "2-Oxogluterate dehydrogenase": { |
| 77 | + "55199": { |
| 78 | + "RateLaw": "Vmax*S/(Km+S)", |
| 79 | + "initial_concentrations_M": { |
| 80 | + "S": 1.6e-08 |
| 81 | + }, |
| 82 | + "metadata": { |
| 83 | + "Buffer": "[50 mm Mops, 8 mm TCEP, 50 mm Mops, 8 mm TCEP]", |
| 84 | + "Enzyme Variant": "wildtype", |
| 85 | + "KineticMechanismType": "Michaelis-Menten", |
| 86 | + "Organism": "Pisum sativum", |
| 87 | + "Pathway": null, |
| 88 | + "Product": "NADH;H+;Oxidized N-alpha-(benzyloxycarbonyl)-N-omega-(D,L-1,2-dithiolane-3-pentanoyl)-L-lysine", |
| 89 | + "Publication": "Neuburger M, Polidori AM, Pi\u00e8tre E, Faure M, Jourdain A, Bourguignon J, Pucci B, Douce R: Interaction between the lipoamide-containing H-protein and the lipoamide dehydrogenase (L-protein) of the glycine decarboxylase multienzyme system. 1. Biochemical studies., Eur J Biochem 2000 (267) , 2882-9", |
| 90 | + "Temperature": "30.0", |
| 91 | + "annotations": { |
| 92 | + "ECNumber": "1.8.1.4", |
| 93 | + "KeggReactionID": null, |
| 94 | + "PubMedID": 10806385.0, |
| 95 | + "SabioReactionID": 13969 |
| 96 | + }, |
| 97 | + "pH": "7.5", |
| 98 | + "reaction_string": " <-> Nicotinamide adenine dinucleotide-reduced + H+" |
| 99 | + }, |
| 100 | + "substituted_parameters": { |
| 101 | + "Km": { |
| 102 | + "comment": "-", |
| 103 | + "deviat.": "10", |
| 104 | + "end val.": "-", |
| 105 | + "species": "N-alpha-(benzyloxycarbonyl)-N-omega-(D,L-1,2-dithiolane-3-pentanoyl)-L-lysine", |
| 106 | + "start val.": "170.0", |
| 107 | + "type": "Km", |
| 108 | + "unit": "\u00b5M" |
| 109 | + }, |
| 110 | + "Vmax": { |
| 111 | + "comment": "-", |
| 112 | + "deviat.": "7", |
| 113 | + "end val.": "-", |
| 114 | + "species": "-", |
| 115 | + "start val.": "90.0", |
| 116 | + "type": "Vmax", |
| 117 | + "unit": "nmol/min" |
| 118 | + } |
| 119 | + }, |
| 120 | + "substituted_rate_law": "1.5000000000000002e-09*S/(0.00016999999999999999+S)", |
| 121 | + "variables_molar": { |
| 122 | + "Km": "0.00016999999999999999", |
| 123 | + "Vmax": "1.5000000000000002e-09" |
| 124 | + }, |
| 125 | + "variables_name": { |
| 126 | + "Km": "N-alpha-(benzyloxycarbonyl)-N-omega-(D,L-1,2-dithiolane-3-pentanoyl)-L-lysine", |
| 127 | + "S": "N-alpha-(benzyloxycarbonyl)-N-omega-(D,L-1,2-dithiolane-3-pentanoyl)-L-lysine", |
| 128 | + "Vmax": "-" |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | +
|
| 134 | +- *initial_concentrations_M* ``dict``: specifies initial concentrations of the simulated metabolites that supplant values from the kinetics data. Every metabolite in this dictionary must be defined in the model, and the concentrations in units of molar must be assigned according to the metabolite's ModelSEED Compound ID: |
| 135 | + |
| 136 | +.. code-block:: json |
| 137 | +
|
| 138 | + { |
| 139 | + "cpd00002":0.0200, |
| 140 | + "cpd00008":0.0014 |
| 141 | + } |
| 142 | + |
| 143 | +- *total_time* & *timestep* ``float``: specify the total time and the timstep of the simulation in minutes. |
| 144 | +- *export_name* & *export_directory* ``str``: specify the folder name and directory to which the simulation content will be exported, where `None` defaults to a unique folder name in the current working directory. |
| 145 | +- *temperature* & *p_h* ``float``: optionally specify the temperature and pH at which the simulation will occur, respective, which allows the most closely matched datum to be parameterized, where multiple datum exist for the same reaction. |
| 146 | +- *cellular_dry_mass_fg* & *cellular_fL* ``float``: The `dry mass <https://doi.org/10.1101/2021.12.30.474524>`_ and `volume <https://doi.org/10.1128/AEM.00117-14>`_ of the simulated cell, in base units of femto- grams and liters, respectively. These values can be sourced from literature, and the standard values may approximate prokaryotic cells. |
| 147 | +- *figure_title*, *included_metabolites*, & *labeled_plots* ``str``, ``list``, & ``bool``: specify the title of the simulation Figure, the metabolites that will be plotted in the simulation Figure, and where each plot will be labeled with text to clarify its identity. |
| 148 | +- *visualize* & *export* ``bool``: specifies whether the simulation results will be visually depicted or exported to a specified folder, respectively. |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | +---------------------- |
| 153 | +Accessible content |
| 154 | +---------------------- |
| 155 | + |
| 156 | +A multitude of values are stored within the ``dFBA`` object, and can be subsequently used in a workflow. The complete list of content within the ``dFBA`` object can be printed through the built-in ``dir()`` function in the following example sequence: |
| 157 | + |
| 158 | +.. code-block:: python |
| 159 | +
|
| 160 | + # conduct a dFBA simulation |
| 161 | + from dfbapy import dFBA |
| 162 | + dfba = dFBA(model) |
| 163 | + dfba.simulate(reaction_kinetics, None, total_time, timestep) |
| 164 | + |
| 165 | + # evaluate the dFBA simulation contents |
| 166 | + print(dir(dfba)) |
| 167 | +
|
| 168 | +The following list highlights stored content in the ``dFBA`` object after a simulation: |
| 169 | + |
| 170 | +- *model* ``cobra.core.model.Model``: The cobrakbase model that is simulated. |
| 171 | +- *concentrations* & *fluxes* ``pandas.core.frame.DataFrame``: `Pandas DataFrames <https://pandas.pydata.org/pandas-docs/stable/reference/frame.html>`_ that contain the ``mM`` concentrations (or changes thereof) for each metabolite and ``mmol/g_(dw)/hr`` fluxes for each reaction, respectively. |
| 172 | +- *kinetics_data* ``dict``: A dictionary of the kinetics data constrains the model. |
| 173 | +- *timestep_value* ``float``: The simulation timestep in minutes. |
| 174 | +- *compound_ids* ``dict``: A dictionary of all ModelSEED IDs with their names as values, which is loaded from the ModelSEED Database via the parameterized path. |
| 175 | +- *cell_dry_mass* & *cell_liters* ``float``: The mass and volume of the simulated cell. |
| 176 | +- *changed* & *unchanged* ``set``: The exclusive sets of metabolites whose concentrations either changed or did not change over the simulation, respectively. |
| 177 | +- *constrained* ``OrderedDict``: A dictionary with reaction names as the keys and their respective kinetic constraints as the values. |
| 178 | +- *solutions* ``list``: A list of the Cobra solutions from each timestep that constitute the columns of the `fluxes` DataFrame. |
0 commit comments