diff --git a/biosimulator_processes/__init__.py b/biosimulator_processes/__init__.py index e69de29bb..aa2828a58 100644 --- a/biosimulator_processes/__init__.py +++ b/biosimulator_processes/__init__.py @@ -0,0 +1,27 @@ +from builder import ProcessTypes + + +# Define a list of processes to attempt to import and register +PROCESSES_TO_REGISTER = [ + ('cobra', 'cobra_process.CobraProcess'), + ('copasi', 'copasi_process.CopasiProcess'), + ('smoldyn', 'smoldyn_process.SmoldynProcess'), + ('tellurium', 'tellurium_process.TelluriumProcess'), +] + +CORE = ProcessTypes() + +for process_name, process_path in PROCESSES_TO_REGISTER: + module_name, class_name = process_path.rsplit('.', 1) + try: + # Dynamically import the module + process_module = __import__( + f'biosimulator_processes.processes.{module_name}', fromlist=[class_name]) + # Get the class from the module + process_class = getattr(process_module, class_name) + + # Register the process + CORE.process_registry.register(class_name, process_class) + print(f"{class_name} registered successfully.") + except ImportError as e: + print(f"{class_name} not available. Error: {e}") diff --git a/biosimulator_processes/biosimulator_builder.py b/biosimulator_processes/biosimulator_builder.py new file mode 100644 index 000000000..682d52d1d --- /dev/null +++ b/biosimulator_processes/biosimulator_builder.py @@ -0,0 +1,9 @@ +from typing import * +from builder import Builder +from biosimulator_processes import CORE + + +class BiosimulatorBuilder(Builder): + def __init__(self, schema: Dict, tree: Dict, filepath: str): + super().__init__(schema=schema, tree=tree, file_path=filepath, core=CORE) + diff --git a/biosimulator_processes/process_types.py b/biosimulator_processes/process_types.py index 55f5a085a..c56bb17c7 100644 --- a/biosimulator_processes/process_types.py +++ b/biosimulator_processes/process_types.py @@ -1,3 +1,77 @@ +from pydantic import BaseModel +from typing import * +from abc import ABC, abstractmethod + + +class ModelChange(BaseModel): + config: Union[Dict[str, Dict[str, Dict[str, Union[float, str]]]], Dict[str, Dict[str, Union[Dict[str, float], str]]]] + + +class ModelChanges(BaseModel): + species_changes: ModelChange = None + global_parameter_changes: ModelChange = None + reaction_changes: ModelChange = None + + +class ModelSource(ABC): + value: str + + def __init__(self): + super().__init__() + + @abstractmethod + def check_value(self): + pass + + +class BiomodelId(ModelSource, BaseModel): + value: str + + def __init__(self): + super().__init__() + self.check_value() + + def check_value(self): + assert '/' not in self.value + + +class ModelFilepath(BaseModel): + value: str + + def __init__(self): + super().__init__() + self.check_value() + + def check_value(self): + assert '/' in self.value + + +class SedModel(BaseModel): + model_id: Optional[str] = None + model_source: str + model_language: str = 'sbml' + model_name: str = 'composite_process_model' + model_changes: ModelChanges + + +changes = { + 'species_changes': { + 'A': { + 'initial_concent': 24.2, + 'b': 'sbml' + } + } +} + +r = { + 'reaction_name': { + 'parameters': { + 'reaction_parameter_name': 23.2 # (new reaction_parameter_name value) <-- this is done with set_reaction_parameters(name="(REACTION_NAME).REACTION_NAME_PARAM", value=VALUE) + }, + 'reaction_scheme': 'maybe[string]' # <-- this is done like set_reaction(name = 'R1', scheme = 'S + E + F = ES') + } +} + CHANGES_SCHEMA = """The following types have been derived from both SEDML L1v4 and basico itself. BASICO_MODEL_CHANGES_TYPE = { diff --git a/biosimulator_processes/processes/__init__.py b/biosimulator_processes/processes/__init__.py index 0cc8f953a..8b1378917 100644 --- a/biosimulator_processes/processes/__init__.py +++ b/biosimulator_processes/processes/__init__.py @@ -1,28 +1 @@ -from builder import ProcessTypes, Builder - -# Define a list of processes to attempt to import and register -PROCESSES_TO_REGISTER = [ - ('cobra', 'cobra_process.CobraProcess'), - ('copasi', 'copasi_process.CopasiProcess'), - ('smoldyn', 'smoldyn_process.SmoldynProcess'), - ('tellurium', 'tellurium_process.TelluriumProcess'), -] - -CORE = ProcessTypes() -BIOSIMULATOR_PROCESS_BUILDER = Builder(core=CORE) - -for process_name, process_path in PROCESSES_TO_REGISTER: - module_name, class_name = process_path.rsplit('.', 1) - try: - # Dynamically import the module - process_module = __import__( - f'biosimulator_processes.processes.{module_name}', fromlist=[class_name]) - # Get the class from the module - process_class = getattr(process_module, class_name) - - # Register the process - BIOSIMULATOR_PROCESS_BUILDER.register_process(class_name, process_class) - print(f"{class_name} registered successfully.") - except ImportError as e: - print(f"{class_name} not available. Error: {e}") diff --git a/biosimulator_processes/processes/cobra_process.py b/biosimulator_processes/processes/cobra_process.py index 14ed48cb6..7bfbdfc84 100644 --- a/biosimulator_processes/processes/cobra_process.py +++ b/biosimulator_processes/processes/cobra_process.py @@ -6,7 +6,7 @@ import cobra.io from cobra.io import read_sbml_model from process_bigraph import Process, Composite, pf, pp -from biosimulator_processes.processes import BIOSIMULATOR_PROCESS_BUILDER +from biosimulator_processes import CORE def check_sbml(state, schema, core): @@ -33,8 +33,8 @@ def check_sbml(state, schema, core): } # register new types -BIOSIMULATOR_PROCESS_BUILDER.register_type('bounds', bounds_type) -BIOSIMULATOR_PROCESS_BUILDER.register_type('sbml', sbml_type) +CORE.type_registry.register('bounds', bounds_type) +CORE.type_registry.register('sbml', sbml_type) class CobraProcess(Process): diff --git a/containers/__init__.py b/containers/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/containers/exec.py b/containers/exec.py new file mode 100644 index 000000000..83da962cc --- /dev/null +++ b/containers/exec.py @@ -0,0 +1,124 @@ +import toml +import subprocess +from typing import * +from docker import DockerClient +from biosimulator_processes.containers.io import write_dockerfile + + +CLIENT = DockerClient(base_url='unix:///var/run/docker.sock') + + +def get_simulators(sims: List[str]): + """Get specified simulator installation information including required dependencies + and format as a dictionary. This dictionary is used as configuration for the dynamic + creation of containers. + """ + with open('biosimulator_processes/poetry.lock') as file: + lock_data = toml.load(file) + + simulators = [] + for sim in sims: + for package in lock_data.get('package', []): + if package['name'] == sim: + simulators.append({ + "name": package['name'], + "version": package['version'], + "deps": package.get('dependencies', {}), + "extras": package.get('extras', {}) + }) + break + + return {"simulators": simulators} + + +def generate_dockerfile_contents(config: dict) -> str: + """Generate contents to be written out to a Dockerfile derived from the base Dockerfile. + + Args: + config:`dict`: a dictionary specifying simulator versions and their dependencies. The schema for + this dictionary should be (for example): + + { + "simulators": [ + { + "name": "tellurium", + "version": "2.2.10", + "deps": { + "antimony": ">=2.12.0", + "appdirs": ">=1.4.3", + "ipykernel": ">=4.6.1", + "ipython": "*", + "jinja2": ">=3.0.0", + "jupyter-client": ">=5.1.0", + "jupyter-core": ">=4.3.0", + "libroadrunner": ">=2.1", + "matplotlib": ">=2.0.2", + "numpy": ">=1.23", + "pandas": ">=0.20.2", + "phrasedml": { + "version": ">=1.0.9", + "markers": "platform_machine != \"arm64\"" + }, + "plotly": ">=2.0.12", + "pytest": "*", + "python-libcombine": ">=0.2.2", + "python-libnuml": ">=1.0.0", + "python-libsbml": ">=5.18.0", + "python-libsedml": ">=2.0.17", + "requests": "*", + "rrplugins": { + "version": ">=2.1", + "markers": "platform_system == \"Windows\"" + }, + "scipy": ">=1.5.1" + } + }, + """ + + base_path = 'biosimulator_processes/Dockerfile-base' + # TODO: automate mapping simulators to poetry.lock: ie: simulators arg that searches the lock file + with open(base_path, 'r') as fp: + dockerfile_contents = fp.read() + for simulator in config['simulators']: + # copy the appropriate process files + name = simulator['name'] + deps = simulator.get('deps', {}) + for dep, version in deps.items(): + if not version == "*": + complete_version = f'{dep}{version}' + else: + complete_version = f'{dep}' + # dockerfile_contents += f"RUN poetry add {complete_version}\n" + dockerfile_contents += f"RUN pip install {complete_version}\n" + if name == 'copasi-basico': + name = 'copasi' + dockerfile_contents += f"COPY ./biosimulator_processes/{simulator['name']}_process.py /app/{simulator['name']}_process.py\n" + # common entrypoint used by all processes + dockerfile_contents += 'ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]' + return dockerfile_contents + + +def build_image(name: str, p: str = '.'): + return CLIENT.images.build( + path=p, + tag=name) + + +def execute_container(img_name: str = 'composition'): + img = build_image(img_name) + CLIENT.containers.run(img.id) + + +def run(simulators: List[str]): + config = get_simulators(simulators) + dockerfile_contents = generate_dockerfile_contents(config) + dockerfile_path = 'Dockerfile' + write_dockerfile(dockerfile_contents, out_path=dockerfile_path) + # return execute_container() + + +def exec_container(name: str): + build_command = f"docker buildx build --platform linux/amd64 {name}_env ." + subprocess.run(build_command.split()) + run_command = f"docker run --platform linux/amd64 -it -p 8888:8888 {name}_env" + subprocess.run(run_command.split()) diff --git a/containers/io.py b/containers/io.py new file mode 100644 index 000000000..aa2f50d45 --- /dev/null +++ b/containers/io.py @@ -0,0 +1,24 @@ +import json + + +def write_dockerfile(dockerfile_contents: str, out_path: str): + """ + Args: + dockerfile_contents:`str`: content to write to Dockerfile + out_path:`str`: path to save the Dockerfile + + """ + with open(out_path, 'w') as file: + file.write(dockerfile_contents) + + +def write_config(): + config = {} + with open('biosimulator_processes/simulators.json', 'w') as fp: + json.dump(config, fp, indent=4) + + +def load_config(): + # Load simulator configuration + with open('biosimulator_processes/simulators.json', 'r') as file: + return json.load(file) diff --git a/notebooks/builder_composer.ipynb b/notebooks/builder_composer.ipynb index 8d0c86362..d68219d2a 100644 --- a/notebooks/builder_composer.ipynb +++ b/notebooks/builder_composer.ipynb @@ -2,27 +2,12 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "initial_id", "metadata": { - "collapsed": true, - "ExecuteTime": { - "end_time": "2024-02-29T20:09:15.122840Z", - "start_time": "2024-02-29T20:09:11.890820Z" - } + "collapsed": true }, - "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 sys\n", "\n", @@ -33,33 +18,42 @@ "from builder import Builder, Process as builderProcess, ProcessTypes\n", "from biosimulator_processes.processes.copasi_process import CopasiProcess\n", "from biosimulator_processes.process_types import MODEL_TYPE, CHANGES_SCHEMA\n", - "from biosimulator_processes.utils import play_composition" + "from biosimulator_processes.utils import play_composition\n", + "from biosimulator_processes.process_types import SedModel, ModelChange, ModelChanges" ] }, { "cell_type": "code", - "outputs": [ - { - "data": { - "text/plain": "{'model_id': 'string',\n 'model_source': 'string',\n 'model_language': {'_type': 'string', '_default': 'sbml'},\n 'model_name': {'_type': 'string', '_default': 'composite_process_model'},\n 'model_changes': {'species_changes': 'tree[string]',\n 'global_parameter_changes': 'tree[string]',\n 'reaction_changes': 'tree[string]'},\n 'model_units': 'tree[string]'}" - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "MODEL_TYPE" + "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", + "\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", + ")" ], "metadata": { - "collapsed": false, - "ExecuteTime": { - "end_time": "2024-02-29T20:10:05.286585Z", - "start_time": "2024-02-29T20:10:05.282904Z" - } + "collapsed": false }, "id": "774d37b1e2bcb0c7", - "execution_count": 2 + "execution_count": null }, { "cell_type": "code", diff --git a/notebooks/copasi_process_composer.ipynb b/notebooks/copasi_process_composer.ipynb index fee9c777b..1af1931bb 100644 --- a/notebooks/copasi_process_composer.ipynb +++ b/notebooks/copasi_process_composer.ipynb @@ -4,7 +4,10 @@ "cell_type": "markdown", "id": "d0676f702366d09c", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "# CopasiProcess Composer" @@ -16,8 +19,8 @@ "id": "initial_id", "metadata": { "ExecuteTime": { - "end_time": "2024-02-29T20:07:10.291540Z", - "start_time": "2024-02-29T20:07:10.285014Z" + "end_time": "2024-02-29T20:31:55.797099Z", + "start_time": "2024-02-29T20:31:55.791270Z" } }, "outputs": [], @@ -32,10 +35,13 @@ "execution_count": 2, "id": "c6c10dc5988e52d4", "metadata": { - "collapsed": false, "ExecuteTime": { - "end_time": "2024-02-29T20:07:13.885067Z", - "start_time": "2024-02-29T20:07:11.122275Z" + "end_time": "2024-02-29T20:32:02.845208Z", + "start_time": "2024-02-29T20:31:56.503338Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false } }, "outputs": [ @@ -43,10 +49,25 @@ "name": "stdout", "output_type": "stream", "text": [ - "CobraProcess registered successfully.\n", - "CopasiProcess registered successfully.\n", - "SmoldynProcess registered successfully.\n", - "TelluriumProcess registered successfully.\n" + "CobraProcess registered successfully.\n" + ] + }, + { + "ename": "TypeError", + "evalue": "Too many parameters for typing.Dict; actual 3, expected 2", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[2], line 5\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mprocess_bigraph\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Composite, pf \n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbuilder\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Builder, Process \u001b[38;5;28;01mas\u001b[39;00m builderProcess, ProcessTypes\n\u001b[0;32m----> 5\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprocesses\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcopasi_process\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CopasiProcess\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprocess_types\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MODEL_TYPE, CHANGES_SCHEMA\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m play_composition\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/notebooks/../biosimulator_processes/__init__.py:18\u001b[0m\n\u001b[1;32m 15\u001b[0m module_name, class_name \u001b[38;5;241m=\u001b[39m process_path\u001b[38;5;241m.\u001b[39mrsplit(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;241m1\u001b[39m)\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 17\u001b[0m \u001b[38;5;66;03m# Dynamically import the module\u001b[39;00m\n\u001b[0;32m---> 18\u001b[0m process_module \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43m__import__\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mbiosimulator_processes.processes.\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mmodule_name\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfromlist\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43mclass_name\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;66;03m# Get the class from the module\u001b[39;00m\n\u001b[1;32m 21\u001b[0m process_class \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(process_module, class_name)\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/notebooks/../biosimulator_processes/processes/copasi_process.py:36\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mprocess_bigraph\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Process, Composite, pf\n\u001b[1;32m 35\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m fetch_biomodel\n\u001b[0;32m---> 36\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprocess_types\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MODEL_TYPE\n\u001b[1;32m 37\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprocesses\u001b[39;00m\n\u001b[1;32m 40\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mCopasiProcess\u001b[39;00m(Process):\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/notebooks/../biosimulator_processes/process_types.py:6\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtyping\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mabc\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ABC, abstractmethod\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mModelChange\u001b[39;00m(BaseModel):\n\u001b[1;32m 7\u001b[0m config: Dict[\u001b[38;5;28mstr\u001b[39m, Union[Dict[\u001b[38;5;28mstr\u001b[39m, Union[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mfloat\u001b[39m]]], Dict[\u001b[38;5;28mstr\u001b[39m, Dict[\u001b[38;5;28mstr\u001b[39m, Union[\u001b[38;5;28mstr\u001b[39m, Dict[\u001b[38;5;28mstr\u001b[39m, Union[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mfloat\u001b[39m]]]]]]\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mModelChanges\u001b[39;00m(BaseModel):\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/notebooks/../biosimulator_processes/process_types.py:7\u001b[0m, in \u001b[0;36mModelChange\u001b[0;34m()\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mModelChange\u001b[39;00m(BaseModel):\n\u001b[0;32m----> 7\u001b[0m config: \u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\n", + "File \u001b[0;32m~/miniconda3/envs/processes/lib/python3.10/typing.py:312\u001b[0m, in \u001b[0;36m_tp_cache..decorator..inner\u001b[0;34m(*args, **kwds)\u001b[0m\n\u001b[1;32m 310\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[1;32m 311\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m \u001b[38;5;66;03m# All real errors (not unhashable args) are raised below.\u001b[39;00m\n\u001b[0;32m--> 312\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/miniconda3/envs/processes/lib/python3.10/typing.py:1144\u001b[0m, in \u001b[0;36m_SpecialGenericAlias.__getitem__\u001b[0;34m(self, params)\u001b[0m\n\u001b[1;32m 1142\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mParameters to generic types must be types.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1143\u001b[0m params \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mtuple\u001b[39m(_type_check(p, msg) \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m params)\n\u001b[0;32m-> 1144\u001b[0m \u001b[43m_check_generic\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_nparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1145\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcopy_with(params)\n", + "File \u001b[0;32m~/miniconda3/envs/processes/lib/python3.10/site-packages/typing_extensions.py:167\u001b[0m, in \u001b[0;36m_check_generic\u001b[0;34m(cls, parameters, elen)\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (num_tv_tuples \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m (alen \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m elen \u001b[38;5;241m-\u001b[39m num_tv_tuples):\n\u001b[1;32m 166\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m--> 167\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mToo \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmany\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mif\u001b[39;00m\u001b[38;5;250m \u001b[39malen\u001b[38;5;250m \u001b[39m\u001b[38;5;241m>\u001b[39m\u001b[38;5;250m \u001b[39melen\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01melse\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfew\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m parameters for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mcls\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m;\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 168\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m actual \u001b[39m\u001b[38;5;132;01m{\u001b[39;00malen\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m, expected \u001b[39m\u001b[38;5;132;01m{\u001b[39;00melen\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n", + "\u001b[0;31mTypeError\u001b[0m: Too many parameters for typing.Dict; actual 3, expected 2" ] } ], @@ -60,11 +81,54 @@ "from biosimulator_processes.utils import play_composition" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "1538eb46-f1bc-410b-961f-a88fae0d3171", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "38d014d4-6d36-444e-bfe6-70f05c7b0236", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c2460c77-0b8b-4232-8fad-6c2dbd8fbcdb", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "02075025-4173-49dc-930b-fef94904c04e", + "metadata": {}, + "outputs": [], + "source": [] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "bfaed812-6f8a-40d0-9c1d-a3a4bd213ebf", + "metadata": {}, + "outputs": [], + "source": [] + }, { "cell_type": "markdown", "id": "ac92611c7adf47e1", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "### Example 1: Define a single process instance and a corresponding emitter" @@ -74,7 +138,10 @@ "cell_type": "markdown", "id": "8608877d697af60c", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "##### 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." @@ -82,6 +149,13 @@ }, { "cell_type": "markdown", + "id": "63a90540d44034e1", + "metadata": { + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, "source": [ "\n", "##### **As per the `CopasiProcess` constructor, there are three primary methods of entry:**\n", @@ -111,31 +185,29 @@ " \n", " else:\n", " self.copasi_model_object = new_model(name='CopasiProcess Model')" - ], - "metadata": { - "collapsed": false - }, - "id": "63a90540d44034e1" + ] }, { "cell_type": "markdown", - "source": [ - "##### Here we define the schema for a single process based on the provided entrypoint." - ], + "id": "c2537269b7efeee0", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, - "id": "c2537269b7efeee0" + "source": [ + "##### Here we define the schema for a single process based on the provided entrypoint." + ] }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "77636dbde3fa6b74", "metadata": { "collapsed": false, - "ExecuteTime": { - "end_time": "2024-02-29T20:07:28.607057Z", - "start_time": "2024-02-29T20:07:28.604021Z" + "jupyter": { + "outputs_hidden": false } }, "outputs": [], @@ -184,7 +256,10 @@ "cell_type": "markdown", "id": "e5199aee6d533761", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "##### 2. Instantiate the Process-Bigraph-Engine with the Composite class" @@ -192,34 +267,15 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "4c2ef631b005be61", "metadata": { "collapsed": false, - "ExecuteTime": { - "end_time": "2024-02-29T20:07:31.042923Z", - "start_time": "2024-02-29T20:07:30.728435Z" + "jupyter": { + "outputs_hidden": false } }, - "outputs": [ - { - "ename": "Exception", - "evalue": "process \"copasi\" not found", - "output_type": "error", - "traceback": [ - "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", - "\u001B[0;31mException\u001B[0m Traceback (most recent call last)", - "Cell \u001B[0;32mIn[4], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m workflow \u001B[38;5;241m=\u001B[39m \u001B[43mComposite\u001B[49m\u001B[43m(\u001B[49m\u001B[43m{\u001B[49m\n\u001B[1;32m 2\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[38;5;124;43mstate\u001B[39;49m\u001B[38;5;124;43m'\u001B[39;49m\u001B[43m:\u001B[49m\u001B[43m \u001B[49m\u001B[43minstance1\u001B[49m\n\u001B[1;32m 3\u001B[0m \u001B[43m}\u001B[49m\u001B[43m)\u001B[49m\n", - "File \u001B[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:744\u001B[0m, in \u001B[0;36mComposite.__init__\u001B[0;34m(self, config, core)\u001B[0m\n\u001B[1;32m 741\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;124m'\u001B[39m\u001B[38;5;124mglobal_time\u001B[39m\u001B[38;5;124m'\u001B[39m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;129;01min\u001B[39;00m initial_state:\n\u001B[1;32m 742\u001B[0m initial_state[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mglobal_time\u001B[39m\u001B[38;5;124m'\u001B[39m] \u001B[38;5;241m=\u001B[39m \u001B[38;5;241m0.0\u001B[39m\n\u001B[0;32m--> 744\u001B[0m composition, state \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mcore\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mcomplete\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 745\u001B[0m \u001B[43m \u001B[49m\u001B[43minitial_composition\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 746\u001B[0m \u001B[43m \u001B[49m\u001B[43minitial_state\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 748\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcomposition \u001B[38;5;241m=\u001B[39m copy\u001B[38;5;241m.\u001B[39mdeepcopy(\n\u001B[1;32m 749\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcore\u001B[38;5;241m.\u001B[39maccess(composition))\n\u001B[1;32m 751\u001B[0m \u001B[38;5;66;03m# TODO: add flag to self.core.access(copy=True)\u001B[39;00m\n", - "File \u001B[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/bigraph_schema/type_system.py:1334\u001B[0m, in \u001B[0;36mTypeSystem.complete\u001B[0;34m(self, initial_schema, initial_state)\u001B[0m\n\u001B[1;32m 1328\u001B[0m state \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mhydrate(\n\u001B[1;32m 1329\u001B[0m full_schema,\n\u001B[1;32m 1330\u001B[0m initial_state)\n\u001B[1;32m 1332\u001B[0m \u001B[38;5;66;03m# fill in the parts of the composition schema\u001B[39;00m\n\u001B[1;32m 1333\u001B[0m \u001B[38;5;66;03m# determined by the state\u001B[39;00m\n\u001B[0;32m-> 1334\u001B[0m schema, state \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43minfer_schema\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 1335\u001B[0m \u001B[43m \u001B[49m\u001B[43mfull_schema\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 1336\u001B[0m \u001B[43m \u001B[49m\u001B[43mstate\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 1338\u001B[0m final_state \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mfill(schema, state)\n\u001B[1;32m 1340\u001B[0m \u001B[38;5;66;03m# TODO: add flag to types.access(copy=True)\u001B[39;00m\n", - "File \u001B[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:270\u001B[0m, in \u001B[0;36mProcessTypes.infer_schema\u001B[0;34m(self, schema, state, top_state, path)\u001B[0m\n\u001B[1;32m 267\u001B[0m inner_path \u001B[38;5;241m=\u001B[39m path \u001B[38;5;241m+\u001B[39m (key,)\n\u001B[1;32m 268\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m get_path(schema, inner_path) \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;129;01mor\u001B[39;00m get_path(state, inner_path) \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;129;01mor\u001B[39;00m (\n\u001B[1;32m 269\u001B[0m \u001B[38;5;28misinstance\u001B[39m(value, \u001B[38;5;28mdict\u001B[39m) \u001B[38;5;129;01mand\u001B[39;00m \u001B[38;5;124m'\u001B[39m\u001B[38;5;124m_type\u001B[39m\u001B[38;5;124m'\u001B[39m \u001B[38;5;129;01min\u001B[39;00m value):\n\u001B[0;32m--> 270\u001B[0m schema, top_state \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43minfer_schema\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 271\u001B[0m \u001B[43m \u001B[49m\u001B[43mschema\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 272\u001B[0m \u001B[43m \u001B[49m\u001B[43mvalue\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 273\u001B[0m \u001B[43m \u001B[49m\u001B[43mtop_state\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43mtop_state\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 274\u001B[0m \u001B[43m \u001B[49m\u001B[43mpath\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43minner_path\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 276\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(state, \u001B[38;5;28mstr\u001B[39m):\n\u001B[1;32m 277\u001B[0m \u001B[38;5;28;01mpass\u001B[39;00m\n", - "File \u001B[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:222\u001B[0m, in \u001B[0;36mProcessTypes.infer_schema\u001B[0;34m(self, schema, state, top_state, path)\u001B[0m\n\u001B[1;32m 219\u001B[0m state_type \u001B[38;5;241m=\u001B[39m state[\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m_type\u001B[39m\u001B[38;5;124m'\u001B[39m]\n\u001B[1;32m 220\u001B[0m state_schema \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39maccess(state_type)\n\u001B[0;32m--> 222\u001B[0m hydrated_state \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mdeserialize\u001B[49m\u001B[43m(\u001B[49m\u001B[43mstate_schema\u001B[49m\u001B[43m,\u001B[49m\u001B[43m \u001B[49m\u001B[43mstate\u001B[49m\u001B[43m)\u001B[49m\n\u001B[1;32m 223\u001B[0m top_state \u001B[38;5;241m=\u001B[39m set_path(\n\u001B[1;32m 224\u001B[0m top_state,\n\u001B[1;32m 225\u001B[0m path,\n\u001B[1;32m 226\u001B[0m hydrated_state)\n\u001B[1;32m 228\u001B[0m schema \u001B[38;5;241m=\u001B[39m set_path(\n\u001B[1;32m 229\u001B[0m schema,\n\u001B[1;32m 230\u001B[0m path,\n\u001B[1;32m 231\u001B[0m {\u001B[38;5;124m'\u001B[39m\u001B[38;5;124m_type\u001B[39m\u001B[38;5;124m'\u001B[39m: state_type})\n", - "File \u001B[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/bigraph_schema/type_system.py:675\u001B[0m, in \u001B[0;36mTypeSystem.deserialize\u001B[0;34m(self, schema, encoded)\u001B[0m\n\u001B[1;32m 672\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m encoded \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m:\n\u001B[1;32m 673\u001B[0m encoded \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdefault(schema)\n\u001B[0;32m--> 675\u001B[0m \u001B[38;5;28;01mreturn\u001B[39;00m \u001B[43mdeserialize_function\u001B[49m\u001B[43m(\u001B[49m\n\u001B[1;32m 676\u001B[0m \u001B[43m \u001B[49m\u001B[43mfound\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 677\u001B[0m \u001B[43m \u001B[49m\u001B[43mencoded\u001B[49m\u001B[43m,\u001B[49m\n\u001B[1;32m 678\u001B[0m \u001B[43m \u001B[49m\u001B[38;5;28;43mself\u001B[39;49m\u001B[43m)\u001B[49m\n\u001B[1;32m 680\u001B[0m \u001B[38;5;28;01melif\u001B[39;00m \u001B[38;5;28misinstance\u001B[39m(encoded, \u001B[38;5;28mdict\u001B[39m):\n\u001B[1;32m 681\u001B[0m result \u001B[38;5;241m=\u001B[39m {}\n", - "File \u001B[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:84\u001B[0m, in \u001B[0;36mdeserialize_process\u001B[0;34m(schema, encoded, core)\u001B[0m\n\u001B[1;32m 82\u001B[0m instantiate \u001B[38;5;241m=\u001B[39m process_lookup(core, address)\n\u001B[1;32m 83\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m instantiate:\n\u001B[0;32m---> 84\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m \u001B[38;5;167;01mException\u001B[39;00m(\u001B[38;5;124mf\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mprocess \u001B[39m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;132;01m{\u001B[39;00maddress\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124m not found\u001B[39m\u001B[38;5;124m'\u001B[39m)\n\u001B[1;32m 86\u001B[0m config \u001B[38;5;241m=\u001B[39m core\u001B[38;5;241m.\u001B[39mhydrate_state(\n\u001B[1;32m 87\u001B[0m instantiate\u001B[38;5;241m.\u001B[39mconfig_schema,\n\u001B[1;32m 88\u001B[0m encoded\u001B[38;5;241m.\u001B[39mget(\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mconfig\u001B[39m\u001B[38;5;124m'\u001B[39m, {}))\n\u001B[1;32m 90\u001B[0m interval \u001B[38;5;241m=\u001B[39m core\u001B[38;5;241m.\u001B[39mdeserialize(\n\u001B[1;32m 91\u001B[0m \u001B[38;5;124m'\u001B[39m\u001B[38;5;124minterval\u001B[39m\u001B[38;5;124m'\u001B[39m,\n\u001B[1;32m 92\u001B[0m encoded\u001B[38;5;241m.\u001B[39mget(\u001B[38;5;124m'\u001B[39m\u001B[38;5;124minterval\u001B[39m\u001B[38;5;124m'\u001B[39m))\n", - "\u001B[0;31mException\u001B[0m: process \"copasi\" not found" - ] - } - ], + "outputs": [], "source": [ "workflow = Composite({\n", " 'state': instance1\n", @@ -230,7 +286,10 @@ "cell_type": "markdown", "id": "6a402e48fbc30a5b", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "##### 3. Run the Composite workflow with the Engine" @@ -241,7 +300,10 @@ "execution_count": null, "id": "98676149a4ce822f", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [ @@ -252,7 +314,10 @@ "cell_type": "markdown", "id": "d0ff3a2822a8fa2c", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "##### 4. Gather and neatly-print the results." @@ -263,7 +328,10 @@ "execution_count": null, "id": "c15cee593ef000a7", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [ @@ -276,7 +344,10 @@ "cell_type": "markdown", "id": "b098a589f08ce138", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "##### 5. Plot/Analyze the results with Plotly" @@ -287,7 +358,10 @@ "execution_count": null, "id": "297504800772775e", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "outputs": [], "source": [ @@ -298,7 +372,10 @@ "cell_type": "markdown", "id": "2afe93d975ed2aee", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, "source": [ "#### Example 2: Define a single-process composition from a given BioModels model id and make model changes. The options available for configuration of a `'model'` that can be run by the composite process are based on SEDML L1V4 specifications. Please note that not all parameters are required in this configuration." @@ -306,58 +383,74 @@ }, { "cell_type": "code", + "execution_count": null, + "id": "433d58bbe38402af", + "metadata": { + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, "outputs": [], "source": [ "CHANGES_SCHEMA" - ], - "metadata": { - "collapsed": false - }, - "id": "433d58bbe38402af", - "execution_count": null + ] }, { "cell_type": "markdown", - "source": [ - "#### Example 2a: Define a single process with a different entrypoint." - ], + "id": "527d7217e4fc20c4", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, - "id": "527d7217e4fc20c4" + "source": [ + "#### Example 2a: Define a single process with a different entrypoint." + ] }, { "cell_type": "markdown", - "source": [ - "#### Example 3: Define multiple processes in the same instance for a parameter scan. " - ], + "id": "ebf2bf601e5054a6", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, - "id": "ebf2bf601e5054a6" + "source": [ + "#### Example 3: Define multiple processes in the same instance for a parameter scan. " + ] }, { "cell_type": "code", + "execution_count": null, + "id": "1ecc10e496abe9cb", + "metadata": { + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, "outputs": [], "source": [ "from biosimulator_processes.utils import generate_copasi_parameter_scan_instance as param_scan\n", "\n", "parameter_scan_instance = param_scan(num_iterations=100, entry_config={'biomodel_id': 'BIOMD0000000051'})" - ], - "metadata": { - "collapsed": false - }, - "id": "1ecc10e496abe9cb", - "execution_count": null + ] }, { "cell_type": "code", - "outputs": [], - "source": [], + "execution_count": null, + "id": "fe14c4d829cb0f58", "metadata": { - "collapsed": false + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } }, - "id": "fe14c4d829cb0f58" + "outputs": [], + "source": [] } ], "metadata": { diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb new file mode 100644 index 000000000..d8f2af791 --- /dev/null +++ b/notebooks/demo.ipynb @@ -0,0 +1,1537 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "808b6a4b-0894-4a8e-99d8-bf11b3164b6a", + "metadata": {}, + "source": [ + "# Bigraph-Builder Demo" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "b385dca6-942d-472c-9963-13b8cb33843c", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:16:03.547147Z", + "start_time": "2024-02-29T22:16:02.510078Z" + } + }, + "outputs": [], + "source": [ + "from builder import Builder, Process, ProcessTypes" + ] + }, + { + "cell_type": "markdown", + "id": "a403d619-4dbe-49cc-8f24-29a83e31fe15", + "metadata": {}, + "source": [ + "## Initialize the builder" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "23ae6471dca4692b", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:16:36.372695Z", + "start_time": "2024-02-29T22:16:30.599813Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CobraProcess registered successfully.\n" + ] + }, + { + "ename": "TypeError", + "evalue": "Too many parameters for typing.Dict; actual 3, expected 2", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m CORE\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/biosimulator_processes/__init__.py:18\u001b[0m\n\u001b[1;32m 15\u001b[0m module_name, class_name \u001b[38;5;241m=\u001b[39m process_path\u001b[38;5;241m.\u001b[39mrsplit(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;241m1\u001b[39m)\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 17\u001b[0m \u001b[38;5;66;03m# Dynamically import the module\u001b[39;00m\n\u001b[0;32m---> 18\u001b[0m process_module \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43m__import__\u001b[39;49m\u001b[43m(\u001b[49m\n\u001b[1;32m 19\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43mf\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mbiosimulator_processes.processes.\u001b[39;49m\u001b[38;5;132;43;01m{\u001b[39;49;00m\u001b[43mmodule_name\u001b[49m\u001b[38;5;132;43;01m}\u001b[39;49;00m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfromlist\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m[\u001b[49m\u001b[43mclass_name\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;66;03m# Get the class from the module\u001b[39;00m\n\u001b[1;32m 21\u001b[0m process_class \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(process_module, class_name)\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/biosimulator_processes/processes/copasi_process.py:36\u001b[0m\n\u001b[1;32m 34\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mprocess_bigraph\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Process, Composite, pf\n\u001b[1;32m 35\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m fetch_biomodel\n\u001b[0;32m---> 36\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprocess_types\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m MODEL_TYPE\n\u001b[1;32m 37\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mbiosimulator_processes\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mprocesses\u001b[39;00m\n\u001b[1;32m 40\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mCopasiProcess\u001b[39;00m(Process):\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/biosimulator_processes/process_types.py:6\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mtyping\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;241m*\u001b[39m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mabc\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m ABC, abstractmethod\n\u001b[0;32m----> 6\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mModelChange\u001b[39;00m(BaseModel):\n\u001b[1;32m 7\u001b[0m config: Dict[\u001b[38;5;28mstr\u001b[39m, Union[Dict[\u001b[38;5;28mstr\u001b[39m, Union[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mfloat\u001b[39m]]], Dict[\u001b[38;5;28mstr\u001b[39m, Dict[\u001b[38;5;28mstr\u001b[39m, Union[\u001b[38;5;28mstr\u001b[39m, Dict[\u001b[38;5;28mstr\u001b[39m, Union[\u001b[38;5;28mstr\u001b[39m, \u001b[38;5;28mfloat\u001b[39m]]]]]]\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mModelChanges\u001b[39;00m(BaseModel):\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/biosimulator_processes/process_types.py:7\u001b[0m, in \u001b[0;36mModelChange\u001b[0;34m()\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mclass\u001b[39;00m \u001b[38;5;21;01mModelChange\u001b[39;00m(BaseModel):\n\u001b[0;32m----> 7\u001b[0m config: \u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mDict\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mUnion\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;28;43mstr\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\n", + "File \u001b[0;32m~/miniconda3/envs/processes/lib/python3.10/typing.py:312\u001b[0m, in \u001b[0;36m_tp_cache..decorator..inner\u001b[0;34m(*args, **kwds)\u001b[0m\n\u001b[1;32m 310\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m:\n\u001b[1;32m 311\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m \u001b[38;5;66;03m# All real errors (not unhashable args) are raised below.\u001b[39;00m\n\u001b[0;32m--> 312\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/miniconda3/envs/processes/lib/python3.10/typing.py:1144\u001b[0m, in \u001b[0;36m_SpecialGenericAlias.__getitem__\u001b[0;34m(self, params)\u001b[0m\n\u001b[1;32m 1142\u001b[0m msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mParameters to generic types must be types.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 1143\u001b[0m params \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mtuple\u001b[39m(_type_check(p, msg) \u001b[38;5;28;01mfor\u001b[39;00m p \u001b[38;5;129;01min\u001b[39;00m params)\n\u001b[0;32m-> 1144\u001b[0m \u001b[43m_check_generic\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_nparams\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1145\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcopy_with(params)\n", + "File \u001b[0;32m~/miniconda3/envs/processes/lib/python3.10/site-packages/typing_extensions.py:167\u001b[0m, in \u001b[0;36m_check_generic\u001b[0;34m(cls, parameters, elen)\u001b[0m\n\u001b[1;32m 165\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m (num_tv_tuples \u001b[38;5;241m>\u001b[39m \u001b[38;5;241m0\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m (alen \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m elen \u001b[38;5;241m-\u001b[39m num_tv_tuples):\n\u001b[1;32m 166\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m\n\u001b[0;32m--> 167\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mToo \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmany\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mif\u001b[39;00m\u001b[38;5;250m \u001b[39malen\u001b[38;5;250m \u001b[39m\u001b[38;5;241m>\u001b[39m\u001b[38;5;250m \u001b[39melen\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01melse\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfew\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m parameters for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mcls\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m;\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 168\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m actual \u001b[39m\u001b[38;5;132;01m{\u001b[39;00malen\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m, expected \u001b[39m\u001b[38;5;132;01m{\u001b[39;00melen\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n", + "\u001b[0;31mTypeError\u001b[0m: Too many parameters for typing.Dict; actual 3, expected 2" + ] + } + ], + "source": [ + "from biosimulator_processes import CORE" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b6260555-2bad-4834-adc5-e6d358063579", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:16:46.801960Z", + "start_time": "2024-02-29T22:16:46.793248Z" + } + }, + "outputs": [], + "source": [ + "b = Builder(core=CORE)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "deceb0daee61b0ce", + "metadata": { + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [], + "source": [] + }, + { + "cell_type": "markdown", + "id": "dd85f98e-c5e3-467b-97ab-1ced7e810a17", + "metadata": {}, + "source": [ + "### register new types" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "30297af1-2d65-43d9-9ab7-0589d94a8cfe", + "metadata": { + "ExecuteTime": { + "end_time": "2024-01-21T21:29:21.896737Z", + "start_time": "2024-01-21T21:29:21.891980Z" + } + }, + "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": 4, + "id": "979e0bd85a31d4b0", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:17:04.854193Z", + "start_time": "2024-02-29T22:17:04.809312Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['ram-emitter',\n", + " 'CobraProcess',\n", + " 'CopasiProcess',\n", + " 'console-emitter',\n", + " 'TelluriumProcess']" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b.list_processes()" + ] + }, + { + "cell_type": "markdown", + "id": "9710444c-97c5-484c-83b0-8d82c3fdb92f", + "metadata": {}, + "source": [ + "### register process with process class" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "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": 6, + "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": 7, + "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", + "\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" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "40cde984-cfdf-4571-af9c-3a3755e3763c", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:17:55.896655Z", + "start_time": "2024-02-29T22:17:55.865157Z" + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['ram-emitter',\n", + " 'CobraProcess',\n", + " 'CopasiProcess',\n", + " 'console-emitter',\n", + " 'TelluriumProcess']" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b.list_processes()" + ] + }, + { + "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" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "a153fd48f8c69115", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:18:58.854687Z", + "start_time": "2024-02-29T22:18:58.838535Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'model_id': 'string',\n", + " 'model_source': 'string',\n", + " 'model_language': {'_type': 'string', '_default': 'sbml'},\n", + " 'model_name': {'_type': 'string', '_default': 'composite_process_model'},\n", + " 'model_changes': {'species_changes': 'tree[string]',\n", + " 'global_parameter_changes': 'tree[string]',\n", + " 'reaction_changes': 'tree[string]'},\n", + " 'model_units': 'tree[string]'}" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from biosimulator_processes.process_types import MODEL_TYPE\n", + "\n", + "MODEL_TYPE" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "b79dc6639a17e353", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:52:19.098009Z", + "start_time": "2024-02-29T22:52:19.072379Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [], + "source": [ + "\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "64f1c09a938354e2", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:52:19.676325Z", + "start_time": "2024-02-29T22:52:19.658003Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": 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", + "\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": 42, + "id": "dd7bc7acafe252fd", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:52:20.659250Z", + "start_time": "2024-02-29T22:52:20.644293Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'model_id': 'BIO232423',\n", + " 'model_source': 'uri:2424',\n", + " 'model_language': 'sbml',\n", + " 'model_name': 'Glyc',\n", + " 'model_changes': {'species_changes': {'config': {'A': {'initial_expression': 'A -> B'}}},\n", + " 'global_parameter_changes': {'config': {'Bol': {'unit': 'ml'}}},\n", + " 'reaction_changes': None}}" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "model.model_dump()" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "503863ee-0a58-44b3-accc-20e0167b947b", + "metadata": { + "ExecuteTime": { + "end_time": "2024-02-29T22:18:04.150647Z", + "start_time": "2024-02-29T22:18:03.537292Z" + } + }, + "outputs": [ + { + "ename": "Exception", + "evalue": "config key kdeg not in config_schema for CopasiProcess", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mb\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcopasi_A\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m]\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43madd_process\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 2\u001b[0m \u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mCopasiProcess\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 3\u001b[0m \u001b[43m \u001b[49m\u001b[43mkdeg\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m1.0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# kwargs fill parameters in the config\u001b[39;49;00m\n\u001b[1;32m 4\u001b[0m \u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/builder/builder_api.py:148\u001b[0m, in \u001b[0;36mBuilderNode.add_process\u001b[0;34m(self, name, config, inputs, outputs, **kwargs)\u001b[0m\n\u001b[1;32m 139\u001b[0m state \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 140\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_type\u001b[39m\u001b[38;5;124m'\u001b[39m: edge_type,\n\u001b[1;32m 141\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124maddress\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlocal:\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;66;03m# TODO -- only support local right now?\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 144\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124moutputs\u001b[39m\u001b[38;5;124m'\u001b[39m: {} \u001b[38;5;28;01mif\u001b[39;00m outputs \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m outputs,\n\u001b[1;32m 145\u001b[0m }\n\u001b[1;32m 147\u001b[0m set_path(tree\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mbuilder\u001b[38;5;241m.\u001b[39mtree, path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpath, value\u001b[38;5;241m=\u001b[39mstate)\n\u001b[0;32m--> 148\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbuilder\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomplete\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/builder/builder_api.py:233\u001b[0m, in \u001b[0;36mBuilder.complete\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 232\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcomplete\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[0;32m--> 233\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mschema, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtree \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomplete\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtree\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/bigraph_schema/type_system.py:1334\u001b[0m, in \u001b[0;36mTypeSystem.complete\u001b[0;34m(self, initial_schema, initial_state)\u001b[0m\n\u001b[1;32m 1328\u001b[0m state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhydrate(\n\u001b[1;32m 1329\u001b[0m full_schema,\n\u001b[1;32m 1330\u001b[0m initial_state)\n\u001b[1;32m 1332\u001b[0m \u001b[38;5;66;03m# fill in the parts of the composition schema\u001b[39;00m\n\u001b[1;32m 1333\u001b[0m \u001b[38;5;66;03m# determined by the state\u001b[39;00m\n\u001b[0;32m-> 1334\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1335\u001b[0m \u001b[43m \u001b[49m\u001b[43mfull_schema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1336\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1338\u001b[0m final_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfill(schema, state)\n\u001b[1;32m 1340\u001b[0m \u001b[38;5;66;03m# TODO: add flag to types.access(copy=True)\u001b[39;00m\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:270\u001b[0m, in \u001b[0;36mProcessTypes.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 267\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 268\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m get_path(schema, inner_path) \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m get_path(state, inner_path) \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mor\u001b[39;00m (\n\u001b[1;32m 269\u001b[0m \u001b[38;5;28misinstance\u001b[39m(value, \u001b[38;5;28mdict\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_type\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m value):\n\u001b[0;32m--> 270\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 271\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 272\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 273\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 274\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 276\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 277\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:222\u001b[0m, in \u001b[0;36mProcessTypes.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 219\u001b[0m state_type \u001b[38;5;241m=\u001b[39m state[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_type\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 220\u001b[0m state_schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(state_type)\n\u001b[0;32m--> 222\u001b[0m hydrated_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate_schema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 223\u001b[0m top_state \u001b[38;5;241m=\u001b[39m set_path(\n\u001b[1;32m 224\u001b[0m top_state,\n\u001b[1;32m 225\u001b[0m path,\n\u001b[1;32m 226\u001b[0m hydrated_state)\n\u001b[1;32m 228\u001b[0m schema \u001b[38;5;241m=\u001b[39m set_path(\n\u001b[1;32m 229\u001b[0m schema,\n\u001b[1;32m 230\u001b[0m path,\n\u001b[1;32m 231\u001b[0m {\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_type\u001b[39m\u001b[38;5;124m'\u001b[39m: state_type})\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/bigraph_schema/type_system.py:675\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 672\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m encoded \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 673\u001b[0m encoded \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdefault(schema)\n\u001b[0;32m--> 675\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdeserialize_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 676\u001b[0m \u001b[43m \u001b[49m\u001b[43mfound\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 677\u001b[0m \u001b[43m \u001b[49m\u001b[43mencoded\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 678\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 680\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(encoded, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 681\u001b[0m result \u001b[38;5;241m=\u001b[39m {}\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:95\u001b[0m, in \u001b[0;36mdeserialize_process\u001b[0;34m(schema, encoded, core)\u001b[0m\n\u001b[1;32m 90\u001b[0m interval \u001b[38;5;241m=\u001b[39m core\u001b[38;5;241m.\u001b[39mdeserialize(\n\u001b[1;32m 91\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124minterval\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 92\u001b[0m encoded\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124minterval\u001b[39m\u001b[38;5;124m'\u001b[39m))\n\u001b[1;32m 94\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124minstance\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m deserialized:\n\u001b[0;32m---> 95\u001b[0m process \u001b[38;5;241m=\u001b[39m \u001b[43minstantiate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 96\u001b[0m deserialized[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124minstance\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m process\n\u001b[1;32m 98\u001b[0m deserialized[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mconfig\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m config\n", + "File \u001b[0;32m~/Desktop/uchc_work/biosimulator-processes/biosimulator_processes/processes/copasi_process.py:121\u001b[0m, in \u001b[0;36mCopasiProcess.__init__\u001b[0;34m(self, config, core)\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, config\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, core\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[0;32m--> 121\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[38;5;21;43m__init__\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mconfig\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 123\u001b[0m model_file \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m'\u001b[39m)\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmodel_source\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 124\u001b[0m sed_model_id \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmodel\u001b[39m\u001b[38;5;124m'\u001b[39m)\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmodel_id\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", + "File \u001b[0;32m~/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/process_bigraph/composite.py:438\u001b[0m, in \u001b[0;36mProcess.__init__\u001b[0;34m(self, config, core)\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m config\u001b[38;5;241m.\u001b[39mkeys():\n\u001b[1;32m 437\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig_schema:\n\u001b[0;32m--> 438\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mconfig key \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mkey\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m not in config_schema for \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__class__\u001b[39m\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 440\u001b[0m \u001b[38;5;66;03m# fill in defaults for config\u001b[39;00m\n\u001b[1;32m 441\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcore\u001b[38;5;241m.\u001b[39mfill(\n\u001b[1;32m 442\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mconfig_schema,\n\u001b[1;32m 443\u001b[0m config)\n", + "\u001b[0;31mException\u001b[0m: config key kdeg not in config_schema for CopasiProcess" + ] + } + ], + "source": [ + "copasi_config = \n", + "b['copasi_A'].add_process(\n", + " name='CopasiProcess',\n", + " kdeg=1.0, # kwargs fill parameters in the config\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "b094f1e5-5202-48d0-8bdd-57bbdded7fd1", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "bigraph\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('event_process',)\n", + "\n", + "event_process\n", + "\n", + "\n", + "\n", + "('event_process',)->('event_process', 'interval')\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "('event_process', 'm', 'R', 'N', 'A')->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('event_process', 'm', 'R', 'N', 'A')->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "\n", + "('event_process', 'D', 'N', 'A')->('event_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# visualize shows the process with its disconnected ports\n", + "b.visualize()" + ] + }, + { + "cell_type": "markdown", + "id": "0238392e-5d1f-403d-98c9-785576a0d91b", + "metadata": {}, + "source": [ + "### print ports" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "5ea31425-a8bb-45c3-a31d-77714cc8c137", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{ '_inputs': { 'DNA': {'A gene': 'float', 'B gene': 'float'},\n", + " 'mRNA': 'map[float]'},\n", + " '_outputs': {'mRNA': 'map[float]'}}\n" + ] + } + ], + "source": [ + "b['event_process'].interface(True)" + ] + }, + { + "cell_type": "markdown", + "id": "8068e0af-ebdd-4f01-8c54-4fb3b07fc21e", + "metadata": {}, + "source": [ + "### connect ports using connect_all\n", + "`Builder.connect_all` connects ports to stores of the same name." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "c9f462bb-5316-4724-aa8e-b3b71eb379b2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Builder({ 'event_process': { '_type': 'process',\n", + " 'address': 'local:GillespieEvent',\n", + " 'config': {'kdeg': 1.0, 'ktsc': 5.0},\n", + " 'inputs': {'DNA': ['DNA_store'], 'mRNA': ['mRNA_store']},\n", + " 'instance': ,\n", + " 'interval': 1.0,\n", + " 'outputs': {'mRNA': ['mRNA_store']}}})" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b.connect_all(append_to_store_name='_store')\n", + "b" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "79809baf-1d87-475a-b85f-3729f4716cb4", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "bigraph\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('mRNA_store',)\n", + "\n", + "mRNA_store\n", + "\n", + "\n", + "\n", + "('event_process',)\n", + "\n", + "event_process\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('DNA_store',)\n", + "\n", + "DNA_store\n", + "\n", + "\n", + "\n", + "('DNA_store', 'A gene')\n", + "\n", + "A gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'A gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store', 'B gene')\n", + "\n", + "B gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'B gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('event_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('event_process',)->('event_process', 'interval')\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 13, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b.visualize()" + ] + }, + { + "cell_type": "markdown", + "id": "c7687da5-6992-447b-a51b-14373984597f", + "metadata": {}, + "source": [ + "### add interval process to the config" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "f02c15797bdb73b8", + "metadata": { + "ExecuteTime": { + "start_time": "2024-01-21T21:29:21.997588Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [], + "source": [ + "b['interval_process'].add_process(\n", + " name='GillespieInterval',\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "aeb344bcd6a120ae", + "metadata": { + "ExecuteTime": { + "start_time": "2024-01-21T21:29:21.998661Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "bigraph\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('mRNA_store',)\n", + "\n", + "mRNA_store\n", + "\n", + "\n", + "\n", + "('event_process',)\n", + "\n", + "event_process\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('DNA_store',)\n", + "\n", + "DNA_store\n", + "\n", + "\n", + "\n", + "('DNA_store', 'A gene')\n", + "\n", + "A gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'A gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store', 'B gene')\n", + "\n", + "B gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'B gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('event_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('event_process',)->('event_process', 'interval')\n", + "\n", + "\n", + "\n", + "\n", + "('interval_process',)\n", + "\n", + "interval_process\n", + "\n", + "\n", + "\n", + "\n", + "('interval_process', 'D', 'N', 'A')->('interval_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "\n", + "('interval_process', 'm', 'R', 'N', 'A')->('interval_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "\n", + "('interval_process', 'i', 'n', 't', 'e', 'r', 'v', 'a', 'l')->('interval_process',)\n", + "\n", + "\n", + "interval\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b.visualize()" + ] + }, + { + "cell_type": "markdown", + "id": "be3f6695-80ed-4819-a121-de29c5cce23e", + "metadata": {}, + "source": [ + "### connect port to specific target" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "a5a1f48a-41aa-4768-b931-ad268495d836", + "metadata": {}, + "outputs": [], + "source": [ + "# to connect a port in a more targeted way, use connect and specify the port and its target path\n", + "b['interval_process'].connect(port='interval', target=['event_process', 'interval']) \n", + "\n", + "# the remaining ports can connect_all\n", + "b.connect_all() " + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "b21b54ae-49e8-47ad-bc88-1327a8e9d230", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "bigraph\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('interval_process',)\n", + "\n", + "interval_process\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')->('interval_process',)\n", + "\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('mRNA_store',)\n", + "\n", + "mRNA_store\n", + "\n", + "\n", + "\n", + "('mRNA_store', 'A mRNA')\n", + "\n", + "A mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('mRNA_store', 'A mRNA')\n", + "\n", + "\n", + "\n", + "\n", + "('mRNA_store', 'B mRNA')\n", + "\n", + "B mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('mRNA_store', 'B mRNA')\n", + "\n", + "\n", + "\n", + "\n", + "('event_process',)\n", + "\n", + "event_process\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('interval_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('DNA_store',)\n", + "\n", + "DNA_store\n", + "\n", + "\n", + "\n", + "('DNA_store', 'A gene')\n", + "\n", + "A gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'A gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store', 'B gene')\n", + "\n", + "B gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'B gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('event_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('interval_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('event_process',)->('event_process', 'interval')\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b.visualize()" + ] + }, + { + "cell_type": "markdown", + "id": "ed3131ee-c607-42e5-88a3-930a84eedf0f", + "metadata": {}, + "source": [ + "### check current Builder config" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "6e00749f-03b8-496e-9a10-106dbac3713f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Builder({ 'DNA_store': {'A gene': 0.0, 'B gene': 0.0},\n", + " 'event_process': { '_type': 'process',\n", + " 'address': 'local:GillespieEvent',\n", + " 'config': {'kdeg': 1.0, 'ktsc': 5.0},\n", + " 'inputs': {'DNA': ['DNA_store'], 'mRNA': ['mRNA_store']},\n", + " 'instance': ,\n", + " 'interval': 1.0,\n", + " 'outputs': {'mRNA': ['mRNA_store']}},\n", + " 'interval_process': { '_type': 'step',\n", + " 'address': 'local:GillespieInterval',\n", + " 'config': {'kdeg': 0.1, 'ktsc': 5.0},\n", + " 'inputs': { 'DNA': ['DNA_store'],\n", + " 'mRNA': ['mRNA_store']},\n", + " 'instance': ,\n", + " 'outputs': {'interval': ['event_process', 'interval']}},\n", + " 'mRNA_store': {}})" + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b" + ] + }, + { + "cell_type": "markdown", + "id": "9fd708e8-0688-4b97-a50c-e3d0a1c78d83", + "metadata": {}, + "source": [ + "## Update the initial state" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "212f4501-8050-4c39-88b8-986b3c38e716", + "metadata": {}, + "outputs": [], + "source": [ + "initial_state = {\n", + " 'DNA_store': {\n", + " 'A gene': 2.0,\n", + " 'B gene': 1.0},\n", + "}\n", + "b.update(initial_state)" + ] + }, + { + "cell_type": "markdown", + "id": "305582d1-f701-4a55-88a3-f8ec21643033", + "metadata": {}, + "source": [ + "## Generate composite from builder config and simulate" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "e9a69f36-154c-416e-b00c-5df0726be49e", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "produced interval: {'interval': 1.21174311488629}\n", + "received interval: 1.21174311488629\n", + "produced interval: {'interval': 30.66671505248375}\n" + ] + } + ], + "source": [ + "composite = b.generate()\n", + "composite.run(10)" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "578492a9-027d-4c5b-b90a-7d63e3f46bc0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "composite" + ] + }, + { + "cell_type": "markdown", + "id": "743960b7-a6d3-41af-8737-2776a66c60cd", + "metadata": {}, + "source": [ + "## Retrieve the composite document" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "c975aab012b2706f", + "metadata": { + "ExecuteTime": { + "start_time": "2024-01-21T21:29:21.999855Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'event_process': {'_type': 'process',\n", + " 'address': 'local:GillespieEvent',\n", + " 'config': {'kdeg': 1.0, 'ktsc': 5.0},\n", + " 'inputs': {'mRNA': ['mRNA_store'], 'DNA': ['DNA_store']},\n", + " 'outputs': {'mRNA': ['mRNA_store']},\n", + " 'interval': 1.0},\n", + " 'mRNA_store': {'A mRNA': '1.0', 'B mRNA': '1.0'},\n", + " 'DNA_store': {'A gene': '2.0', 'B gene': '1.0'},\n", + " 'interval_process': {'_type': 'step',\n", + " 'address': 'local:GillespieInterval',\n", + " 'config': {'ktsc': 5.0, 'kdeg': 0.1},\n", + " 'inputs': {'DNA': ['DNA_store'], 'mRNA': ['mRNA_store']},\n", + " 'outputs': {'interval': ['event_process', 'interval']}},\n", + " 'global_time': '0.0'}" + ] + }, + "execution_count": 22, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "doc = b.document()\n", + "doc" + ] + }, + { + "cell_type": "markdown", + "id": "b32a13ed-134d-4de1-a1ed-b72807b4af45", + "metadata": {}, + "source": [ + "### save the document to file" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "752e43636bf9fd17", + "metadata": { + "ExecuteTime": { + "start_time": "2024-01-21T21:29:22.001078Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "File 'toy_bigraph' successfully written in 'out' directory.\n" + ] + } + ], + "source": [ + "b.write(filename='toy_bigraph')" + ] + }, + { + "cell_type": "markdown", + "id": "ebdd7599-0b0e-4f79-a8ab-d507a81646d8", + "metadata": { + "ExecuteTime": { + "start_time": "2024-01-21T21:29:22.001943Z" + }, + "collapsed": false, + "jupyter": { + "outputs_hidden": false + } + }, + "source": [ + "### load a composite from document\n", + "This document represents the full state of the composite, and so can reproduce the previous composite when loaded into a fresh Builder" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "56b14beb-27de-469d-b4e6-10fc628e15e0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Builder({ 'DNA_store': {'A gene': '2.0', 'B gene': '1.0'},\n", + " 'event_process': { '_type': 'process',\n", + " 'address': 'local:GillespieEvent',\n", + " 'config': {'kdeg': 1.0, 'ktsc': 5.0},\n", + " 'inputs': {'DNA': ['DNA_store'], 'mRNA': ['mRNA_store']},\n", + " 'instance': ,\n", + " 'interval': 1.0,\n", + " 'outputs': {'mRNA': ['mRNA_store']}},\n", + " 'global_time': '0.0',\n", + " 'interval_process': { '_type': 'step',\n", + " 'address': 'local:GillespieInterval',\n", + " 'config': {'kdeg': 0.1, 'ktsc': 5.0},\n", + " 'inputs': { 'DNA': ['DNA_store'],\n", + " 'mRNA': ['mRNA_store']},\n", + " 'instance': ,\n", + " 'outputs': {'interval': ['event_process', 'interval']}},\n", + " 'mRNA_store': {'A mRNA': '1.0', 'B mRNA': '1.0'}})" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b2 = Builder(core=core, file_path='out/toy_bigraph.json')\n", + "b2" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "6197f4c3-41ca-468b-929f-cc0ebc1fabe9", + "metadata": {}, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "bigraph\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('interval_process',)\n", + "\n", + "interval_process\n", + "\n", + "\n", + "\n", + "('event_process', 'interval')->('interval_process',)\n", + "\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('mRNA_store',)\n", + "\n", + "mRNA_store\n", + "\n", + "\n", + "\n", + "('mRNA_store', 'A mRNA')\n", + "\n", + "A mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('mRNA_store', 'A mRNA')\n", + "\n", + "\n", + "\n", + "\n", + "('mRNA_store', 'B mRNA')\n", + "\n", + "B mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('mRNA_store', 'B mRNA')\n", + "\n", + "\n", + "\n", + "\n", + "('event_process',)\n", + "\n", + "event_process\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('event_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('mRNA_store',)->('interval_process',)\n", + "\n", + "\n", + "mRNA\n", + "\n", + "\n", + "\n", + "('DNA_store',)\n", + "\n", + "DNA_store\n", + "\n", + "\n", + "\n", + "('DNA_store', 'A gene')\n", + "\n", + "A gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'A gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store', 'B gene')\n", + "\n", + "B gene\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('DNA_store', 'B gene')\n", + "\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('event_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('DNA_store',)->('interval_process',)\n", + "\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('event_process',)->('event_process', 'interval')\n", + "\n", + "\n", + "\n", + "\n" + ], + "text/plain": [ + "" + ] + }, + "execution_count": 27, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "b2.visualize()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6c11fc1f-23ee-45e5-9975-f3d3b2e1dff9", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.13" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/pyproject.toml b/pyproject.toml index 6ae2a8c25..0ea0ad851 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ numpy = "*" # "^1.26.4" copasi-basico = "*" cobra = "*" tellurium = "*" -smoldyn = ">=2.72" +#smoldyn = ">=2.72" bigraph-viz = ">=0.0.31" bigraph-builder = ">=0.0.4" python-libsbml = "^5.20.2" diff --git a/setup.py b/setup.py index a7ea0c5b8..27636aed3 100644 --- a/setup.py +++ b/setup.py @@ -54,6 +54,7 @@ "jupyterlab", "notebook", "bigraph-viz", + "bigraph-builder", "python-libsbml" # ==5.20.2", "docker>=7.0", "python-libnuml==1.1.6" # ">=1.0.0"