diff --git a/biosimulator_processes/processes/copasi_process.py b/biosimulator_processes/processes/copasi_process.py index 2195805ab..da044fd1f 100644 --- a/biosimulator_processes/processes/copasi_process.py +++ b/biosimulator_processes/processes/copasi_process.py @@ -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': { @@ -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 } } @@ -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') diff --git a/notebooks/copasi_process_composer.ipynb b/notebooks/copasi_process_composer.ipynb index 59d5ed6d7..2dde59b7c 100644 --- a/notebooks/copasi_process_composer.ipynb +++ b/notebooks/copasi_process_composer.ipynb @@ -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,