Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
adjusted timecourse dec
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Feb 28, 2024
1 parent eb3b593 commit 7860754
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
41 changes: 34 additions & 7 deletions biosimulator_processes/processes/copasi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,43 @@ class CopasiProcess(Process):
B. 'method', changes the algorithm(s) used to solve the model
COPASI support many different simulations methods:
deterministic: using the COPASI LSODA implementation
stochastic: using the Gibson Bruck algorithm
directMethod: using the Gillespie direct method
C. 'units', (tree): quantity, volume, time, area, length
Justification:
As per SEDML v4 specifications (section2.2.4), p.32:sed-ml-L1V4.
MODEL_TYPE = {
'model_id': 'string', # could be used as the BioModels id
'model_source': 'string', # could be used as the "model_file" below (SEDML l1V4 uses URIs); what if it was 'model_source': 'sbml:model_filepath' ?
'model_language': { # could be used to load a different model language supported by COPASI/basico
'_type': 'string',
'_default': 'sbml' # perhaps concatenate this with 'model_source'.value? I.E: 'model_source': 'MODEL_LANGUAGE:MODEL_FILEPATH' <-- this would facilitate verifying correct model fp types.
},
'model_name': {
'_type': 'string',
'_default': 'composite_process_model'
},
'model_changes': {
'species_changes': 'tree[string]', # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs
'global_parameter_changes': 'tree[string]', # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs
'reaction_changes': 'tree[string]'
}
}
"""

config_schema = {
'model': {
'_type': MODEL_TYPE,
'_default': {}
},
'model': MODEL_TYPE,
'biomodel_id': 'maybe[string]', # <-- implies the lack of either model_file or model_reactions
'units': 'maybe[tree[string]]',
'method': {
'_type': 'string',
'_default': 'lsoda'
'_default': 'deterministic'
}
}

Expand Down Expand Up @@ -201,11 +221,18 @@ def update(self, inputs, interval):
'update_model': True,
# 'intervals': 1,
'model': self.copasi_model_object}
if self.method:

if self.method is not None:
timecourse_args['method'] = self.method

# run the time course with given kwargs
timecourse = run_time_course(**timecourse_args)
# timecourse = run_time_course(**timecourse_args)
timecourse = run_time_course(
start_time=inputs['time'],
duration=interval,
update_model=True,
model=self.copasi_model_object
)

# extract end values of concentrations from the model and set them in results
results = {'time': interval}
Expand Down
12 changes: 12 additions & 0 deletions notebooks/copasi_process_composer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@
"##### 3. Run the Composite workflow with the Engine"
]
},
{
"cell_type": "code",
"outputs": [],
"source": [
"workflow.config_schema"
],
"metadata": {
"collapsed": false
},
"id": "9d5477c224adfa39",
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit 7860754

Please sign in to comment.