|
|
# Tools
|
|
|
*(/YCM/tools/)*
|
|
|
|
|
|
****
|
|
|
## Content
|
|
|
* [COPASI_fit](#copasi_fit)
|
|
|
* [COPASI_sim](#copasi_sim)
|
|
|
* [GenerateODEsFromReactions](#generateodesfromreactions)
|
|
|
* [GetSBMLReactions](#getsbmlreactions)
|
|
|
* [MergeModules](#mergemodules)
|
|
|
* [SBML_export](#sbml_export)
|
|
|
* [SBML_import](#sbml_import)
|
|
|
* [TestModule](#testmodule)
|
|
|
* [TotalOsmolarity](#totalosmolarity)
|
|
|
* [WriteCK](#writeck)
|
|
|
* [WriteCyto](#writecyto)
|
|
|
* [Write_dxdt](#write_dxdt)
|
|
|
* [WriteHTML](#writehtml)
|
|
|
* [WriteMD](#writemd)
|
|
|
* [WritePythonModule](#writepythonmodule)
|
|
|
* [YCM_Parameter](#ycm_parameter)
|
|
|
|
|
|
***
|
|
|
|
|
|
## COPASI_fit
|
|
|
**Parameter fitting for SBML file in COPASI.**
|
|
|
This tool reads a data file (*data.csv*) and a config file (*config.csv*) to perform a parameter estimation in [COPASI](http://copasi.org/) and estimates the parameter in the SBML model file. The script can be run from the terminal
|
|
|
#### ```python COPASI_fit.py sbml_file time_end```
|
|
|
* *sbml_file*: filepath of SBML model
|
|
|
* *time_end*: simulation runtime 0 -> *time_end*
|
|
|
|
|
|
> **ATTENTION: The data and config file have to be present in the working directory of the script!!**
|
|
|
|
|
|
## COPASI_sim
|
|
|
**Simulation of an SBML in COPASI.**
|
|
|
The tool simulates an SBML file in [COPASI](http://copasi.org/) and saves the time course data in an [SBtab](https://sbtab.net/) file (*.csv*). The script cannot be run from the terminal, import the script and run the
|
|
|
method
|
|
|
#### ```simulate(sbml_file, time_end)```
|
|
|
* *sbml_file*: filepath of SBML model
|
|
|
* *time_end*: simulation runtime 0 -> *time_end*
|
|
|
|
|
|
## GenerateODEsFromReactions
|
|
|
**Write ODE dict from reactions dict**
|
|
|
The script formulates ODEs from reaction information (rate, substrates, products, modifiers, stoichiometries). To work properly it also needs the unit of the species as well as annotations of the species and it's corresponding compartment. The script is called in almost all YCM modules and returns an ODE dictionary. It cannot be called from terminal, import the script and run the method
|
|
|
#### ```odes = generateODEsFromReactions(reaction_dict, sp_compartment, sp_annotations, units, com_annotations)```
|
|
|
* *reaction_dict*: dictionary of reactions (*{rate: **str**, substrates: {**str**: **int**}, products: {**str**: **int**}, modifiers: {**str**: **int**}}*
|
|
|
* *sp_compartment*: dictionary of species localisations
|
|
|
* *sp_annotations*: dictionary of species annoations
|
|
|
* *units*: dictionary of species units
|
|
|
* *com_annotations*: dictionary of compartment annotations
|
|
|
|
|
|
**This tool automatically adds conversion factors and volume correction terms.** Since every reaction rate in the YCM is defined as an amount flux (mmol/s), the rate has to be converted if the species (ODE) has another unit. When the **growth rate** species from the volume module is part of the species, the tool generates a volume correction term ***(V'/V * species)*** and adds it to the ODE of the particular species.
|
|
|
|
|
|
## GetSBMLReactions
|
|
|
**Read reactions dict from SBML file.**
|
|
|
This tool reads an SBML file and returns a reaction dictionary. It can be run from the terminal
|
|
|
#### ```python GetSBMLReactions.py sbml_file```
|
|
|
* *sbml_file*: filepath of SBML model
|
|
|
|
|
|
## MergeModules
|
|
|
**Combine modules (modeldicts) to one merged model (modeldict)**
|
|
|
The merging of modules is performed in this tool. It takes a list of modeldicts (contains all information of a module) and combines them. Common species are identified and merged automatically (with unit conversion). The species names are changed with a prefix of the containing module, common species have the prefix *merged*. The class object contains a ***merged_model*** attribute that contains the merged modeldict of the model.
|
|
|
The script has a test call in the main (*python MergeModules.py*). The standard call is in a Python session:
|
|
|
#### ```merged = YCM_merge(modules)```
|
|
|
* *modules*: list of modeldicts
|
|
|
|
|
|
[**Detailed documentation**](tools_merger)
|
|
|
|
|
|
## SBML_export
|
|
|
**SBML export of Python script module file.**
|
|
|
The tool reads an Python module file (from the */python_modules/* folder) and writes it to an SBML file (to the */SBML_modules/* folder). It can be called directly from terminal:
|
|
|
#### ```python SBML_export.py filepath```
|
|
|
* *filepath*: filepath to module Python script
|
|
|
|
|
|
## SBML_import
|
|
|
**SBML import to modeldict instance.**
|
|
|
Use this tool to read an SBML file and convert it to a modeldict. The modeldict is currently written into a *pickle* file written in the actual working directory. The script can be executed directly from terminal:
|
|
|
#### ```python SBML_import.py filepath```
|
|
|
* *filepath*: filepath to the SBML model
|
|
|
|
|
|
## TestModule
|
|
|
**Python module script validator.**
|
|
|
The tool validates a Python module script in several levels.
|
|
|
The first level checks the consistency of the modeldict itself, the presence all mandatory keys in the
|
|
|
modeldict. The second layer checks the presence of all mandatory information to define a YCM species in a modeldict: initial value, annotation, compartment, state, unit, ODE or algebraic equation. The next level tests the validity of the parameters in the modeldict, value, unit, presence in an equation. The last level tests the equations for bracket balance and whether the equation can be evaluated.
|
|
|
The script can be called from terminal:
|
|
|
#### ```python TestModule.py module_name```
|
|
|
* *model_name*: name of the module to test, no file ending!
|
|
|
|
|
|
## TotalOsmolarity
|
|
|
**Calculates the total osmolarity function for the cell.**
|
|
|
The total osmolarity is a mandatory property for the volume module. Since this property can only be calculated after the merging process and is only needed when the volume module is present, this tool is called seperately if needed. It sums up the concentrations of all species in the compartments **cytosol** and **intracellular** (intracellular = cytosol & nucleus). A unit conversion is implemented to consider also species in molecule numbers and amounts (mmol). If the mentioned compartments are not present, the tool returns ***600 mM***, which is the assumed osmolarity in the cell. Otherwise it return the string of the algebraic equation that describes the total osmolarity in the cell.
|
|
|
The tool has to be imported and takes the modeldict as an input:
|
|
|
#### ```osmo_equation = total_osmolarity_equation( modeldict )```
|
|
|
* *modeldict*: modeldict of the model```
|
|
|
|
|
|
## WriteCK
|
|
|
**Automatically generate convenience kinetic rate law.**
|
|
|
Since the formulation of convenience kinetic rate laws is error-prone when done manually, this tool returns the string of the rate law when provided with substrates and products with their particular stoichiometry. It can also generate and return a test dict with the necessary entries of all parameters that need to be added to the modeldict.
|
|
|
The tool has to be called from a Python session:
|
|
|
#### ```rate = write_convenience_kinetics( name, substrates, products )```
|
|
|
* *name*: name of the reaction
|
|
|
* *substrates*: dictionary with species name and stoichiometry {***str***: ***int***, ...}
|
|
|
* *products*: dictionary with species name and stoichiometry {***str***: ***int***, ...}
|
|
|
|
|
|
To get the dictionary call the other method in the script:
|
|
|
#### ```write_test_dict( name, substrates, products )```
|
|
|
* *name*: name of the reaction
|
|
|
* *substrates*: dictionary with species name and stoichiometry {***str***: ***int***, ...}
|
|
|
* *products*: dictionary with species name and stoichiometry {***str***: ***int***, ...}
|
|
|
|
|
|
## WriteCyto
|
|
|
**Generate [Cytoscape](http://www.cytoscape.org/) tables of a module to visualise the network of the reactions.**
|
|
|
The function in the script takes a *modeldict* and generates a **network file** and an **attribute file** of the module. The network file contains the network information of the module and can be imported in [Cytoscape](http://www.cytoscape.org/), the attribute file gives additional information for the nodes to visualise reactions and compounds differently. The attribute file needs to be imported separately in [Cytoscape](http://www.cytoscape.org/).
|
|
|
The script can be imported in Python
|
|
|
#### ```WriteCyto.export_cytoscape_tables(modeldict)```
|
|
|
* *modeldict*: modeldict of the model
|
|
|
|
|
|
The script can also called from terminal.
|
|
|
#### ```python WriteCyto module_name```
|
|
|
* *module_name*: name of the module to visualise
|
|
|
|
|
|
## Write_dxdt
|
|
|
**Write function to evaluate ODEs and algebraic equations.**
|
|
|
To accelerate the simulation of the YCM the ODEs can be written into a Python script as mathematical expression instead of evaluating all equations repeatedly. The script writes two files (ODE and algebraic equations) in the main folder of the YCM. Since the solvers ***ODE*** and ***ODEint*** use different input formats, the script can be provided with a solver name, default solver is *ODEint*. The filenames can be adjusted if so desired. The script cannot be called from terminal.
|
|
|
The class has 3 methods that need to be called successively:
|
|
|
#### ```writer = YCM_dxdt( modeldict, solver, filename )```
|
|
|
> initialise writer object
|
|
|
#### ```alg_species, alg_eqs, ode_species, ode_eqs = writer.get_equations()```
|
|
|
> get species names and equations for algebraic and ODE species
|
|
|
#### ```writer.write_function_f(alg_species, alg_eqs, ode_species, ode_eqs)```
|
|
|
> write temp file to evaluate ODEs
|
|
|
#### ```writer.write_function_alg(alg_species, alg_eqs)```
|
|
|
> write temp file to evaluate algebraic equations
|
|
|
|
|
|
* *modeldict*: modeldict of the model
|
|
|
* *solver*: name of the solver (default = *odeint*)
|
|
|
* *filename*: name of the temp files (default = *f*)
|
|
|
* default writes files *f.py* and *f_alg.py*
|
|
|
|
|
|
[**Detailed documentation**](tools_dxdt)
|
|
|
|
|
|
## WriteMD
|
|
|
**Write module as md file (YCM wiki page).**
|
|
|
This script can be used to write a modeldict into an Markdown file to add a module with all it's information to the Github Wiki. The script writes an *.md* file into the folder **/YCM/md_modules/**.
|
|
|
#### ```write_model_md(modeldict, filename)```
|
|
|
* *modeldict*: modeldict of the model
|
|
|
* *filename*: filename of the Mardown file (default value is the current module name)
|
|
|
The script can also be called from terminal, then it loads all modules and creates all Markdown files in the given folder.
|
|
|
#### ```python ./tools/WriteMD.py```
|
|
|
|
|
|
## WritePythonModule
|
|
|
**Write modeldict into Python file.**
|
|
|
A modeldict can be written into a Python file automatically. The script writes either the complete modeldict into a Python script file or it can write a test module file. When writing a test module file a list of species names can be provided which will then be set constant in the module file. Constant species are moved from substrates and/or products into the modifier dict which will prevent the generation of ODEs for the particular species. Also pre-defined ODEs will be set to zero. The script can be called from terminal to write a pickle moduledict into a new Python script:
|
|
|
#### ```python WritePythonModule.py filepath```
|
|
|
* *filepath*: filepath of a Python pickle file (*.p*)
|
|
|
|
|
|
The script can also be called in a Python session:
|
|
|
#### ```writePythonModule(modeldict, model_name, doc_txt)```
|
|
|
* *modeldict*: modeldict of the model
|
|
|
* *model_name*: name of the model file (default value is the current module name)
|
|
|
* *doc_txt*: info text for the model (default value is an emtpy string)
|
|
|
|
|
|
To write a test module with a list of constant species:
|
|
|
#### ```writePythonTestModule(modeldict, model_name, const_sp)```
|
|
|
* *modeldict*: modeldict of the model
|
|
|
* *model_name*: name of the model file (default value is the current module name)
|
|
|
* *const_sp*: list of species names to be set constant in the Python file
|
|
|
|
|
|
**ATTENTION**: The script will not write a call of ODEgenerator in the written module, instead the ODEs will be hard coded!
|
|
|
|
|
|
## YCM_Parameter
|
|
|
**Parameter estimator for the YCM.**
|
|
|
To parameterise a single module the YCM_Parameter script can be used. The module has several functions:
|
|
|
**1. Test module**
|
|
|
Run module with predefined time course of a particular subset of module species (*e.g.* interface species)
|
|
|
**2. Parameter sampling - estimation**
|
|
|
Compare time courses of module species with predefined time courses for parameter estimation. Sample parameters (Monte Carlo method) and identify best parameter sets (Least-square method).
|
|
|
|
|
|
[**Detailed documentation**](parameter_estimator) |
|
|
\ No newline at end of file |