pyenzyme.thinlayers.TL_Copasi module#
This module contains the COPASI ThinLayer:
To use it, simply instantiate it using an EnzymeML Document. This will estimate all parameters of the enzyme ml document (all temporary data will be stored in working_dir).
>>> tl = ThinLayerCopasi(path='Model4.omex', outdir='./working_dir') >>> tl.optimize()This would return a pandas dataframe with the fit found, to write it into a new document you’d use:
>>> new_doc = tl.write()
In order to change the settings of the parameter estimation, or to change the loaded model we recommend to use basico. so after initializing the thinlayer, you’d load the model into basico. For example here is how you’d switch the method to particle swarm:
>>> from basico import *
>>> tl = ThinLayerCopasi(path='Model4.omex', outdir='./working_dir')
>>> set_current_model(tl.dm)
>>> set_task_settings(T.PARAMETER_ESTIMATION,
... {
... 'method': {'name': PE.PARTICLE_SWARM }
... })
If the modle is loaded into basico, you can easily plot the results as well. The COPASI file (.cps) in the working directory can also be directly used from the COPASI Graphical User Interface.
- class pyenzyme.thinlayers.TL_Copasi.ThinLayerCopasi(path, outdir, measurement_ids: Union[str, list] = 'all', init_file: Optional[str] = None)[source]#
Bases:
BaseThinLayer
- get_fit_parameters()[source]#
Returns all fit items specified as a list of dictionaries of the form
[ { ‘name’: ‘km’, ‘start’: 0.1, ‘lower’: 1e-6, ‘upper’: 1e6, ‘reaction_id’: ‘r1’ } … ]
- Returns
list of dictionaries with fit items
- Return type
[{}]
- optimize(update_model=False)[source]#
Carries out the Parameter estimation
- Parameters
update_model – optional argument, indicating whether to update the model, so another optimization run would start with the solution found from the first run.
- Returns
Pandas DataFrame with the results