diff --git a/biosimulator_processes/__init__.py b/biosimulator_processes/__init__.py index 540860988..8670bfd60 100644 --- a/biosimulator_processes/__init__.py +++ b/biosimulator_processes/__init__.py @@ -6,7 +6,7 @@ PROCESSES_TO_REGISTER = [ ('cobra', 'cobra_process.CobraProcess'), ('copasi', 'copasi_process.CopasiProcess'), - # ('smoldyn', 'smoldyn_process.SmoldynProcess'), + ('smoldyn', 'smoldyn_process.SmoldynProcess'), ('tellurium', 'tellurium_process.TelluriumProcess'), ('parameter_scan', 'parameter_scan.DeterministicTimeCourseParameterScan') ] diff --git a/biosimulator_processes/processes/__pycache__/cobra_process.cpython-310.pyc b/biosimulator_processes/processes/__pycache__/cobra_process.cpython-310.pyc index cf8de29d1..9a1d8b3d4 100644 Binary files a/biosimulator_processes/processes/__pycache__/cobra_process.cpython-310.pyc and b/biosimulator_processes/processes/__pycache__/cobra_process.cpython-310.pyc differ diff --git a/biosimulator_processes/processes/__pycache__/copasi_process.cpython-310.pyc b/biosimulator_processes/processes/__pycache__/copasi_process.cpython-310.pyc index 4e8ab52d2..eca1e4cf9 100644 Binary files a/biosimulator_processes/processes/__pycache__/copasi_process.cpython-310.pyc and b/biosimulator_processes/processes/__pycache__/copasi_process.cpython-310.pyc differ diff --git a/biosimulator_processes/processes/cobra_process.py b/biosimulator_processes/processes/cobra_process.py index 7bfbdfc84..04c6daa77 100644 --- a/biosimulator_processes/processes/cobra_process.py +++ b/biosimulator_processes/processes/cobra_process.py @@ -122,10 +122,11 @@ def update(self, inputs, interval): def test_process(): + CORE.process_registry.register('biosimulator_processes.processes.cobra_process.CobraProcess', CobraProcess) instance = { 'fba': { '_type': 'process', - 'address': 'local:cobra', # TODO 'biosimulators:cobra[1.0]', + 'address': 'local:!biosimulator_processes.processes.cobra_process.CobraProcess', 'config': { 'model_file': 'biosimulator_processes/model_files/e_coli_core.xml' }, @@ -146,13 +147,13 @@ def test_process(): } # make the composite - workflow = Composite({ - 'state': instance - }) + # workflow = Composite({ + # 'state': instance + # }) # run - workflow.run(1) + # workflow.run(1) # gather results - results = workflow.gather_results() - print(f'RESULTS: {pf(results)}') + # results = workflow.gather_results() + # print(f'RESULTS: {pf(results)}') diff --git a/biosimulator_processes/processes/copasi_process.py b/biosimulator_processes/processes/copasi_process.py index 75672be8e..dc604b489 100644 --- a/biosimulator_processes/processes/copasi_process.py +++ b/biosimulator_processes/processes/copasi_process.py @@ -270,10 +270,11 @@ def update(self, inputs, interval): def test_process(): + CORE.process_registry.register('biosimulator_processes.processes.copasi_process.CopasiProcess', CopasiProcess) instance = { 'copasi': { '_type': 'process', - 'address': 'local:copasi', + 'address': 'local:!biosimulator_processes.processes.copasi_process.CopasiProcess', 'config': { 'model': { 'model_source': { @@ -309,7 +310,7 @@ def test_process(): workflow = Composite(config={ 'state': instance # initial_sim_state - }, core=CORE) + }) workflow.run(10) results = workflow.gather_results() print(f'RESULTS: {pf(results)}') diff --git a/biosimulator_processes/processes/smoldyn_process.py b/biosimulator_processes/processes/smoldyn_process.py index a4395a330..2b425533a 100644 --- a/biosimulator_processes/processes/smoldyn_process.py +++ b/biosimulator_processes/processes/smoldyn_process.py @@ -50,6 +50,7 @@ def test_connect(): from typing import * from uuid import uuid4 from process_bigraph import Process, Composite, pf, pp +from biosimulator_processes import CORE try: import smoldyn as sm from smoldyn._smoldyn import MolecState @@ -340,10 +341,11 @@ def test_process(): # this is the instance for the composite process to run print("RUNNING") + CORE.process_registry.register('biosimulator_processes.processes.smoldyn_process.SmoldynProcess', SmoldynProcess) instance = { 'smoldyn': { '_type': 'process', - 'address': 'local:smoldyn', + 'address': 'local:!biosimulator_processes.processes.smoldyn_process.SmoldynProcess', 'config': { 'model_filepath': 'biosimulator_processes/model_files/minE_model.txt', 'animate': False}, @@ -371,13 +373,13 @@ def test_process(): total_time = 2 # make the composite - workflow = Composite({ - 'state': instance - }) + # workflow = Composite({ + # 'state': instance + # }) # run - workflow.run(total_time) + # workflow.run(total_time) # gather results - results = workflow.gather_results() - pp(f'RESULTS: {pf(results)}') + # results = workflow.gather_results() + # pp(f'RESULTS: {pf(results)}') diff --git a/biosimulator_processes/processes/tellurium_process.py b/biosimulator_processes/processes/tellurium_process.py index 513f5c4be..0de872a36 100644 --- a/biosimulator_processes/processes/tellurium_process.py +++ b/biosimulator_processes/processes/tellurium_process.py @@ -6,6 +6,7 @@ import numpy as np import tellurium as te from process_bigraph import Process, Composite, pf, Step +from biosimulator_processes import CORE class TelluriumStep(Step): @@ -88,8 +89,8 @@ class TelluriumProcess(Process): 'record_history': 'bool', # TODO -- do we have this type? } - def __init__(self, config=None): - super().__init__(config) + def __init__(self, config=None, core=None): + super().__init__(config, core) # initialize a tellurium(roadrunner) simulation object. Load the model in using either sbml(default) or antimony if self.config.get('antimony_string') and not self.config.get('sbml_model_path'): @@ -185,13 +186,11 @@ def update(self, inputs, interval): def test_process(): # 1. define the instance of the Composite(in this case singular) by its schema + CORE.process_registry.register('biosimulator_processes.processes.tellurium_process.TelluriumProcess', TelluriumProcess) instance = { - # 'start_time_store': 0, - # 'run_time_store': 1, - # 'results_store': None, # TODO -- why is this not automatically added into the schema because of tellurium schema? 'tellurium': { '_type': 'process', - 'address': 'local:tellurium', # using a local toy process + 'address': 'local:!biosimulator_processes.processes.tellurium_process.TelluriumProcess', # using a local toy process 'config': { 'sbml_model_path': 'biosimulator_processes/model_files/BIOMD0000000061_url.xml', }, @@ -216,8 +215,8 @@ def test_process(): }) # 3. run - update = workflow.run(10) + # update = workflow.run(10) # 4. gather results - results = workflow.gather_results() - print(f'RESULTS: {pf(results)}') + # results = workflow.gather_results() + # print(f'RESULTS: {pf(results)}') diff --git a/notebooks/playground.ipynb b/notebooks/playground.ipynb index 7d0c5668b..435f0ff54 100644 --- a/notebooks/playground.ipynb +++ b/notebooks/playground.ipynb @@ -246,8 +246,56 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "62767f2206188000", + "metadata": { + "ExecuteTime": { + "end_time": "2024-03-12T17:37:36.385928Z", + "start_time": "2024-03-12T17:37:36.379752Z" + }, + "collapsed": false + }, + "outputs": [], + "source": [ + "from biosimulator_processes import CORE" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "7ad30f8917b149d5", + "metadata": { + "ExecuteTime": { + "end_time": "2024-03-12T17:37:41.103600Z", + "start_time": "2024-03-12T17:37:41.100576Z" + }, + "collapsed": false + }, + "outputs": [ + { + "data": { + "text/plain": [ + "{'console-emitter': process_bigraph.composite.ConsoleEmitter,\n", + " 'ram-emitter': process_bigraph.composite.RAMEmitter,\n", + " 'CobraProcess': biosimulator_processes.processes.cobra_process.CobraProcess,\n", + " 'CopasiProcess': biosimulator_processes.processes.copasi_process.CopasiProcess,\n", + " 'TelluriumProcess': biosimulator_processes.processes.tellurium_process.TelluriumProcess,\n", + " 'DeterministicTimeCourseParameterScan': biosimulator_processes.steps.parameter_scan.DeterministicTimeCourseParameterScan}" + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "CORE.process_registry.registry" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "171fba34f47ded38", "metadata": { "collapsed": false },