diff --git a/biosimulator_processes/data_model.py b/biosimulator_processes/data_model.py index 549221515..2d784290b 100644 --- a/biosimulator_processes/data_model.py +++ b/biosimulator_processes/data_model.py @@ -35,7 +35,7 @@ class BaseModel(Base): class SpeciesChanges(BaseModel): # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs species_name: str unit: Union[str, NoneType] = Field(default=None) - initial_concentration: Union[float, NoneType] = Field(default=None) + initial_concentration: float = None initial_particle_number: Union[float, NoneType] = Field(default=None) initial_expression: Union[str, NoneType] = Field(default=None) expression: Union[str, NoneType] = Field(default=None) @@ -62,7 +62,7 @@ class ReactionChanges(BaseModel): class ModelChanges(BaseModel): - species_changes: Union[NoneType, List[SpeciesChanges]] = Field(default=None) + species_changes: Union[SpeciesChanges, List[SpeciesChanges]] = Field(default=[]) global_parameter_changes: Union[NoneType, List[GlobalParameterChanges]] = Field(default=None) reaction_changes: Union[NoneType, List[ReactionChanges]] = Field(default=None) @@ -102,23 +102,25 @@ class Model(BaseModel): model_changes: `biosimulator_processes.data_model.ModelChanges` """ model_id: str = Field(default='') - model_source: str # <-- SED type validated by constructor + model_source: Union[str, ModelFilepath, BiomodelId] # <-- SED type validated by constructor model_language: str = Field(default='sbml') model_name: str = Field(default='Unnamed Composite Process Model') model_changes: ModelChanges - @classmethod @field_validator('model_source') - def set_value(cls): + @classmethod + def set_value(cls, v: str): """Verify that the model source is set to only either a path or a biomodels id""" # if '/' in cls.model_source: # return ModelFilepath(value=cls.model_source) # elif 'BIO' in cls.input_source: # return BiomodelId(value=cls.model_source) - if '/' not in cls.model_source or 'BIO' not in cls.model_source: - raise AttributeError('You must pass either a model filepath or valid biomodel id.') + if '/' in v: + return ModelFilepath(value=v) + elif 'BIO' in v: + return BiomodelId(value=v) else: - return cls.model_source + raise AttributeError('You must pass either a model filepath or valid biomodel id.') class ProcessConfigSchema(BaseModel): @@ -129,6 +131,11 @@ class CopasiProcessConfigSchema(BaseModel): method: str = Field(default='deterministic') model: Union[Model, Dict] + def __init__(self, **data): + super().__init__(**data) + if isinstance(self.model, Model): + self.model = self.model.model_dump() + @classmethod @field_serializer('model') def serialize_model(cls): diff --git a/biosimulator_processes/processes/copasi_process.py b/biosimulator_processes/processes/copasi_process.py index 1f2bd1b12..2cc80f157 100644 --- a/biosimulator_processes/processes/copasi_process.py +++ b/biosimulator_processes/processes/copasi_process.py @@ -33,7 +33,7 @@ ) from process_bigraph import Process, Composite, pf from biosimulator_processes.utils import fetch_biomodel -from biosimulator_processes.process_types import MODEL_TYPE +from biosimulator_processes.data_model import Model import biosimulator_processes.processes @@ -110,7 +110,7 @@ class CopasiProcess(Process): """ config_schema = { - 'model': MODEL_TYPE, + 'model': Model, 'method': { '_type': 'string', '_default': 'deterministic' diff --git a/notebooks/builder_composer.ipynb b/notebooks/builder_composer.ipynb index b82c9e5e6..5d537efd1 100644 --- a/notebooks/builder_composer.ipynb +++ b/notebooks/builder_composer.ipynb @@ -5,7 +5,7 @@ "id": "808b6a4b-0894-4a8e-99d8-bf11b3164b6a", "metadata": {}, "source": [ - "# Bigraph-Builder Demo" + "## Examples with ```CopasiProcess``` using ``builder.Builder`` and ``biosimulator_processes.data_model``" ] }, { @@ -26,250 +26,155 @@ "id": "a403d619-4dbe-49cc-8f24-29a83e31fe15", "metadata": {}, "source": [ - "## Initialize the builder" + "#### Initialize a fresh instance of the `BiosimulatorBuilder`, which is inherently configured by `biosimulator_processes.CORE`." ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "b6260555-2bad-4834-adc5-e6d358063579", - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2024-03-01T18:45:09.801100Z", + "start_time": "2024-03-01T18:45:09.797541Z" + } + }, "outputs": [], "source": [ "b = BiosimulatorBuilder()" ] }, - { - "cell_type": "markdown", - "id": "dd85f98e-c5e3-467b-97ab-1ced7e810a17", - "metadata": {}, - "source": [ - "### register new types" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "30297af1-2d65-43d9-9ab7-0589d94a8cfe", - "metadata": {}, - "outputs": [], - "source": [ - "b.register_type(\n", - " 'default 1', {\n", - " '_inherit': 'float',\n", - " '_default': 1.0})" - ] - }, - { - "cell_type": "markdown", - "id": "4f7cb796-ae5f-4209-b81c-dec1544f0840", - "metadata": {}, - "source": [ - "## Register processes" - ] - }, - { - "cell_type": "markdown", - "id": "603e75fd-7b86-4e4c-9e95-adb9faf9668b", - "metadata": {}, - "source": [ - "### list built-in processes" - ] - }, { "cell_type": "code", - "execution_count": null, - "id": "979e0bd85a31d4b0", + "execution_count": 3, + "id": "40cde984-cfdf-4571-af9c-3a3755e3763c", "metadata": { - "collapsed": false + "ExecuteTime": { + "end_time": "2024-03-01T18:45:10.172978Z", + "start_time": "2024-03-01T18:45:10.169400Z" + } }, - "outputs": [], - "source": [ + "outputs": [ + { + "data": { + "text/plain": "['ram-emitter',\n 'CopasiProcess',\n 'SmoldynProcess',\n 'console-emitter',\n 'CobraProcess',\n 'TelluriumProcess']" + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "###### list registered processes\n", + "\n", "b.list_processes()" ] }, - { - "cell_type": "markdown", - "id": "9710444c-97c5-484c-83b0-8d82c3fdb92f", - "metadata": {}, - "source": [ - "### register process with process class" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5bff2ea4-42f9-430e-b1cc-f0581510ec8d", - "metadata": {}, - "outputs": [], - "source": [ - "from process_bigraph.experiments.minimal_gillespie import GillespieEvent\n", - "b.register_process('GillespieEvent', GillespieEvent)" - ] - }, - { - "cell_type": "markdown", - "id": "c3635047-66dd-4c80-85ea-481c74da2a86", - "metadata": {}, - "source": [ - "### register process by address\n", - "currently only supports local addresses, but the plan is to support remote addresses and different protocols" - ] - }, { "cell_type": "code", - "execution_count": null, - "id": "f2893d4a-c13a-4d95-b85e-d5e9dce53a89", - "metadata": {}, "outputs": [], "source": [ - "b.register_process(\n", - " 'GillespieInterval',\n", - " address='process_bigraph.experiments.minimal_gillespie.GillespieInterval', \n", - ")" - ] - }, - { - "cell_type": "markdown", - "id": "731974c5-b470-4ddf-a037-4d4aeebc7b42", - "metadata": {}, - "source": [ - "### register with decorator" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "aec69dcc-471e-4c18-b22b-824cfe440e79", - "metadata": {}, - "outputs": [], - "source": [ - "@b.register_process('toy')\n", - "class Toy(Process):\n", - " config_schema = {\n", - " 'A': 'float',\n", - " 'B': 'float'}\n", - "\n", - " def __init__(self, config, core):\n", - " super().__init__(config, core)\n", + "from basico import *\n", + "from basico import biomodels\n", "\n", - " def schema(self):\n", - " return {\n", - " 'inputs': {\n", - " 'A': 'float',\n", - " 'B': 'float'},\n", - " 'outputs': {\n", - " 'C': 'float'}}\n", "\n", - " def update(self, state, interval):\n", - " update = {'C': state['A'] + state['B']}\n", - " return update\n" - ] - }, - { - "cell_type": "markdown", - "id": "a108cbf0-a594-41d4-996a-de9bf9b6aeea", - "metadata": {}, - "source": [ - "### list registered processes" - ] + "model = load_biomodel('BIOMD0000000861')" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-01T18:45:12.715567Z", + "start_time": "2024-03-01T18:45:10.608193Z" + } + }, + "id": "9279a6fec5ad0c48", + "execution_count": 4 }, { "cell_type": "code", - "execution_count": null, - "id": "40cde984-cfdf-4571-af9c-3a3755e3763c", - "metadata": {}, - "outputs": [], - "source": [ - "b.list_processes()" - ] + "outputs": [ + { + "data": { + "text/plain": " compartment type unit initial_concentration \\\nname \nEpoRJAK2 cyt reactions nmol/l 3.976220e+00 \nEpoRpJAK2 cyt reactions nmol/l 0.000000e+00 \np1EpoRpJAK2 cyt reactions nmol/l 0.000000e+00 \np2EpoRpJAK2 cyt reactions nmol/l 0.000000e+00 \np12EpoRpJAK2 cyt reactions nmol/l 0.000000e+00 \nEpoRJAK2_CIS cyt reactions nmol/l 0.000000e+00 \nSHP1 cyt reactions nmol/l 2.672510e+01 \nSHP1Act cyt reactions nmol/l 0.000000e+00 \nSTAT5 cyt reactions nmol/l 7.975350e+01 \npSTAT5 cyt reactions nmol/l 0.000000e+00 \nnpSTAT5 nuc reactions nmol/l 0.000000e+00 \nCISnRNA1 nuc reactions nmol/l 0.000000e+00 \nCISnRNA2 nuc reactions nmol/l 0.000000e+00 \nCISnRNA3 nuc reactions nmol/l 0.000000e+00 \nCISnRNA4 nuc reactions nmol/l 0.000000e+00 \nCISnRNA5 nuc reactions nmol/l 0.000000e+00 \nCISRNA cyt reactions nmol/l 0.000000e+00 \nCIS cyt reactions nmol/l 0.000000e+00 \nSOCS3nRNA1 nuc reactions nmol/l 0.000000e+00 \nSOCS3nRNA2 nuc reactions nmol/l 0.000000e+00 \nSOCS3nRNA3 nuc reactions nmol/l 0.000000e+00 \nSOCS3nRNA4 nuc reactions nmol/l 0.000000e+00 \nSOCS3nRNA5 nuc reactions nmol/l 0.000000e+00 \nSOCS3RNA cyt reactions nmol/l 0.000000e+00 \nSOCS3 cyt reactions nmol/l 0.000000e+00 \nEpo cyt reactions nmol/l 1.249970e-07 \n\n initial_particle_number initial_expression expression \\\nname \nEpoRJAK2 9.578143e+14 \nEpoRpJAK2 0.000000e+00 \np1EpoRpJAK2 0.000000e+00 \np2EpoRpJAK2 0.000000e+00 \np12EpoRpJAK2 0.000000e+00 \nEpoRJAK2_CIS 0.000000e+00 \nSHP1 6.437693e+15 \nSHP1Act 0.000000e+00 \nSTAT5 1.921147e+16 \npSTAT5 0.000000e+00 \nnpSTAT5 0.000000e+00 \nCISnRNA1 0.000000e+00 \nCISnRNA2 0.000000e+00 \nCISnRNA3 0.000000e+00 \nCISnRNA4 0.000000e+00 \nCISnRNA5 0.000000e+00 \nCISRNA 0.000000e+00 \nCIS 0.000000e+00 \nSOCS3nRNA1 0.000000e+00 \nSOCS3nRNA2 0.000000e+00 \nSOCS3nRNA3 0.000000e+00 \nSOCS3nRNA4 0.000000e+00 \nSOCS3nRNA5 0.000000e+00 \nSOCS3RNA 0.000000e+00 \nSOCS3 0.000000e+00 \nEpo 3.010998e+07 \n\n concentration particle_number rate particle_number_rate \\\nname \nEpoRJAK2 3.976220e+00 9.578143e+14 -0.314737 -7.581552e+13 \nEpoRpJAK2 0.000000e+00 0.000000e+00 0.314737 7.581552e+13 \np1EpoRpJAK2 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \np2EpoRpJAK2 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \np12EpoRpJAK2 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nEpoRJAK2_CIS 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSHP1 2.672510e+01 6.437693e+15 0.000000 0.000000e+00 \nSHP1Act 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSTAT5 7.975350e+01 1.921147e+16 0.000000 0.000000e+00 \npSTAT5 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nnpSTAT5 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCISnRNA1 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCISnRNA2 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCISnRNA3 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCISnRNA4 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCISnRNA5 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCISRNA 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nCIS 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3nRNA1 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3nRNA2 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3nRNA3 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3nRNA4 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3nRNA5 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3RNA 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nSOCS3 0.000000e+00 0.000000e+00 0.000000 0.000000e+00 \nEpo 1.249970e-07 3.010998e+07 0.000000 0.000000e+00 \n\n key sbml_id \nname \nEpoRJAK2 Metabolite_0 EpoRJAK2 \nEpoRpJAK2 Metabolite_1 EpoRpJAK2 \np1EpoRpJAK2 Metabolite_2 p1EpoRpJAK2 \np2EpoRpJAK2 Metabolite_3 p2EpoRpJAK2 \np12EpoRpJAK2 Metabolite_4 p12EpoRpJAK2 \nEpoRJAK2_CIS Metabolite_5 EpoRJAK2_CIS \nSHP1 Metabolite_6 SHP1 \nSHP1Act Metabolite_7 SHP1Act \nSTAT5 Metabolite_8 STAT5 \npSTAT5 Metabolite_9 pSTAT5 \nnpSTAT5 Metabolite_10 npSTAT5 \nCISnRNA1 Metabolite_11 CISnRNA1 \nCISnRNA2 Metabolite_12 CISnRNA2 \nCISnRNA3 Metabolite_13 CISnRNA3 \nCISnRNA4 Metabolite_14 CISnRNA4 \nCISnRNA5 Metabolite_15 CISnRNA5 \nCISRNA Metabolite_16 CISRNA \nCIS Metabolite_17 CIS \nSOCS3nRNA1 Metabolite_18 SOCS3nRNA1 \nSOCS3nRNA2 Metabolite_19 SOCS3nRNA2 \nSOCS3nRNA3 Metabolite_20 SOCS3nRNA3 \nSOCS3nRNA4 Metabolite_21 SOCS3nRNA4 \nSOCS3nRNA5 Metabolite_22 SOCS3nRNA5 \nSOCS3RNA Metabolite_23 SOCS3RNA \nSOCS3 Metabolite_24 SOCS3 \nEpo Metabolite_25 Epo ", + "text/html": "
\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
compartmenttypeunitinitial_concentrationinitial_particle_numberinitial_expressionexpressionconcentrationparticle_numberrateparticle_number_ratekeysbml_id
name
EpoRJAK2cytreactionsnmol/l3.976220e+009.578143e+143.976220e+009.578143e+14-0.314737-7.581552e+13Metabolite_0EpoRJAK2
EpoRpJAK2cytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.3147377.581552e+13Metabolite_1EpoRpJAK2
p1EpoRpJAK2cytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_2p1EpoRpJAK2
p2EpoRpJAK2cytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_3p2EpoRpJAK2
p12EpoRpJAK2cytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_4p12EpoRpJAK2
EpoRJAK2_CIScytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_5EpoRJAK2_CIS
SHP1cytreactionsnmol/l2.672510e+016.437693e+152.672510e+016.437693e+150.0000000.000000e+00Metabolite_6SHP1
SHP1Actcytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_7SHP1Act
STAT5cytreactionsnmol/l7.975350e+011.921147e+167.975350e+011.921147e+160.0000000.000000e+00Metabolite_8STAT5
pSTAT5cytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_9pSTAT5
npSTAT5nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_10npSTAT5
CISnRNA1nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_11CISnRNA1
CISnRNA2nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_12CISnRNA2
CISnRNA3nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_13CISnRNA3
CISnRNA4nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_14CISnRNA4
CISnRNA5nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_15CISnRNA5
CISRNAcytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_16CISRNA
CIScytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_17CIS
SOCS3nRNA1nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_18SOCS3nRNA1
SOCS3nRNA2nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_19SOCS3nRNA2
SOCS3nRNA3nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_20SOCS3nRNA3
SOCS3nRNA4nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_21SOCS3nRNA4
SOCS3nRNA5nucreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_22SOCS3nRNA5
SOCS3RNAcytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_23SOCS3RNA
SOCS3cytreactionsnmol/l0.000000e+000.000000e+000.000000e+000.000000e+000.0000000.000000e+00Metabolite_24SOCS3
Epocytreactionsnmol/l1.249970e-073.010998e+071.249970e-073.010998e+070.0000000.000000e+00Metabolite_25Epo
\n
" + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "get_species(model=model)" + ], + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-01T18:45:12.736247Z", + "start_time": "2024-03-01T18:45:12.717370Z" + } + }, + "id": "da6096ec3e0daa85", + "execution_count": 5 }, { "cell_type": "markdown", "id": "dfa2d764-8cdb-4a1e-84c5-fd81cc4e6afe", "metadata": {}, "source": [ - "## Add processes to the bigraph" - ] - }, - { - "cell_type": "markdown", - "id": "49cca341-3f7d-4ac8-be5a-6a7e9f6c4872", - "metadata": {}, - "source": [ - "### add event_process" + "#### Example 1: Add a simple `CopasiProcess`-based composite to the bigraph, specifying parameter values through the `data_model`. For now, let's try loading a biomodel and adding a change to initial concentration of a species" ] }, { "cell_type": "code", - "execution_count": null, - "id": "a153fd48f8c69115", - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "from biosimulator_processes.process_types import MODEL_TYPE\n", + "outputs": [ + { + "data": { + "text/plain": "{'species_changes': {'species_name': 'SHP1',\n 'unit': None,\n 'initial_concentration': 5.0,\n 'initial_particle_number': None,\n 'initial_expression': None,\n 'expression': None},\n 'global_parameter_changes': None,\n 'reaction_changes': None}" + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "process_model_changes = ModelChanges(\n", + " species_changes=SpeciesChanges(\n", + " species_name='SHP1',\n", + " initial_concentration=5.00000\n", + " )\n", + ")\n", "\n", - "MODEL_TYPE" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b79dc6639a17e353", + "process_model_changes.model_dump()" + ], "metadata": { - "collapsed": false + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-03-01T18:46:50.284003Z", + "start_time": "2024-03-01T18:46:50.279111Z" + } }, - "outputs": [], - "source": [ - "\n", - " " - ] + "id": "2b1c1bdd6864a771", + "execution_count": 13 }, { "cell_type": "code", "execution_count": null, - "id": "64f1c09a938354e2", + "id": "b79dc6639a17e353", "metadata": { "collapsed": false }, "outputs": [], "source": [ - "species_changes = ModelChange(config={\n", - " 'A': {\n", - " 'initial_expression': 'A -> B'\n", - " }\n", - "})\n", - "\n", - "global_params_changes = ModelChange(config={\n", - " 'Bol': {\n", - " 'unit': 'ml'\n", - " }\n", - "})\n", - "\n", - "model_changes = ModelChanges(species_changes=species_changes, global_parameter_changes=global_params_changes)\n", - "\n", + "process_model = Model(\n", + " model_id='simple_copasi_process',\n", + " model_source='BIOMD0000000861',\n", + " model_name='Simple Composite Process',\n", + " model_changes=\n", + ")\n", "\n", - "model = SedModel(\n", - " model_id='BIO232423',\n", - " model_source='uri:2424',\n", - " model_language='sbml',\n", - " model_name='Glyc',\n", - " model_changes=model_changes\n", - ")\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dd7bc7acafe252fd", - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "model.model_dump()" + "process_config = CopasiProcessConfigSchema(\n", + " \n", + ")" ] }, { @@ -279,7 +184,7 @@ "metadata": {}, "outputs": [], "source": [ - "copasi_config = \n", + "\n", "b['copasi_A'].add_process(\n", " name='CopasiProcess',\n", " kdeg=1.0, # kwargs fill parameters in the config\n", @@ -573,6 +478,25 @@ "collapsed": false }, "id": "2f464e6189bc8287" + }, + { + "cell_type": "markdown", + "source": [ + "### Example 2: Parameter scan composite" + ], + "metadata": { + "collapsed": false + }, + "id": "69529e31211443e0" + }, + { + "cell_type": "code", + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "c3b55f3424ef4a16" } ], "metadata": {