# DielModels
### Description
*DielModels* is a python package generated from this project and has its own [ReadtheDocs](https://dielmodels.readthedocs.io/en/latest/index.html) file.
Despite numerous successful studies, modeling plant metabolism remains challenging for several reasons, such as limited information, incomplete annotations, and dynamic changes in plant metabolism that occur under different conditions, including night and day.
In particular, the integration of these day-night cycles (diel cycles) is complex, laborious, and time-consuming.
With this in mind, this package aims to accelerate this process by being able to transform a non-diel model into a diel model.
### Table of contents:
- [Installation](#installation)
- [Pip](#pip)
- [Getting Started](#getting-started)
- [Expanding the pipeline](#expanding-the-pipeline)
- [Where to find the publication results](#where-to-find-the-publication-results)
## Installation
### Pip
``` pip install DielModels==1.1.0 ```
## Getting Started
Using this package, you can handle generic or multi-tissue models by:
* Assigning day and night;
* Inserting specified metabolites into the storage pool allowing their transition between day and night, and vice versa;
* Supressing the photon reaction flux at night;
* Setting the flux of the nitrate reactions to 3:2 according to the literature;
* (optional) Taking the day and night biomass reactions and creating a total biomass reaction resulting from the junctions of both. Supressing at the same time the flow of the individual reactions to zero and setting the total biomass reaction as the objective function.
If each method is to be applied individually it is essential that the first 3 steps are applied in that order specifically.
**Alternatively, it is possible to apply all methods to a given model, running the entire pipeline (where the arguments are all relative to the original model), as shown below:**
- Generic model:
```python
import cobra
from diel_models.diel_models_creator import diel_models_creator
model = cobra.io.read_sbml_model('.../.../desired_single_tissue_model.xml')
storage_pool_metabolites = ['Metabolite_ID_1', 'Metabolite_ID_2', 'Metabolite_ID_3']
diel_models_creator(model, storage_pool_metabolites, ['Photon_Reaction_ID'], ['Nitrate_Reaction_ID'], 'Biomass_Reaction_ID')
```
- Multi-tissue model:
```python
import cobra
from diel_models.diel_models_creator import diel_models_creator
model = cobra.io.read_sbml_model('.../.../desired_multi_tissue_model.xml')
storage_pool_metabolites = ['Metabolite_ID_1', 'Metabolite_ID_2', 'Metabolite_ID_3']
tissues = ['Tissue_ID_1', 'Tissue_ID_2']
diel_models_creator(model, storage_pool_metabolites, ['Photon_Reaction_ID'], ['Nitrate_Reaction_ID'], 'Biomass_Reaction_ID', tissues)
```
This is possible due to the created *Pipeline* class that derives from a *Step* class with abstract methods - both present in this package, in the [pipeline.py](src/diel_models/pipeline.py) file.
## Expanding the pipeline
It is possible to add other classes to the *diel_models_creator* function, if desired, for example to create a different adjustment that needs to be taken into account in the diel models.
To expand the pipeline, it is necessary to create a new class that inherits from the *Step* class and implement the abstract methods.
Considering a new hypothetical file **new_class.py**, this new class, in addition to the desired methods, would have to contain the two abstract methods of the *Step* class, *run* and *validate*, which, respectively, runs all the methods of the class returning the model and performs asserts to validate whether the class has been implemented successfully (or simply doesn't apply any if it doesn't make sense).
```python
from diel_models.pipeline import Step
class NewClass(Step):
def __init__(self, model, param1):
self.model = model
self.param1 = param1
def method1(self):
pass
def method2(self):
pass
def run(self):
self.method1()
self.method2()
return self.model
def validate(self):
pass
```
Then you need to adjust the *diel_models_creator* function to integrate the new class. This function is in the [diel_models_creator.py](src/diel_models/diel_models_creator.py) file.
```python
from typing import List
from cobra import Model
from diel_models.new_class import NewClass
from diel_models.pipeline import Pipeline
def diel_models_creator(model: Model, storage_pool_metabolites: List[str], photon_reaction_id: List[str],
nitrate_exchange_reaction: List[str], param1, biomass_reaction_id: str = None, tissues: List[str] = None) -> Model:
storage_pool_metabolites_with_day = [metabolite + "_Day" for metabolite in storage_pool_metabolites]
photon_reaction_id_night = [photon_night_reaction + "_Night" for photon_night_reaction in photon_reaction_id]
# ...
steps = [
# ...
NewClass(model, param1)
]
pipeline = Pipeline(model, steps)
pipeline.run()
return pipeline.model
```
Finally, you can run the *diel_models_creator* function with the new class.
Just as you can expand methods in the pipeline, you can modify or remove others.
## Where to find the publication results
### AraGEM:
* Details about the fluxes in the AraGEM diel model reactions in the day and night phases, as well as in the original model where calculated in [aragem_reactions_fluxes.py](validation/arabidopsis/aragem_reactions_fluxes.py) file.
* Validation of the metabolites exchange reactions through simulation using pFBA where performed in [simulation_sp.py](validation/arabidopsis/simulation_sp/simulation_sp.py) file.
* [DFA file](DFA/differential_flux_analysis.py) and respective [Test file](tests/integration_tests/test_dfa.py).
* [Plot](tests/reconstruction_results/MODEL1507180028/results_troppo/DielModel/dfa/diel_model_DFA_pathway_result.png) from the pathway enrichment method representing the amount of differentially expressed reactions between day and night in each pathway.
* [PCA](PCA_T-SNE/gráfico_pca_df_filtrado.png) and [t-SNE](PCA_T-SNE/gráfico_t-sne_df_filtrado.png) plots with the sampling values filtered by the differentially expressed reactions.
### _Quercus suber_:
* Details about the fluxes in the _Quercus suber_ diel model reactions in the day and night phases, as well as in the original model where calculated in [quercus_reactions_fluxes.py](validation/quercus/quercus_reactions_fluxes.py) file.
* Slight adjustments to the biomass reaction in the generated diel model can be found [here](validation/quercus/comparison/auxiliar_model_change.py).
* Validation of the metabolites exchange reactions through simulation using pFBA where performed in [simulation_sp_multi_quercus.py](validation/quercus/simulation_sp/simulation_sp_multi_quercus.py) file.
* The comparison between the flux of the biomass reaction for both diel multi-tissue models are in the [quercus_diel_models_comparison.py](validation/quercus/comparison/quercus_multi_tissue_diel_models_comparison.py) file.
### QY for the several models:
* The scripts for quantum yield and assimilation quotient calculation for the _Zea mays L._ (2011), _Arabidopsis thaliana_ (2010), _Populus trichocarpa_ (2020), _Solanum lycopersicum_ (2015), _Solanum lycopersicum_ (2022) and _Solanum tuberosum_ (2018) models can be found in the [QY](validation/QY) folder.
Raw data
{
"_id": null,
"home_page": null,
"name": "DielModels",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "plants, diel models",
"author": "Luciana Martins and Jo\u00e3o Capela",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c3/de/86ab70024ed2db0dd31f308ce3e7fac9c1f3e1fb5a97570ac1700185925d/dielmodels-1.1.0.tar.gz",
"platform": "unix",
"description": "# DielModels\r\n\r\n### Description\r\n*DielModels* is a python package generated from this project and has its own [ReadtheDocs](https://dielmodels.readthedocs.io/en/latest/index.html) file.\r\n\r\nDespite numerous successful studies, modeling plant metabolism remains challenging for several reasons, such as limited information, incomplete annotations, and dynamic changes in plant metabolism that occur under different conditions, including night and day.\r\nIn particular, the integration of these day-night cycles (diel cycles) is complex, laborious, and time-consuming.\r\n\r\nWith this in mind, this package aims to accelerate this process by being able to transform a non-diel model into a diel model.\r\n\r\n### Table of contents:\r\n\r\n- [Installation](#installation)\r\n - [Pip](#pip)\r\n- [Getting Started](#getting-started)\r\n- [Expanding the pipeline](#expanding-the-pipeline)\r\n- [Where to find the publication results](#where-to-find-the-publication-results)\r\n\r\n## Installation\r\n### Pip\r\n\r\n``` pip install DielModels==1.1.0 ```\r\n\r\n## Getting Started\r\nUsing this package, you can handle generic or multi-tissue models by:\r\n\r\n* Assigning day and night;\r\n* Inserting specified metabolites into the storage pool allowing their transition between day and night, and vice versa; \r\n* Supressing the photon reaction flux at night; \r\n* Setting the flux of the nitrate reactions to 3:2 according to the literature; \r\n* (optional) Taking the day and night biomass reactions and creating a total biomass reaction resulting from the junctions of both. Supressing at the same time the flow of the individual reactions to zero and setting the total biomass reaction as the objective function.\r\n\r\nIf each method is to be applied individually it is essential that the first 3 steps are applied in that order specifically.\r\n\r\n**Alternatively, it is possible to apply all methods to a given model, running the entire pipeline (where the arguments are all relative to the original model), as shown below:**\r\n\r\n- Generic model:\r\n\r\n```python\r\nimport cobra\r\nfrom diel_models.diel_models_creator import diel_models_creator\r\n\r\nmodel = cobra.io.read_sbml_model('.../.../desired_single_tissue_model.xml')\r\n\r\nstorage_pool_metabolites = ['Metabolite_ID_1', 'Metabolite_ID_2', 'Metabolite_ID_3']\r\n\r\ndiel_models_creator(model, storage_pool_metabolites, ['Photon_Reaction_ID'], ['Nitrate_Reaction_ID'], 'Biomass_Reaction_ID')\r\n```\r\n\r\n- Multi-tissue model:\r\n\r\n```python\r\nimport cobra\r\nfrom diel_models.diel_models_creator import diel_models_creator\r\n\r\nmodel = cobra.io.read_sbml_model('.../.../desired_multi_tissue_model.xml')\r\n\r\nstorage_pool_metabolites = ['Metabolite_ID_1', 'Metabolite_ID_2', 'Metabolite_ID_3']\r\n\r\ntissues = ['Tissue_ID_1', 'Tissue_ID_2']\r\n\r\ndiel_models_creator(model, storage_pool_metabolites, ['Photon_Reaction_ID'], ['Nitrate_Reaction_ID'], 'Biomass_Reaction_ID', tissues)\r\n```\r\n\r\nThis is possible due to the created *Pipeline* class that derives from a *Step* class with abstract methods - both present in this package, in the [pipeline.py](src/diel_models/pipeline.py) file.\r\n\r\n## Expanding the pipeline\r\n\r\nIt is possible to add other classes to the *diel_models_creator* function, if desired, for example to create a different adjustment that needs to be taken into account in the diel models.\r\nTo expand the pipeline, it is necessary to create a new class that inherits from the *Step* class and implement the abstract methods.\r\n \r\nConsidering a new hypothetical file **new_class.py**, this new class, in addition to the desired methods, would have to contain the two abstract methods of the *Step* class, *run* and *validate*, which, respectively, runs all the methods of the class returning the model and performs asserts to validate whether the class has been implemented successfully (or simply doesn't apply any if it doesn't make sense).\r\n\r\n```python\r\nfrom diel_models.pipeline import Step\r\n\r\nclass NewClass(Step):\r\n\r\n def __init__(self, model, param1):\r\n self.model = model\r\n self.param1 = param1\r\n\r\n def method1(self):\r\n pass\r\n\r\n def method2(self):\r\n pass\r\n\r\n def run(self):\r\n self.method1()\r\n self.method2()\r\n\r\n return self.model\r\n\r\n def validate(self):\r\n pass\r\n```\r\n\r\nThen you need to adjust the *diel_models_creator* function to integrate the new class. This function is in the [diel_models_creator.py](src/diel_models/diel_models_creator.py) file.\r\n\r\n```python\r\nfrom typing import List\r\n\r\nfrom cobra import Model\r\n\r\nfrom diel_models.new_class import NewClass\r\n\r\nfrom diel_models.pipeline import Pipeline\r\n\r\ndef diel_models_creator(model: Model, storage_pool_metabolites: List[str], photon_reaction_id: List[str],\r\n nitrate_exchange_reaction: List[str], param1, biomass_reaction_id: str = None, tissues: List[str] = None) -> Model: \r\n \r\n storage_pool_metabolites_with_day = [metabolite + \"_Day\" for metabolite in storage_pool_metabolites]\r\n photon_reaction_id_night = [photon_night_reaction + \"_Night\" for photon_night_reaction in photon_reaction_id]\r\n # ...\r\n \r\n steps = [\r\n # ...\r\n NewClass(model, param1)\r\n ]\r\n\r\n pipeline = Pipeline(model, steps)\r\n pipeline.run()\r\n return pipeline.model\r\n```\r\n\r\nFinally, you can run the *diel_models_creator* function with the new class.\r\n\r\nJust as you can expand methods in the pipeline, you can modify or remove others.\r\n\r\n## Where to find the publication results\r\n\r\n### AraGEM:\r\n\r\n* Details about the fluxes in the AraGEM diel model reactions in the day and night phases, as well as in the original model where calculated in [aragem_reactions_fluxes.py](validation/arabidopsis/aragem_reactions_fluxes.py) file.\r\n* Validation of the metabolites exchange reactions through simulation using pFBA where performed in [simulation_sp.py](validation/arabidopsis/simulation_sp/simulation_sp.py) file.\r\n* [DFA file](DFA/differential_flux_analysis.py) and respective [Test file](tests/integration_tests/test_dfa.py).\r\n* [Plot](tests/reconstruction_results/MODEL1507180028/results_troppo/DielModel/dfa/diel_model_DFA_pathway_result.png) from the pathway enrichment method representing the amount of differentially expressed reactions between day and night in each pathway.\r\n* [PCA](PCA_T-SNE/gr\u00e1fico_pca_df_filtrado.png) and [t-SNE](PCA_T-SNE/gr\u00e1fico_t-sne_df_filtrado.png) plots with the sampling values filtered by the differentially expressed reactions.\r\n\r\n### _Quercus suber_:\r\n\r\n* Details about the fluxes in the _Quercus suber_ diel model reactions in the day and night phases, as well as in the original model where calculated in [quercus_reactions_fluxes.py](validation/quercus/quercus_reactions_fluxes.py) file.\r\n* Slight adjustments to the biomass reaction in the generated diel model can be found [here](validation/quercus/comparison/auxiliar_model_change.py).\r\n* Validation of the metabolites exchange reactions through simulation using pFBA where performed in [simulation_sp_multi_quercus.py](validation/quercus/simulation_sp/simulation_sp_multi_quercus.py) file.\r\n* The comparison between the flux of the biomass reaction for both diel multi-tissue models are in the [quercus_diel_models_comparison.py](validation/quercus/comparison/quercus_multi_tissue_diel_models_comparison.py) file.\r\n\r\n### QY for the several models:\r\n\r\n* The scripts for quantum yield and assimilation quotient calculation for the _Zea mays L._ (2011), _Arabidopsis thaliana_ (2010), _Populus trichocarpa_ (2020), _Solanum lycopersicum_ (2015), _Solanum lycopersicum_ (2022) and _Solanum tuberosum_ (2018) models can be found in the [QY](validation/QY) folder.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "DielModels:",
"version": "1.1.0",
"project_urls": null,
"split_keywords": [
"plants",
" diel models"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2629c296fa2a16201ef22028c81091e648499d2630486df2a148a5ded52d419f",
"md5": "3e5ac8eaa5d10bd2d83643b523c41de9",
"sha256": "1503775b63dfdfe35f589156aadfd24575d7a574932c1b6b3f96c9d172831d20"
},
"downloads": -1,
"filename": "DielModels-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3e5ac8eaa5d10bd2d83643b523c41de9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 12289,
"upload_time": "2024-07-04T13:41:35",
"upload_time_iso_8601": "2024-07-04T13:41:35.044236Z",
"url": "https://files.pythonhosted.org/packages/26/29/c296fa2a16201ef22028c81091e648499d2630486df2a148a5ded52d419f/DielModels-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c3de86ab70024ed2db0dd31f308ce3e7fac9c1f3e1fb5a97570ac1700185925d",
"md5": "6a2f3ea195badf8a36ae357b1890058e",
"sha256": "aa8bf79fd5a8113d2d3ae239b88373fcd75ffcf447d0e44c262c7550596fc819"
},
"downloads": -1,
"filename": "dielmodels-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "6a2f3ea195badf8a36ae357b1890058e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 9637,
"upload_time": "2024-07-04T13:41:36",
"upload_time_iso_8601": "2024-07-04T13:41:36.913147Z",
"url": "https://files.pythonhosted.org/packages/c3/de/86ab70024ed2db0dd31f308ce3e7fac9c1f3e1fb5a97570ac1700185925d/dielmodels-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-04 13:41:36",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "dielmodels"
}