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

Commit

Permalink
fix: completed instance schema for working examples
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Feb 28, 2024
1 parent 2dd6907 commit 277130a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 38 deletions.
13 changes: 11 additions & 2 deletions biosimulator_processes/processes/copasi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ def __init__(self, config=None, core=None):
if isinstance(model_parameters, DataFrame):
self.model_parameters_list = model_parameters.index.tolist()
self.model_parameter_values = model_parameters['initial_value'].tolist()
else:
self.model_parameters_list = []
self.model_parameter_values = []

# Get a list of reactions
self.reaction_list = get_reactions(model=self.copasi_model_object).index.tolist()
Expand Down Expand Up @@ -189,11 +192,17 @@ def inputs(self):
'_apply': 'set',
} for species_id in self.floating_species_list
}
if self.model_parameters_list:
model_params_type = {
param_id: 'float' for param_id in self.model_parameters_list
}
else:
model_params_type = {}

return {
'time': 'float',
'floating_species': floating_species_type,
'model_parameters': {
param_id: 'float' for param_id in self.model_parameters_list},
'model_parameters': model_params_type,
'reactions': {
reaction_id: 'float' for reaction_id in self.reaction_list},
}
Expand Down
45 changes: 9 additions & 36 deletions notebooks/copasi_process_composer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,12 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "c6c10dc5988e52d4",
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-02-28T20:57:05.779779Z",
"start_time": "2024-02-28T20:57:03.764811Z"
}
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"CobraProcess registered successfully.\n",
"CopasiProcess registered successfully.\n",
"SmoldynProcess registered successfully.\n",
"TelluriumProcess registered successfully.\n"
]
}
],
"outputs": [],
"source": [
"import os \n",
"from basico import *\n",
Expand Down Expand Up @@ -130,7 +115,7 @@
"outputs": [],
"source": [
"root = os.path.abspath('..')\n",
"model_path = os.path.join(root, 'biosimulator_processes/model_files/Caravagna2010.xml')\n",
"model_path = os.path.join(root, 'biosimulator_processes/model_files/BIOMD0000000061_url.xml')\n",
"\n",
"instance = {\n",
" 'copasi': {\n",
Expand Down Expand Up @@ -273,28 +258,15 @@
},
{
"cell_type": "code",
"outputs": [
{
"data": {
"text/plain": "'The following types have been derived from both SEDML L1v4 and basico itself.\\n\\n BASICO_MODEL_CHANGES_TYPE = {\\n \\'species_changes\\': { # <-- this is done like set_species(\\'B\\', kwarg=) where the inner most keys are the kwargs\\n \\'species_name\\': {\\n \\'unit\\': \\'maybe[string]\\',\\n \\'initial_concentration\\': \\'maybe[float]\\',\\n \\'initial_particle_number\\': \\'maybe[float]\\',\\n \\'initial_expression\\': \\'maybe[string]\\',\\n \\'expression\\': \\'maybe[string]\\'\\n }\\n },\\n \\'global_parameter_changes\\': { # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs\\n \\'global_parameter_name\\': {\\n \\'initial_value\\': \\'maybe[float]\\',\\n \\'initial_expression\\': \\'maybe[string]\\',\\n \\'expression\\': \\'maybe[string]\\',\\n \\'status\\': \\'maybe[string]\\',\\n \\'type\\': \\'maybe[string]\\' # (ie: fixed, assignment, reactions)\\n }\\n },\\n \\'reaction_changes\\': {\\n \\'reaction_name\\': {\\n \\'parameters\\': {\\n \\'reaction_parameter_name\\': \\'maybe[int]\\' # (new reaction_parameter_name value) <-- this is done with set_reaction_parameters(name=\"(REACTION_NAME).REACTION_NAME_PARAM\", value=VALUE)\\n },\\n \\'reaction_scheme\\': \\'maybe[string]\\' # <-- this is done like set_reaction(name = \\'R1\\', scheme = \\'S + E + F = ES\\')\\n }\\n }\\n }\\n'"
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"CHANGES_SCHEMA"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-02-28T20:57:27.860061Z",
"start_time": "2024-02-28T20:57:27.857520Z"
}
"collapsed": false
},
"id": "433d58bbe38402af",
"execution_count": 2
"execution_count": null
},
{
"cell_type": "code",
Expand Down Expand Up @@ -343,7 +315,8 @@
"metadata": {
"collapsed": false
},
"id": "8178d3c295764eb6"
"id": "8178d3c295764eb6",
"execution_count": null
},
{
"cell_type": "code",
Expand Down

0 comments on commit 277130a

Please sign in to comment.