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

Commit

Permalink
updated markdown in copasi process for entrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Feb 28, 2024
1 parent 905387a commit 3fa0355
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 12 deletions.
24 changes: 12 additions & 12 deletions biosimulator_processes/processes/copasi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,13 @@
run_time_course,
get_compartments,
new_model,
add_reaction,
model_info,
load_model_from_string,
biomodels
add_reaction
)
from process_bigraph import Process, Composite, pf
from biosimulator_processes.utils import fetch_biomodel


# define config schema type decs here

# The following types have been derived from both SEDML L1v4 and basico itself.

MODEL_CHANGES_TYPE = {
'model_changes': {
Expand Down Expand Up @@ -53,16 +49,20 @@
}
}

MODEL_TYPE = { # <-- sourced from SEDML L1v4

MODEL_TYPE = {
'model_id': 'maybe[string]', # could be used as the BioModels id
'model_source': 'maybe[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': 'maybe[string]',
'model_name': {
'_type': 'string',
'_default': 'composite_process_model'
},
'model_changes': {
'_type': 'maybe[tree[string]]',
'_type': 'tree[string]',
'_default': MODEL_CHANGES_TYPE
}
}
Expand Down Expand Up @@ -149,10 +149,10 @@ def __init__(self, config=None, core=None):

# A. enter with model_file
if model_file:
self.copasi_model_object = load_model(self.config['model_file'])
self.copasi_model_object = load_model(model_file)
# B. enter with specific search term for a model
elif biomodel_id:
self.copasi_model_object = fetch_biomodel(model_id=self.config['biomodel_id'])
elif source_model_id:
self.copasi_model_object = fetch_biomodel(model_id=source_model_id)
# C. enter with a new model
else:
self.copasi_model_object = new_model(name='CopasiProcess Model')
Expand Down
46 changes: 46 additions & 0 deletions notebooks/copasi_process_composer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,52 @@
"##### 1. Define the schema by which our Composite instance will be configured. Here a user chooses an entrypoint through which to instantiate the composite process. We will use an SBML-encoded model file as our entrypoint in this example."
]
},
{
"cell_type": "markdown",
"source": [
"\n",
"As per the `CopasiProcess` constructor, there are three primary methods of entry:\n",
" \n",
"\n",
" # Parse values from the process `config` attribute dictionary:\n",
" \n",
" model_file = self.config.get('model').get('model_source')\n",
" sed_model_id = self.config.get('model').get('model_id')\n",
" biomodel_id = self.config.get('biomodel_id')\n",
" source_model_id = biomodel_id or sed_model_id\n",
"\n",
"\n",
" # A. enter with model_file\n",
" \n",
" if model_file:\n",
" self.copasi_model_object = load_model(model_file)\n",
" \n",
"\n",
" # B. enter with specific search term for a model\n",
" \n",
" elif source_model_id:\n",
" self.copasi_model_object = fetch_biomodel(model_id=source_model_id)\n",
" \n",
"\n",
" # C. enter with a new model\n",
" \n",
" else:\n",
" self.copasi_model_object = new_model(name='CopasiProcess Model')"
],
"metadata": {
"collapsed": false
},
"id": "63a90540d44034e1"
},
{
"cell_type": "code",
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
},
"id": "f7c6d7411f54392c"
},
{
"cell_type": "code",
"execution_count": 3,
Expand Down

0 comments on commit 3fa0355

Please sign in to comment.