diff --git a/Dockerfile b/Dockerfile index 62451bece..5886321da 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ WORKDIR /app # copy and make dirs COPY ./biosimulator_processes /app/biosimulator_processes -COPY notebooks /app/notebooks +COPY composer-notebooks /app/notebooks # copy files COPY ./pyproject.toml ./poetry.lock ./data ./scripts/trust-notebooks.sh /app/ @@ -51,10 +51,10 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && poetry config virtualenvs.in-project true \ && poetry update \ && poetry install \ - && chmod +x ./trust-notebooks.sh \ + && chmod +x ./trust-composer-notebooks.sh \ && chmod +x /usr/local/bin/enter-lab.sh \ - && ./trust-notebooks.sh \ - && rm ./trust-notebooks.sh \ + && ./trust-composer-notebooks.sh \ + && rm ./trust-composer-notebooks.sh \ && apt-get clean \ && apt-get autoclean diff --git a/biosimulator_processes/data_model/compare_data_model.py b/biosimulator_processes/data_model/compare_data_model.py index 55940a892..8182ab7cd 100644 --- a/biosimulator_processes/data_model/compare_data_model.py +++ b/biosimulator_processes/data_model/compare_data_model.py @@ -1,6 +1,9 @@ from typing import * +__all__ = ['ComparisonDocument'] + + class ComparisonDocument: """To be called 'behind-the-scenes' by the Comparison REST API""" def __init__(self, diff --git a/biosimulator_processes/data_model/sed_data_model.py b/biosimulator_processes/data_model/sed_data_model.py index 341e3ac8d..37cc6acb4 100644 --- a/biosimulator_processes/data_model/sed_data_model.py +++ b/biosimulator_processes/data_model/sed_data_model.py @@ -7,6 +7,8 @@ from biosimulator_processes.data_model import _BaseClass +__all__ = ['SedDataModel'] + @dataclass class SimulationModelParameter(_BaseClass): """ @@ -135,7 +137,7 @@ class SedModel(_BaseClass): model_source: Union[BiomodelID, ModelFilepath, str] model_id: str = None model_name: str = None - model_language: str = 'sbml' + model_language: str = Field(default='sbml') model_changes: ModelChanges = None model_units: ModelUnits = None @@ -198,11 +200,11 @@ class TimeCourseModel(SedModel): Attributes: model_id: `str` model_source: `Union[biosimulator_processes.data_model.ModelFilepath, biosimulator_processes.data_model.BiomodelId]` - model_language: `str` + model_language: `str` defaults to sbml model_name: `str` model_changes: `biosimulator_processes.data_model.TimeCourseModelChanges` """ - model_language: str = None, + model_language: str = 'sbml', model_changes: TimeCourseModelChanges = None, model_units: ModelUnits = None @@ -256,6 +258,7 @@ class TimeCourseProcess(_BaseClass): """Used as config for BioBuilder API""" model: SedModel method: str = 'lsoda' + model_language: str = 'sbml' @dataclass diff --git a/biosimulator_processes/processes/__pycache__/copasi_process.cpython-310.pyc b/biosimulator_processes/processes/__pycache__/copasi_process.cpython-310.pyc index 0eff34cb3..c67ffe912 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/__pycache__/tellurium_process.cpython-310.pyc b/biosimulator_processes/processes/__pycache__/tellurium_process.cpython-310.pyc index 24f9ca257..255a956b8 100644 Binary files a/biosimulator_processes/processes/__pycache__/tellurium_process.cpython-310.pyc and b/biosimulator_processes/processes/__pycache__/tellurium_process.cpython-310.pyc differ diff --git a/biosimulator_processes/processes/copasi_process.py b/biosimulator_processes/processes/copasi_process.py index 3ad8828ac..19b915802 100644 --- a/biosimulator_processes/processes/copasi_process.py +++ b/biosimulator_processes/processes/copasi_process.py @@ -82,12 +82,15 @@ def __init__(self, # Option C: else: if not self.model_changes: - raise AttributeError("You must pass a source of model changes specifying params, reactions, species or all three if starting from an empty model.") + raise AttributeError( + """You must pass a source of model changes specifying params, reactions, + species or all three if starting from an empty model.""") model_units = self.config['model'].get('model_units', {}) self.copasi_model_object = new_model( name='CopasiProcess TimeCourseModel', **model_units) + # handle context of species output context_type = self.config['species_context'] self.species_context_key = f'floating_species_{context_type}' self.use_counts = 'concentrations' in context_type @@ -131,8 +134,8 @@ def __init__(self, # Get the species (floating only) TODO: add boundary species species_data = get_species(model=self.copasi_model_object) self.floating_species_list = species_data.index.tolist() - self.floating_species_initial = species_data.concentration.tolist() \ - if 'concentrations' in self.config['species_context'] else species_data.particle_number.tolist() + self.floating_species_initial = species_data.particle_number.tolist() \ + if self.use_counts else species_data.concentration.tolist() # ----GLOBAL PARAMS: set global parameter changes global_parameter_changes = self.model_changes.get('global_parameter_changes', []) @@ -154,9 +157,10 @@ def __init__(self, # Get the list of parameters and their values (it is possible to run a model without any parameters) model_parameters = get_parameters(model=self.copasi_model_object) - - self.model_parameters_list = model_parameters.index.tolist() if isinstance(model_parameters, DataFrame) else [] - self.model_parameters_values = model_parameters.initial_value.tolist() if isinstance(model_parameters, DataFrame) else [] + self.model_parameters_list = model_parameters.index.tolist() \ + if isinstance(model_parameters, DataFrame) else [] + self.model_parameters_values = model_parameters.initial_value.tolist() \ + if isinstance(model_parameters, DataFrame) else [] # Get a list of compartments self.compartments_list = get_compartments(model=self.copasi_model_object).index.tolist() @@ -236,14 +240,31 @@ def update(self, inputs, interval): # extract end values of concentrations from the model and set them in results results = {'time': interval} - measurement_type = 'particle_number' if self.use_counts else 'concentration' - results[self.species_context_key] = { - mol_id: float(get_species( + for mol_id in self.floating_species_list: + raw_mol_data = get_species( name=mol_id, exact=True, - model=self.copasi_model_object - )[measurement_type][0]) - for mol_id in self.floating_species_list - } + model=self.copasi_model_object) + + mol_data = raw_mol_data.particle_number[0] if self.use_counts else raw_mol_data.concentration[0] + results[self.species_context_key] = { + mol_id: float(mol_data) + } + """if self.use_counts: + results[self.species_context_key] = { + mol_id: float(get_species( + name=mol_id, + exact=True, + model=self.copasi_model_object + ).particle_number[0]) + for mol_id in self.floating_species_list} + else: + results[self.species_context_key] = { + mol_id: float(get_species( + name=mol_id, + exact=True, + model=self.copasi_model_object + ).concentration[0]) + for mol_id in self.floating_species_list}""" return results diff --git a/biosimulator_processes/steps/viz.py b/biosimulator_processes/steps/viz.py index 193cc88fe..533f835f9 100644 --- a/biosimulator_processes/steps/viz.py +++ b/biosimulator_processes/steps/viz.py @@ -24,7 +24,7 @@ def parse_composition_results(composition: Composite) -> Dict[float, Dict[str, U float(n) for n in range(int(composition.state['global_time']) + 1) # python ranges are not as they appear ;) ] - assert len(timescale) == len(result_vals) # internal check: is there a better way to perform the check? + assert len(timescale) == len(result_vals) # src check: is there a better way to perform the check? return dict(zip(timescale, result_vals)) diff --git a/biosimulator_processes/tests/test_copasi_process.py b/biosimulator_processes/tests/test_copasi_process.py index 756460a6b..bfd23603c 100644 --- a/biosimulator_processes/tests/test_copasi_process.py +++ b/biosimulator_processes/tests/test_copasi_process.py @@ -54,7 +54,7 @@ def test_process(): def test_process_from_document(): # read the document from local file: - five_process_fp = 'notebooks/out/five_process_composite.json' + five_process_fp = 'composer-notebooks/out/five_process_composite.json' with open(five_process_fp, 'r') as fp: instance = json.load(fp) diff --git a/biosimulator_processes/utils.py b/biosimulator_processes/utils.py index d07c4d0a5..ec201805e 100644 --- a/biosimulator_processes/utils.py +++ b/biosimulator_processes/utils.py @@ -330,7 +330,7 @@ def fix_execution_count(notebook_path): def fix_notebooks_execution_count(): - for root, _, files in os.walk('../notebooks'): + for root, _, files in os.walk('../composer-notebooks'): for _file in files: notebook_path = os.path.join(root, _file) fix_execution_count(notebook_path) diff --git a/compare_api/main.py b/compare_api/main.py index aa08d0cd4..af9cc40f5 100644 --- a/compare_api/main.py +++ b/compare_api/main.py @@ -6,7 +6,7 @@ from fastapi import FastAPI, HTTPException, Query, File, UploadFile from fastapi.middleware.cors import CORSMiddleware from compare_api.datamodel import SimulatorComparisonResult, CompositeRunError -from compare_api.internal.composite_doc import create_comparison_document, generate_workflow, run_workflow +from compare_api.src.composite_doc import create_comparison_document, generate_workflow, run_workflow # logger for this module logger = logging.getLogger(__name__) diff --git a/compare_api/internal/__init__.py b/compare_api/src/__init__.py similarity index 100% rename from compare_api/internal/__init__.py rename to compare_api/src/__init__.py diff --git a/compare_api/internal/composite_doc.py b/compare_api/src/composite_doc.py similarity index 100% rename from compare_api/internal/composite_doc.py rename to compare_api/src/composite_doc.py diff --git a/compare_api/internal/openapi_spec.py b/compare_api/src/openapi_spec.py similarity index 100% rename from compare_api/internal/openapi_spec.py rename to compare_api/src/openapi_spec.py diff --git a/notebooks/cobra_process_composer.ipynb b/composer-notebooks/cobra_process_composer.ipynb similarity index 100% rename from notebooks/cobra_process_composer.ipynb rename to composer-notebooks/cobra_process_composer.ipynb diff --git a/notebooks/copasi_process_composer.ipynb b/composer-notebooks/copasi_process_composer.ipynb similarity index 100% rename from notebooks/copasi_process_composer.ipynb rename to composer-notebooks/copasi_process_composer.ipynb diff --git a/notebooks/out/'my_first_composition'.json b/composer-notebooks/out/'my_first_composition'.json similarity index 100% rename from notebooks/out/'my_first_composition'.json rename to composer-notebooks/out/'my_first_composition'.json diff --git a/notebooks/out/2_process_composition.json b/composer-notebooks/out/2_process_composition.json similarity index 100% rename from notebooks/out/2_process_composition.json rename to composer-notebooks/out/2_process_composition.json diff --git a/notebooks/out/BUILD_FLUSH_2024-03-15__16_00_11.649347.json b/composer-notebooks/out/BUILD_FLUSH_2024-03-15__16_00_11.649347.json similarity index 100% rename from notebooks/out/BUILD_FLUSH_2024-03-15__16_00_11.649347.json rename to composer-notebooks/out/BUILD_FLUSH_2024-03-15__16_00_11.649347.json diff --git a/notebooks/out/copasi-doc.json b/composer-notebooks/out/copasi-doc.json similarity index 100% rename from notebooks/out/copasi-doc.json rename to composer-notebooks/out/copasi-doc.json diff --git a/notebooks/out/demo_single_process_composite.json b/composer-notebooks/out/demo_single_process_composite.json similarity index 100% rename from notebooks/out/demo_single_process_composite.json rename to composer-notebooks/out/demo_single_process_composite.json diff --git a/notebooks/out/demo_tumor_control_composite.json b/composer-notebooks/out/demo_tumor_control_composite.json similarity index 100% rename from notebooks/out/demo_tumor_control_composite.json rename to composer-notebooks/out/demo_tumor_control_composite.json diff --git a/notebooks/out/five_process_composite.json b/composer-notebooks/out/five_process_composite.json similarity index 100% rename from notebooks/out/five_process_composite.json rename to composer-notebooks/out/five_process_composite.json diff --git a/notebooks/out/simple_demo_single_process_composition.json b/composer-notebooks/out/simple_demo_single_process_composition.json similarity index 100% rename from notebooks/out/simple_demo_single_process_composition.json rename to composer-notebooks/out/simple_demo_single_process_composition.json diff --git a/notebooks/out/simple_lsoda.json b/composer-notebooks/out/simple_lsoda.json similarity index 100% rename from notebooks/out/simple_lsoda.json rename to composer-notebooks/out/simple_lsoda.json diff --git a/notebooks/out/simple_single_demo.json b/composer-notebooks/out/simple_single_demo.json similarity index 100% rename from notebooks/out/simple_single_demo.json rename to composer-notebooks/out/simple_single_demo.json diff --git a/notebooks/out/single_lsoda.json b/composer-notebooks/out/single_lsoda.json similarity index 100% rename from notebooks/out/single_lsoda.json rename to composer-notebooks/out/single_lsoda.json diff --git a/notebooks/playground.ipynb b/composer-notebooks/playground.ipynb similarity index 100% rename from notebooks/playground.ipynb rename to composer-notebooks/playground.ipynb diff --git a/notebooks/smoldyn_process_composer.ipynb b/composer-notebooks/smoldyn_process_composer.ipynb similarity index 100% rename from notebooks/smoldyn_process_composer.ipynb rename to composer-notebooks/smoldyn_process_composer.ipynb diff --git a/notebooks/tellurium_process_composer.ipynb b/composer-notebooks/tellurium_process_composer.ipynb similarity index 100% rename from notebooks/tellurium_process_composer.ipynb rename to composer-notebooks/tellurium_process_composer.ipynb diff --git a/demos/__init__.py b/demos/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/demos/biolab_api_demo.ipynb b/demos/biolab_api_demo.ipynb new file mode 100644 index 000000000..6ca265e2e --- /dev/null +++ b/demos/biolab_api_demo.ipynb @@ -0,0 +1,652 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "8087f67dcdaefdee", + "metadata": { + "collapsed": false + }, + "source": [ + "# BioLab API Demo (BioLab container)" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "c253d92e47737dd9", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:49.375459Z", + "start_time": "2024-05-01T18:23:49.229821Z" + } + }, + "outputs": [], + "source": [ + "# TODO: create sep repo and pypi for data model so that you can install it and import like `import sed_data as sed`" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "initial_id", + "metadata": { + "collapsed": true, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:49.375680Z", + "start_time": "2024-05-01T18:23:49.234219Z" + } + }, + "outputs": [], + "source": [ + "import sys\n", + "import os\n", + "\n", + "sys.path.insert(0, '..')" + ] + }, + { + "cell_type": "markdown", + "id": "572ce5fd9c49efcb", + "metadata": { + "collapsed": false + }, + "source": [ + "#### **_Experiment 1_**: Here we cross a boundary in the stack that is a biological simulation. We go from model configuration, to experiment. Thus, this tooling sits at that level: both experiment specification AND experiment execution. It's not just a way to specify an experiment, but it is also a way to run it, given the many knobs and buttons that you can use predefine and customize the way the actual model is being solved. Our users are seeking to be involved in an experiment as a \"stack\". We should make a bigger distinction between terms like \"model\"." + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "e3218a2629726818", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:51.747571Z", + "start_time": "2024-05-01T18:23:49.237895Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "CobraProcess registered successfully.\n", + "CopasiProcess registered successfully.\n", + "SmoldynProcess not available. Error: \n", + "PLEASE NOTE: Smoldyn is not correctly installed on your system which prevents you from using the SmoldynProcess. Please refer to the README for further information on installing Smoldyn.\n", + "TelluriumProcess registered successfully.\n" + ] + } + ], + "source": [ + "from process_bigraph import pp\n", + "from biosimulator_processes.biosimulator_builder import BuildPrompter\n", + "from biosimulator_processes.data_model.sed_data_model import SedDataModel as sed " + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "871b58285775fb24", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:52.256123Z", + "start_time": "2024-05-01T18:23:51.745806Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "TimeCourseModel(model_source='BIOMD0000000749',\n", + " model_id='model_from_BIOMD0000000749',\n", + " model_name='model_from_BIOMD0000000749',\n", + " model_language=(None,),\n", + " model_changes=None,\n", + " model_units=None)\n" + ] + } + ], + "source": [ + "# 1a. define a model for the process composition. In this case, just one model to be re-used as configuration for the processes we create:\n", + "tumor_control_biomodel_id = 'BIOMD0000000749'\n", + "simple_tc_model = sed.TimeCourseModel(model_source=tumor_control_biomodel_id)\n", + "\n", + "pp(simple_tc_model)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "1519914d8b9a85ce", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:52.257772Z", + "start_time": "2024-05-01T18:23:52.254603Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{ 'description': 'The paper describes a model of tumor control via alternating '\n", + " 'immunostimulating and immunosuppressive phases. \\r\\n'\n", + " 'Created by COPASI 4.25 (Build 207) \\r\\n'\n", + " '\\r\\n'\n", + " 'This model is described in the article: \\r\\n'\n", + " 'In silico tumor control induced via alternating '\n", + " 'immunostimulating and immunosuppressive phases\\r\\n'\n", + " 'AI Reppas, JCL Alfonso, and H Hatzikirou\\r\\n'\n", + " 'Virulence 7:2, 174--186\\r\\n'\n", + " '\\r\\n'\n", + " 'Abstract: \\r\\n'\n", + " 'Despite recent advances in the field of Oncoimmunology, the '\n", + " 'success potential of immunomodulatory therapies against '\n", + " 'cancer remains to be elucidated. One of the reasons is the '\n", + " 'lack of understanding on the complex interplay between tumor '\n", + " 'growth dynamics and the associated immune system responses. '\n", + " 'Toward this goal, we consider a mathematical model of '\n", + " 'vascularized tumor growth and the corresponding effector '\n", + " 'cell recruitment dynamics. Bifurcation analysis allows for '\n", + " 'the exploration of model’s dynamic behavior and the '\n", + " 'determination of these parameter regimes that result in '\n", + " 'immune-mediated tumor control. In this work, we focus on a '\n", + " 'particular tumor evasion regime that involves tumor and '\n", + " 'effector cell concentration oscillations of slowly '\n", + " 'increasing and decreasing amplitude, respectively. '\n", + " 'Considering a temporal multiscale analysis, we derive an '\n", + " 'analytically tractable mapping of model solutions onto a '\n", + " 'weakly negatively damped harmonic oscillator. Based on our '\n", + " 'analysis, we propose a theory-driven intervention strategy '\n", + " 'involving immunostimulating and immunosuppressive phases to '\n", + " 'induce long-term tumor control.\\r\\n'\n", + " '\\r\\n'\n", + " 'To cite BioModels Database, please use: BioModels Database: '\n", + " 'An enhanced, curated and annotated resource for published '\n", + " 'quantitative kinetic models . \\r\\n'\n", + " 'To the extent possible under law, all copyright and related '\n", + " 'or neighbouring rights to this encoded model have been '\n", + " 'dedicated to the public domain worldwide. \\r\\n'\n", + " 'Please refer to CC0 Public Domain Dedication for more '\n", + " 'information.',\n", + " 'files': { 'additional': [ { 'description': 'Auto-generated SEDML file',\n", + " 'fileSize': '2191',\n", + " 'name': 'Reppas2015.sedml'},\n", + " { 'description': 'CPS file of the model in COPASI',\n", + " 'fileSize': '81326',\n", + " 'name': 'Reppas2015.cps'}],\n", + " 'main': [{'fileSize': '62675', 'name': 'Reppas2015.xml'}]},\n", + " 'firstPublished': 1562858819000,\n", + " 'format': {'name': 'SBML', 'version': 'L3V1'},\n", + " 'history': { 'revisions': [ { 'comment': 'Edited model metadata online.',\n", + " 'submitted': 1562858737000,\n", + " 'submitter': 'Jinghao Men',\n", + " 'version': 2},\n", + " { 'comment': 'Automatically added model '\n", + " 'identifier BIOMD0000000749',\n", + " 'submitted': 1562858822000,\n", + " 'submitter': 'Jinghao Men',\n", + " 'version': 3}]},\n", + " 'name': 'Reppas2015 - tumor control via alternating immunostimulating and '\n", + " 'immunosuppressive phases',\n", + " 'publication': { 'affiliation': 'a Center for Advancing Electronics; '\n", + " 'Technische Universität Dresden ; Dresden , '\n", + " 'Germany.',\n", + " 'authors': [ {'name': 'Reppas AI'},\n", + " {'name': 'Alfonso JC'},\n", + " { 'name': 'Hatzikirou H',\n", + " 'orcid': '0000-0002-1270-7885'}],\n", + " 'issue': '2',\n", + " 'journal': 'Virulence',\n", + " 'link': 'http://identifiers.org/pubmed/26305801',\n", + " 'month': '1',\n", + " 'pages': '174-186',\n", + " 'synopsis': 'Despite recent advances in the field of '\n", + " 'Oncoimmunology, the success potential of '\n", + " 'immunomodulatory therapies against cancer '\n", + " 'remains to be elucidated. One of the reasons '\n", + " 'is the lack of understanding on the complex '\n", + " 'interplay between tumor growth dynamics and '\n", + " 'the associated immune system responses. Toward '\n", + " 'this goal, we consider a mathematical model of '\n", + " 'vascularized tumor growth and the '\n", + " 'corresponding effector cell recruitment '\n", + " 'dynamics. Bifurcation analysis allows for the '\n", + " \"exploration of model's dynamic behavior and \"\n", + " 'the determination of these parameter regimes '\n", + " 'that result in immune-mediated tumor control. '\n", + " 'In this work, we focus on a particular tumor '\n", + " 'evasion regime that involves tumor and '\n", + " 'effector cell concentration oscillations of '\n", + " 'slowly increasing and decreasing amplitude, '\n", + " 'respectively. Considering a temporal '\n", + " 'multiscale analysis, we derive an analytically '\n", + " 'tractable mapping of model solutions onto a '\n", + " 'weakly negatively damped harmonic oscillator. '\n", + " 'Based on our analysis, we propose a '\n", + " 'theory-driven intervention strategy involving '\n", + " 'immunostimulating and immunosuppressive phases '\n", + " 'to induce long-term tumor control.',\n", + " 'title': 'In silico tumor control induced via alternating '\n", + " 'immunostimulating and immunosuppressive phases.',\n", + " 'volume': '7',\n", + " 'year': 2016},\n", + " 'publicationId': 'BIOMD0000000749',\n", + " 'submissionId': 'MODEL1907110002'}\n" + ] + } + ], + "source": [ + "# 1b. view model info for model source:\n", + "\n", + "pp(simple_tc_model.source_info)" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "a30f5e94167513c9", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:52.266338Z", + "start_time": "2024-05-01T18:23:52.258070Z" + } + }, + "outputs": [], + "source": [ + "# 1c. define a TimeCourse process instance using the above object as a parameter. The other parameter is method. See BasiCO documentation for more details on solvers\n", + "\n", + "simple_tc_process = sed.TimeCourseProcess(model=simple_tc_model, method='lsoda')" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "a9c15126dda87970", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:52.266655Z", + "start_time": "2024-05-01T18:23:52.261921Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "TimeCourseProcess(model=TimeCourseModel(model_source='BIOMD0000000749',\n", + " model_id='model_from_BIOMD0000000749',\n", + " model_name='model_from_BIOMD0000000749',\n", + " model_language=(None,),\n", + " model_changes=None,\n", + " model_units=None),\n", + " method='lsoda',\n", + " model_language='sbml')\n" + ] + } + ], + "source": [ + "# >> The process model instance is viewable as a dataclass...\n", + "\n", + "pp(simple_tc_process)" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "ba3d6e8bae50f216", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:52.268987Z", + "start_time": "2024-05-01T18:23:52.265517Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{ 'method': 'lsoda',\n", + " 'model': { 'model_changes': None,\n", + " 'model_id': 'model_from_BIOMD0000000749',\n", + " 'model_language': (None,),\n", + " 'model_name': 'model_from_BIOMD0000000749',\n", + " 'model_source': 'BIOMD0000000749',\n", + " 'model_units': None},\n", + " 'model_language': 'sbml'}\n" + ] + } + ], + "source": [ + "# >> ...or a dict:\n", + "\n", + "pp(simple_tc_process.to_dict())" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "f6d099ae829fb063", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:52.319339Z", + "start_time": "2024-05-01T18:23:52.269208Z" + } + }, + "outputs": [], + "source": [ + "# 2. instantiate the prompter:\n", + "\n", + "prompter = BuildPrompter()" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "6ff0228586348da1", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:59.152054Z", + "start_time": "2024-05-01T18:23:52.273445Z" + } + }, + "outputs": [ + { + "ename": "AttributeError", + "evalue": "'BiosimulatorBuilder' object has no attribute 'get_pydantic_model'", + "output_type": "error", + "traceback": [ + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mAttributeError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[0;32mIn[10], line 3\u001B[0m\n\u001B[1;32m 1\u001B[0m \u001B[38;5;66;03m# 3. add process(es) to the bigraph with the Time Course model instance we created above. For now, just one process will be added.\u001B[39;00m\n\u001B[0;32m----> 3\u001B[0m \u001B[43mprompter\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43madd_single_process\u001B[49m\u001B[43m(\u001B[49m\u001B[43mconfig\u001B[49m\u001B[38;5;241;43m=\u001B[39;49m\u001B[43msimple_tc_process\u001B[49m\u001B[43m)\u001B[49m\n", + "File \u001B[0;32m~/Desktop/uchc_work/repos/biosimulator-processes/notebooks/../biosimulator_processes/biosimulator_builder.py:78\u001B[0m, in \u001B[0;36mBuildPrompter.add_single_process\u001B[0;34m(self, builder, process_type, config, builder_node_name)\u001B[0m\n\u001B[1;32m 75\u001B[0m builder_node_name \u001B[38;5;241m=\u001B[39m \u001B[38;5;28minput\u001B[39m(\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mPlease enter the name that you wish to assign to this process: \u001B[39m\u001B[38;5;124m'\u001B[39m)\n\u001B[1;32m 77\u001B[0m \u001B[38;5;66;03m# generate input data from user prompt results and add processes to the bigraph through pydantic model\u001B[39;00m\n\u001B[0;32m---> 78\u001B[0m DynamicProcessConfig \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mbuilder_instance\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_pydantic_model\u001B[49m(process_type)\n\u001B[1;32m 80\u001B[0m input_kwargs \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mgenerate_input_kwargs() \u001B[38;5;28;01mif\u001B[39;00m config \u001B[38;5;129;01mis\u001B[39;00m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;28;01melse\u001B[39;00m config\u001B[38;5;241m.\u001B[39mto_dict()\n\u001B[1;32m 81\u001B[0m dynamic_config \u001B[38;5;241m=\u001B[39m DynamicProcessConfig(\u001B[38;5;241m*\u001B[39m\u001B[38;5;241m*\u001B[39minput_kwargs)\n", + "\u001B[0;31mAttributeError\u001B[0m: 'BiosimulatorBuilder' object has no attribute 'get_pydantic_model'" + ] + } + ], + "source": [ + "# 3. add process(es) to the bigraph with the Time Course model instance we created above. For now, just one process will be added.\n", + "\n", + "prompter.add_single_process(config=simple_tc_process)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b833c7217603645c", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "end_time": "2024-05-01T18:23:59.157229Z", + "start_time": "2024-05-01T18:23:59.153391Z" + } + }, + "outputs": [], + "source": [ + "# 4. Inspect the builder instance within prompter:\n", + "\n", + "pp(prompter.builder_instance)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "8400f44e3a2e8433", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.155333Z" + } + }, + "outputs": [], + "source": [ + "# 5. Visualize the fully-connected composition:\n", + "\n", + "prompter.visualize_bigraph()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "38052757b3b95baa", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.156753Z" + } + }, + "outputs": [], + "source": [ + "# 6. Generate a composite engine and use to execute the bigraph that we just created:\n", + "\n", + "prompter.run()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "45ae5b121110cdce", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.158776Z" + } + }, + "outputs": [], + "source": [ + "# 7. Clear the builder and start from scratch, writing it out first:\n", + "\n", + "prompter.flush(fp='simple_single_demo')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "79fbea4fa6708088", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.160556Z" + } + }, + "outputs": [], + "source": [ + "prompter.builder_instance" + ] + }, + { + "cell_type": "markdown", + "id": "b65a6fab79ad097c", + "metadata": { + "collapsed": false + }, + "source": [ + "#### **_Experiment 2_**: Load an SBML model from a specified model filepath and add Model changes to the composite before adding it to the bigraph. Here, we expect the user to be familiar enough with the model file they are passing to make individual species/parameter/reaction changes for specific species types. In the Caravagna model, for example, the species involved are T, E, I. Let's change the initial concentration for some of these as an example of model changes:" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "89739e0302d6b89a", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.162011Z" + } + }, + "outputs": [], + "source": [ + "caravagna_model_filepath = '../biosimulator_processes/model_files/Caravagna2010.xml'\n", + "print(os.path.exists(caravagna_model_filepath))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "55e063c857e51f3", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.163295Z" + } + }, + "outputs": [], + "source": [ + "# first make the timecourse model which is easily configured with objects related to model changes\n", + "adjusted_tc_model_from_file = sed.TimeCourseModel(\n", + " model_source=caravagna_model_filepath, \n", + " model_changes=sed.TimeCourseModelChanges(\n", + " species_changes=sed.SpeciesChange(species_name='T', initial_concentration=0.234)\n", + " )\n", + ")\n", + "\n", + "\n", + "pp(adjusted_tc_model_from_file)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "c1ddec005282e13f", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.164702Z" + } + }, + "outputs": [], + "source": [ + "adjusted_tc_process = sed.TimeCourseProcess(model=adjusted_tc_model_from_file, method='stochastic')\n", + "\n", + "pp(adjusted_tc_process)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "32b4be407a09f96", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.165980Z" + } + }, + "outputs": [], + "source": [ + "# add the process we just created with the prompter. The prompter will create a new instance of builder for us, if not passed:\n", + "\n", + "prompter.add_single_process(config=adjusted_tc_process)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d0121977a95c320c", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.167039Z" + } + }, + "outputs": [], + "source": [ + "# visualize the adjusted creation\n", + "\n", + "prompter.visualize_bigraph()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "a6e83469c5b8b93d", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.167933Z" + } + }, + "outputs": [], + "source": [ + "# view the builder document\n", + "\n", + "prompter.builder_instance.document()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "121064387d7729b0", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.168771Z" + } + }, + "outputs": [], + "source": [ + "# run the composite\n", + "\n", + "prompter.run()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6918be74a9a99f7d", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.169791Z" + } + }, + "outputs": [], + "source": [ + "# stochastic works with Caravagna!!" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f160008fa3538b5", + "metadata": { + "collapsed": false, + "ExecuteTime": { + "start_time": "2024-05-01T18:23:59.170806Z" + } + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython2", + "version": "2.7.6" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/notebooks/copasi_process.ipynb b/demos/copasi_process_demo.ipynb similarity index 59% rename from notebooks/copasi_process.ipynb rename to demos/copasi_process_demo.ipynb index 7713ea7db..c67890dfc 100644 --- a/notebooks/copasi_process.ipynb +++ b/demos/copasi_process_demo.ipynb @@ -5,11 +5,11 @@ "execution_count": 1, "id": "40898635d17c0f08", "metadata": { + "collapsed": false, "ExecuteTime": { - "end_time": "2024-05-01T08:48:43.729023Z", - "start_time": "2024-05-01T08:48:43.681759Z" - }, - "collapsed": false + "end_time": "2024-05-01T18:42:40.207470Z", + "start_time": "2024-05-01T18:42:40.168717Z" + } }, "outputs": [], "source": [ @@ -26,11 +26,11 @@ "execution_count": 2, "id": "initial_id", "metadata": { + "collapsed": true, "ExecuteTime": { - "end_time": "2024-05-01T08:48:46.722106Z", - "start_time": "2024-05-01T08:48:43.878978Z" - }, - "collapsed": true + "end_time": "2024-05-01T18:42:42.326321Z", + "start_time": "2024-05-01T18:42:40.348211Z" + } }, "outputs": [ { @@ -46,8 +46,6 @@ } ], "source": [ - "from biosimulator_processes.tests.test_copasi_process import test_process_from_document\n", - "from biosimulator_processes.tests.data_model import ProcessUnitTest\n", "from biosimulator_processes.utils import prepare_single_copasi_process_composite_doc\n", "from biosimulator_processes import CORE\n", "from process_bigraph import Composite, pp" @@ -67,22 +65,14 @@ "id": "cf99dc6955ac6f6f", "metadata": { "ExecuteTime": { - "end_time": "2024-05-01T08:48:46.729629Z", - "start_time": "2024-05-01T08:48:46.725308Z" + "end_time": "2024-05-01T18:42:42.332017Z", + "start_time": "2024-05-01T18:42:42.328160Z" } }, "outputs": [ { "data": { - "text/plain": [ - "{'console-emitter': process_bigraph.composite.ConsoleEmitter,\n", - " 'ram-emitter': process_bigraph.composite.RAMEmitter,\n", - " 'cobra': biosimulator_processes.processes.cobra_process.CobraProcess,\n", - " 'copasi': biosimulator_processes.processes.copasi_process.CopasiProcess,\n", - " 'tellurium': biosimulator_processes.processes.tellurium_process.TelluriumProcess,\n", - " 'plotter': biosimulator_processes.steps.viz.CompositionPlotter,\n", - " 'plotter2d': biosimulator_processes.steps.viz.Plotter2d}" - ] + "text/plain": "{'console-emitter': process_bigraph.composite.ConsoleEmitter,\n 'ram-emitter': process_bigraph.composite.RAMEmitter,\n 'cobra': biosimulator_processes.processes.cobra_process.CobraProcess,\n 'copasi': biosimulator_processes.processes.copasi_process.CopasiProcess,\n 'tellurium': biosimulator_processes.processes.tellurium_process.TelluriumProcess,\n 'plotter': biosimulator_processes.steps.viz.CompositionPlotter,\n 'plotter2d': biosimulator_processes.steps.viz.Plotter2d}" }, "execution_count": 3, "metadata": {}, @@ -99,38 +89,14 @@ "id": "2633feac24b596a6", "metadata": { "ExecuteTime": { - "end_time": "2024-05-01T08:48:46.733830Z", - "start_time": "2024-05-01T08:48:46.731019Z" + "end_time": "2024-05-01T18:42:42.338024Z", + "start_time": "2024-05-01T18:42:42.332366Z" } }, "outputs": [ { "data": { - "text/plain": [ - "{'copasi': {'_type': 'process',\n", - " 'address': 'local:copasi',\n", - " 'config': {'model': {'model_source': '../biosimulator_processes/model_files/sbml/BIOMD0000000630_url.xml'},\n", - " 'method': 'lsoda',\n", - " 'species_context': 'counts'},\n", - " 'inputs': {'floating_species_counts': ['floating_species_counts_store'],\n", - " 'model_parameters': ['model_parameters_store'],\n", - " 'time': ['time_store'],\n", - " 'reactions': ['reactions_store']},\n", - " 'outputs': {'floating_species_counts': ['floating_species_counts_store'],\n", - " 'time': ['time_store']}},\n", - " 'emitter': {'_type': 'step',\n", - " 'address': 'local:ram-emitter',\n", - " 'config': {'emit': {'floating_species_counts': 'tree[float]',\n", - " 'time': 'float'}},\n", - " 'inputs': {'floating_species_counts': ['floating_species_counts_store'],\n", - " 'time': ['time_store']}},\n", - " 'plotter2d': {'_type': 'step',\n", - " 'address': 'local:plotter2d',\n", - " 'config': {'duration': 30,\n", - " 'species_context': 'counts',\n", - " 'process': ['copasi']},\n", - " 'inputs': {'floating_species_counts': ['floating_species_counts_store']}}}" - ] + "text/plain": "{'copasi': {'_type': 'process',\n 'address': 'local:copasi',\n 'config': {'model': {'model_source': '../biosimulator_processes/model_files/sbml/BIOMD0000000630_url.xml'},\n 'method': 'lsoda',\n 'species_context': 'counts'},\n 'inputs': {'floating_species_counts': ['floating_species_counts_store'],\n 'model_parameters': ['model_parameters_store'],\n 'time': ['time_store'],\n 'reactions': ['reactions_store']},\n 'outputs': {'floating_species_counts': ['floating_species_counts_store'],\n 'time': ['time_store']}},\n 'emitter': {'_type': 'step',\n 'address': 'local:ram-emitter',\n 'config': {'emit': {'floating_species_counts': 'tree[float]',\n 'time': 'float'}},\n 'inputs': {'floating_species_counts': ['floating_species_counts_store'],\n 'time': ['time_store']}},\n 'plotter2d': {'_type': 'step',\n 'address': 'local:plotter2d',\n 'config': {'duration': 30,\n 'species_context': 'counts',\n 'process': ['copasi']},\n 'inputs': {'floating_species_counts': ['floating_species_counts_store']}}}" }, "execution_count": 4, "metadata": {}, @@ -164,8 +130,8 @@ "id": "bd91dca0be22cd27", "metadata": { "ExecuteTime": { - "end_time": "2024-05-01T08:48:46.784234Z", - "start_time": "2024-05-01T08:48:46.740099Z" + "end_time": "2024-05-01T18:42:42.790645Z", + "start_time": "2024-05-01T18:42:42.752504Z" } }, "outputs": [ @@ -195,43 +161,11 @@ { "cell_type": "code", "execution_count": 6, - "id": "1dbde99ba40756d4", - "metadata": { - "ExecuteTime": { - "end_time": "2024-05-01T08:48:47.672147Z", - "start_time": "2024-05-01T08:48:47.561277Z" - }, - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "0.37" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from biosimulator_processes.compare import generate_composite_index\n", - "\n", - "data = {'tellurium': 0.34, 'copasi': 0.40}\n", - "composite_index = generate_composite_index(data)\n", - "\n", - "composite_index" - ] - }, - { - "cell_type": "code", - "execution_count": 7, "id": "7c6f72142af0616b", "metadata": { "ExecuteTime": { - "end_time": "2024-05-01T08:48:48.447874Z", - "start_time": "2024-05-01T08:48:48.189133Z" + "end_time": "2024-05-01T18:42:47.675894Z", + "start_time": "2024-05-01T18:42:47.586056Z" } }, "outputs": [ @@ -241,65 +175,65 @@ "text": [ "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.019524902598568622, 'plasmin': 1.8202007375100788e-06, 'single intact chain urokinase-type plasminogen activator': 0.004908147993828366, 'two-chain urokinase-type plasminogen activator': 1.3325716135386897e-13, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.048271297442455445, 'plasmin': 8.671884126112786e-06, 'single intact chain urokinase-type plasminogen activator': 0.012490138146165095, 'two-chain urokinase-type plasminogen activator': 5.075951946945878e-12, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.08594387896712657, 'plasmin': 2.4920187199060397e-05, 'single intact chain urokinase-type plasminogen activator': 0.02253054231086868, 'two-chain urokinase-type plasminogen activator': 5.6471480523364736e-11, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.13225545187034607, 'plasmin': 5.573720108292367e-05, 'single intact chain urokinase-type plasminogen activator': 0.034831288962406164, 'two-chain urokinase-type plasminogen activator': 3.471358902931471e-10, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.18692690147800894, 'plasmin': 0.00010681704778765246, 'single intact chain urokinase-type plasminogen activator': 0.049210264515178154, 'two-chain urokinase-type plasminogen activator': 1.488407009482764e-09, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.24968713428462455, 'plasmin': 0.00018414387314325984, 'single intact chain urokinase-type plasminogen activator': 0.0655000270919499, 'two-chain urokinase-type plasminogen activator': 4.997148278034031e-09, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.32027299330948455, 'plasmin': 0.00029380488640593714, 'single intact chain urokinase-type plasminogen activator': 0.08354662361879961, 'two-chain urokinase-type plasminogen activator': 1.4045790739789766e-08, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.39842915233351706, 'plasmin': 0.0004418416308562708, 'single intact chain urokinase-type plasminogen activator': 0.10320850189283831, 'two-chain urokinase-type plasminogen activator': 3.448621000177178e-08, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.4839079925719783, 'plasmin': 0.0006341335894887681, 'single intact chain urokinase-type plasminogen activator': 0.12435550996861795, 'two-chain urokinase-type plasminogen activator': 7.612451153836218e-08, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.5764694648822319, 'plasmin': 0.0008763090431797236, 'single intact chain urokinase-type plasminogen activator': 0.14686797587681116, 'two-chain urokinase-type plasminogen activator': 1.5419502494345544e-07, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.6758809402213328, 'plasmin': 0.0011736787742978709, 'single intact chain urokinase-type plasminogen activator': 0.17063586118533242, 'two-chain urokinase-type plasminogen activator': 2.9096118010000923e-07, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.7819170506888022, 'plasmin': 0.0015311888812941724, 'single intact chain urokinase-type plasminogen activator': 0.1955579826677361, 'two-chain urokinase-type plasminogen activator': 5.173599738617645e-07, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 0.8943595232254089, 'plasmin': 0.00195338941596976, 'single intact chain urokinase-type plasminogen activator': 0.22154129653311297, 'two-chain urokinase-type plasminogen activator': 8.7460432476947e-07, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.0129970077446349, 'plasmin': 0.0024444160723502083, 'single intact chain urokinase-type plasminogen activator': 0.24850024032259402, 'two-chain urokinase-type plasminogen activator': 1.4156630157341299e-06, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.1376249012510955, 'plasmin': 0.0030079825357922792, 'single intact chain urokinase-type plasminogen activator': 0.2763561279359749, 'two-chain urokinase-type plasminogen activator': 2.2065484294663494e-06, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.2680451693020878, 'plasmin': 0.003647381427202734, 'single intact chain urokinase-type plasminogen activator': 0.30503659351056245, 'two-chain urokinase-type plasminogen activator': 3.327357322589068e-06, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.4040661659847016, 'plasmin': 0.004365492095563226, 'single intact chain urokinase-type plasminogen activator': 0.3344750803263811, 'two-chain urokinase-type plasminogen activator': 4.873025445964662e-06, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.5455024515735356, 'plasmin': 0.005164793946093621, 'single intact chain urokinase-type plasminogen activator': 0.36461036692256155, 'two-chain urokinase-type plasminogen activator': 6.953773235003841e-06, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.6921746175091137, 'plasmin': 0.006047383104386874, 'single intact chain urokinase-type plasminogen activator': 0.39538614719580617, 'two-chain urokinase-type plasminogen activator': 9.69523756969107e-06, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 1.8439091035956074, 'plasmin': 0.007014993053119017, 'single intact chain urokinase-type plasminogen activator': 0.4267506245419417, 'two-chain urokinase-type plasminogen activator': 1.3238294809955793e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 2.0005380210179786, 'plasmin': 0.008069016915307411, 'single intact chain urokinase-type plasminogen activator': 0.45865614814733663, 'two-chain urokinase-type plasminogen activator': 1.7738590250958243e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 2.1618989782763527, 'plasmin': 0.009210530974935073, 'single intact chain urokinase-type plasminogen activator': 0.4910588797859212, 'two-chain urokinase-type plasminogen activator': 2.336580816263835e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 2.3278349093337694, 'plasmin': 0.010440318969900256, 'single intact chain urokinase-type plasminogen activator': 0.5239184864728671, 'two-chain urokinase-type plasminogen activator': 3.0302711397822668e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 2.4981939049975397, 'plasmin': 0.011758896555008839, 'single intact chain urokinase-type plasminogen activator': 0.5571978581897375, 'two-chain urokinase-type plasminogen activator': 3.874398929657011e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 2.672829047822026, 'plasmin': 0.013166535518912286, 'single intact chain urokinase-type plasminogen activator': 0.5908628484796565, 'two-chain urokinase-type plasminogen activator': 4.88949545483709e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 2.8515982508222604, 'plasmin': 0.01466328741675536, 'single intact chain urokinase-type plasminogen activator': 0.6248820362662922, 'two-chain urokinase-type plasminogen activator': 6.0970127340934e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 3.0343641001741783, 'plasmin': 0.016249006359856908, 'single intact chain urokinase-type plasminogen activator': 0.6592265070283742, 'two-chain urokinase-type plasminogen activator': 7.519174621166138e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 3.2209937020482498, 'plasmin': 0.017923370766672088, 'single intact chain urokinase-type plasminogen activator': 0.6938696517545451, 'two-chain urokinase-type plasminogen activator': 9.17882413141594e-05, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 3.411358533679481, 'plasmin': 0.01968590393283723, 'single intact chain urokinase-type plasminogen activator': 0.7287869822242766, 'two-chain urokinase-type plasminogen activator': 0.00011099270258599119, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n", - "---- {'floating_species_counts': {'plasminogen': 3.6053342987363917, 'plasmin': 0.021535993324549866, 'single intact chain urokinase-type plasminogen activator': 0.7639559612712573, 'two-chain urokinase-type plasminogen activator': 0.00013304137144864997, 'x': 0.0, 'x-plasmin': 0.0}}\n", + "---- {'floating_species_counts': {'plasminogen': 0.0, 'plasmin': 0.0, 'single intact chain urokinase-type plasminogen activator': 0.0, 'two-chain urokinase-type plasminogen activator': 0.0, 'x': 0.0, 'x-plasmin': 0.0}}\n", "---- \n" ] }, @@ -322,12 +256,12 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "c7a254aee3009b8c", "metadata": { "ExecuteTime": { - "end_time": "2024-05-01T08:48:48.812254Z", - "start_time": "2024-05-01T08:48:48.803165Z" + "end_time": "2024-05-01T18:42:48.446434Z", + "start_time": "2024-05-01T18:42:48.439418Z" } }, "outputs": [ @@ -342,213 +276,213 @@ " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 0.0},\n", - " { 'floating_species_counts': { 'plasmin': 1.8202007375100788e-06,\n", - " 'plasminogen': 0.019524902598568622,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.004908147993828366,\n", - " 'two-chain urokinase-type plasminogen activator': 1.3325716135386897e-13,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 1.0},\n", - " { 'floating_species_counts': { 'plasmin': 8.671884126112786e-06,\n", - " 'plasminogen': 0.048271297442455445,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.012490138146165095,\n", - " 'two-chain urokinase-type plasminogen activator': 5.075951946945878e-12,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 2.0},\n", - " { 'floating_species_counts': { 'plasmin': 2.4920187199060397e-05,\n", - " 'plasminogen': 0.08594387896712657,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.02253054231086868,\n", - " 'two-chain urokinase-type plasminogen activator': 5.6471480523364736e-11,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 3.0},\n", - " { 'floating_species_counts': { 'plasmin': 5.573720108292367e-05,\n", - " 'plasminogen': 0.13225545187034607,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.034831288962406164,\n", - " 'two-chain urokinase-type plasminogen activator': 3.471358902931471e-10,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 4.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.00010681704778765246,\n", - " 'plasminogen': 0.18692690147800894,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.049210264515178154,\n", - " 'two-chain urokinase-type plasminogen activator': 1.488407009482764e-09,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 5.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.00018414387314325984,\n", - " 'plasminogen': 0.24968713428462455,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.0655000270919499,\n", - " 'two-chain urokinase-type plasminogen activator': 4.997148278034031e-09,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 6.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.00029380488640593714,\n", - " 'plasminogen': 0.32027299330948455,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.08354662361879961,\n", - " 'two-chain urokinase-type plasminogen activator': 1.4045790739789766e-08,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 7.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0004418416308562708,\n", - " 'plasminogen': 0.39842915233351706,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.10320850189283831,\n", - " 'two-chain urokinase-type plasminogen activator': 3.448621000177178e-08,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 8.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0006341335894887681,\n", - " 'plasminogen': 0.4839079925719783,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.12435550996861795,\n", - " 'two-chain urokinase-type plasminogen activator': 7.612451153836218e-08,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 9.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0008763090431797236,\n", - " 'plasminogen': 0.5764694648822319,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.14686797587681116,\n", - " 'two-chain urokinase-type plasminogen activator': 1.5419502494345544e-07,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 10.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0011736787742978709,\n", - " 'plasminogen': 0.6758809402213328,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.17063586118533242,\n", - " 'two-chain urokinase-type plasminogen activator': 2.9096118010000923e-07,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 11.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0015311888812941724,\n", - " 'plasminogen': 0.7819170506888022,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.1955579826677361,\n", - " 'two-chain urokinase-type plasminogen activator': 5.173599738617645e-07,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 12.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.00195338941596976,\n", - " 'plasminogen': 0.8943595232254089,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.22154129653311297,\n", - " 'two-chain urokinase-type plasminogen activator': 8.7460432476947e-07,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 13.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0024444160723502083,\n", - " 'plasminogen': 1.0129970077446349,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.24850024032259402,\n", - " 'two-chain urokinase-type plasminogen activator': 1.4156630157341299e-06,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 14.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.0030079825357922792,\n", - " 'plasminogen': 1.1376249012510955,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.2763561279359749,\n", - " 'two-chain urokinase-type plasminogen activator': 2.2065484294663494e-06,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 15.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.003647381427202734,\n", - " 'plasminogen': 1.2680451693020878,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.30503659351056245,\n", - " 'two-chain urokinase-type plasminogen activator': 3.327357322589068e-06,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 16.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.004365492095563226,\n", - " 'plasminogen': 1.4040661659847016,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.3344750803263811,\n", - " 'two-chain urokinase-type plasminogen activator': 4.873025445964662e-06,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 17.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.005164793946093621,\n", - " 'plasminogen': 1.5455024515735356,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.36461036692256155,\n", - " 'two-chain urokinase-type plasminogen activator': 6.953773235003841e-06,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 18.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.006047383104386874,\n", - " 'plasminogen': 1.6921746175091137,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.39538614719580617,\n", - " 'two-chain urokinase-type plasminogen activator': 9.69523756969107e-06,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 19.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.007014993053119017,\n", - " 'plasminogen': 1.8439091035956074,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.4267506245419417,\n", - " 'two-chain urokinase-type plasminogen activator': 1.3238294809955793e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 20.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.008069016915307411,\n", - " 'plasminogen': 2.0005380210179786,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.45865614814733663,\n", - " 'two-chain urokinase-type plasminogen activator': 1.7738590250958243e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 21.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.009210530974935073,\n", - " 'plasminogen': 2.1618989782763527,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.4910588797859212,\n", - " 'two-chain urokinase-type plasminogen activator': 2.336580816263835e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 22.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.010440318969900256,\n", - " 'plasminogen': 2.3278349093337694,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.5239184864728671,\n", - " 'two-chain urokinase-type plasminogen activator': 3.0302711397822668e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 23.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.011758896555008839,\n", - " 'plasminogen': 2.4981939049975397,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.5571978581897375,\n", - " 'two-chain urokinase-type plasminogen activator': 3.874398929657011e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 24.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.013166535518912286,\n", - " 'plasminogen': 2.672829047822026,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.5908628484796565,\n", - " 'two-chain urokinase-type plasminogen activator': 4.88949545483709e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 25.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.01466328741675536,\n", - " 'plasminogen': 2.8515982508222604,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.6248820362662922,\n", - " 'two-chain urokinase-type plasminogen activator': 6.0970127340934e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 26.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.016249006359856908,\n", - " 'plasminogen': 3.0343641001741783,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.6592265070283742,\n", - " 'two-chain urokinase-type plasminogen activator': 7.519174621166138e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 27.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.017923370766672088,\n", - " 'plasminogen': 3.2209937020482498,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.6938696517545451,\n", - " 'two-chain urokinase-type plasminogen activator': 9.17882413141594e-05,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 28.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.01968590393283723,\n", - " 'plasminogen': 3.411358533679481,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.7287869822242766,\n", - " 'two-chain urokinase-type plasminogen activator': 0.00011099270258599119,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 29.0},\n", - " { 'floating_species_counts': { 'plasmin': 0.021535993324549866,\n", - " 'plasminogen': 3.6053342987363917,\n", - " 'single intact chain urokinase-type plasminogen activator': 0.7639559612712573,\n", - " 'two-chain urokinase-type plasminogen activator': 0.00013304137144864997,\n", + " { 'floating_species_counts': { 'plasmin': 0.0,\n", + " 'plasminogen': 0.0,\n", + " 'single intact chain urokinase-type plasminogen activator': 0.0,\n", + " 'two-chain urokinase-type plasminogen activator': 0.0,\n", " 'x': 0.0,\n", " 'x-plasmin': 0.0},\n", " 'time': 30.0}]}\n" @@ -561,12 +495,12 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "76259bde7fd711f5", "metadata": { "ExecuteTime": { - "end_time": "2024-05-01T08:48:49.507944Z", - "start_time": "2024-05-01T08:48:49.492970Z" + "end_time": "2024-05-01T18:42:49.366339Z", + "start_time": "2024-05-01T18:42:49.362114Z" } }, "outputs": [], @@ -639,10 +573,10 @@ "evalue": "name 'x' is not defined", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mx\u001b[49m\n", - "\u001b[0;31mNameError\u001b[0m: name 'x' is not defined" + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mNameError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[0;32mIn[10], line 1\u001B[0m\n\u001B[0;32m----> 1\u001B[0m \u001B[43mx\u001B[49m\n", + "\u001B[0;31mNameError\u001B[0m: name 'x' is not defined" ] } ], @@ -848,10 +782,10 @@ "evalue": "'list' object has no attribute 'join'", "output_type": "error", "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[9], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m module__\u001b[38;5;241m.\u001b[39mpop(i)\n\u001b[1;32m 7\u001b[0m module__\u001b[38;5;241m.\u001b[39minsert(i, val)\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[43mmodule__\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mjoin\u001b[49m())\n\u001b[1;32m 9\u001b[0m import_statement \u001b[38;5;241m=\u001b[39m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mbiosimulator_processes.processes.\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mmodule_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\n\u001b[1;32m 11\u001b[0m module \u001b[38;5;241m=\u001b[39m \u001b[38;5;28m__import__\u001b[39m(\n\u001b[1;32m 12\u001b[0m import_statement, fromlist\u001b[38;5;241m=\u001b[39m[class_name])\n", - "\u001b[0;31mAttributeError\u001b[0m: 'list' object has no attribute 'join'" + "\u001B[0;31m---------------------------------------------------------------------------\u001B[0m", + "\u001B[0;31mAttributeError\u001B[0m Traceback (most recent call last)", + "Cell \u001B[0;32mIn[9], line 8\u001B[0m\n\u001B[1;32m 6\u001B[0m module__\u001B[38;5;241m.\u001B[39mpop(i)\n\u001B[1;32m 7\u001B[0m module__\u001B[38;5;241m.\u001B[39minsert(i, val)\n\u001B[0;32m----> 8\u001B[0m \u001B[38;5;28mprint\u001B[39m(\u001B[43mmodule__\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mjoin\u001B[49m())\n\u001B[1;32m 9\u001B[0m import_statement \u001B[38;5;241m=\u001B[39m \u001B[38;5;124mf\u001B[39m\u001B[38;5;124m'\u001B[39m\u001B[38;5;124mbiosimulator_processes.processes.\u001B[39m\u001B[38;5;132;01m{\u001B[39;00mmodule_name\u001B[38;5;132;01m}\u001B[39;00m\u001B[38;5;124m'\u001B[39m\n\u001B[1;32m 11\u001B[0m module \u001B[38;5;241m=\u001B[39m \u001B[38;5;28m__import__\u001B[39m(\n\u001B[1;32m 12\u001B[0m import_statement, fromlist\u001B[38;5;241m=\u001B[39m[class_name])\n", + "\u001B[0;31mAttributeError\u001B[0m: 'list' object has no attribute 'join'" ] } ], diff --git a/notebooks/biolab_api_demo.ipynb b/notebooks/biolab_api_demo.ipynb deleted file mode 100644 index fbcc44577..000000000 --- a/notebooks/biolab_api_demo.ipynb +++ /dev/null @@ -1,1559 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "8087f67dcdaefdee", - "metadata": { - "collapsed": false - }, - "source": [ - "# BioLab API Demo (BioLab container)" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "c253d92e47737dd9", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:31:25.367399Z", - "start_time": "2024-03-15T20:31:25.362852Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "# TODO: create sep repo and pypi for data model so that you can install it and import like `import sed_data as sed`" - ] - }, - { - "cell_type": "code", - "execution_count": 28, - "id": "initial_id", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:23:29.758772Z", - "start_time": "2024-03-15T20:23:29.756131Z" - }, - "collapsed": true - }, - "outputs": [], - "source": [ - "import sys\n", - "\n", - "sys.path.insert(0, '..')" - ] - }, - { - "cell_type": "markdown", - "id": "572ce5fd9c49efcb", - "metadata": { - "collapsed": false - }, - "source": [ - "#### **_Experiment 1_**: Here we cross a boundary in the stack that is a biological simulation. We go from model configuration, to experiment. Thus, this tooling sits at that level: both experiment specification AND experiment execution. It's not just a way to specify an experiment, but it is also a way to run it, given the many knobs and buttons that you can use predefine and customize the way the actual model is being solved. Our users are seeking to be involved in an experiment as a \"stack\". We should make a bigger distinction between terms like \"model\"." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "e3218a2629726818", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:26.374137Z", - "start_time": "2024-03-15T20:13:24.443503Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CobraProcess registered successfully.\n", - "CopasiProcess registered successfully.\n", - "SmoldynProcess registered successfully.\n", - "TelluriumProcess registered successfully.\n" - ] - } - ], - "source": [ - "from process_bigraph import pp\n", - "from biosimulator_processes.biosimulator_builder import BuildPrompter\n", - "from biosimulator_processes import SedDataModel as sed " - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "871b58285775fb24", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:26.815316Z", - "start_time": "2024-03-15T20:13:26.375300Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "TimeCourseModel(model_source='BIOMD0000000749',\n", - " model_id='model_from_BIOMD0000000749',\n", - " model_name='model_from_BIOMD0000000749',\n", - " model_language=(None,),\n", - " model_changes=None,\n", - " model_units=None)\n" - ] - } - ], - "source": [ - "# 1a. define a model for the process composition. In this case, just one model to be re-used as configuration for the processes we create:\n", - "\n", - "simple_tc_model = sed.TimeCourseModel(model_source=tumor_control_biomodel_id)\n", - "\n", - "pp(simple_tc_model)" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "1519914d8b9a85ce", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:22:06.411220Z", - "start_time": "2024-03-15T20:22:06.408264Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{ 'description': 'The paper describes a model of tumor control via alternating '\n", - " 'immunostimulating and immunosuppressive phases. \\r\\n'\n", - " 'Created by COPASI 4.25 (Build 207) \\r\\n'\n", - " '\\r\\n'\n", - " 'This model is described in the article: \\r\\n'\n", - " 'In silico tumor control induced via alternating '\n", - " 'immunostimulating and immunosuppressive phases\\r\\n'\n", - " 'AI Reppas, JCL Alfonso, and H Hatzikirou\\r\\n'\n", - " 'Virulence 7:2, 174--186\\r\\n'\n", - " '\\r\\n'\n", - " 'Abstract: \\r\\n'\n", - " 'Despite recent advances in the field of Oncoimmunology, the '\n", - " 'success potential of immunomodulatory therapies against '\n", - " 'cancer remains to be elucidated. One of the reasons is the '\n", - " 'lack of understanding on the complex interplay between tumor '\n", - " 'growth dynamics and the associated immune system responses. '\n", - " 'Toward this goal, we consider a mathematical model of '\n", - " 'vascularized tumor growth and the corresponding effector '\n", - " 'cell recruitment dynamics. Bifurcation analysis allows for '\n", - " 'the exploration of model’s dynamic behavior and the '\n", - " 'determination of these parameter regimes that result in '\n", - " 'immune-mediated tumor control. In this work, we focus on a '\n", - " 'particular tumor evasion regime that involves tumor and '\n", - " 'effector cell concentration oscillations of slowly '\n", - " 'increasing and decreasing amplitude, respectively. '\n", - " 'Considering a temporal multiscale analysis, we derive an '\n", - " 'analytically tractable mapping of model solutions onto a '\n", - " 'weakly negatively damped harmonic oscillator. Based on our '\n", - " 'analysis, we propose a theory-driven intervention strategy '\n", - " 'involving immunostimulating and immunosuppressive phases to '\n", - " 'induce long-term tumor control.\\r\\n'\n", - " '\\r\\n'\n", - " 'To cite BioModels Database, please use: BioModels Database: '\n", - " 'An enhanced, curated and annotated resource for published '\n", - " 'quantitative kinetic models . \\r\\n'\n", - " 'To the extent possible under law, all copyright and related '\n", - " 'or neighbouring rights to this encoded model have been '\n", - " 'dedicated to the public domain worldwide. \\r\\n'\n", - " 'Please refer to CC0 Public Domain Dedication for more '\n", - " 'information.',\n", - " 'files': { 'additional': [ { 'description': 'CPS file of the model in COPASI',\n", - " 'fileSize': '81326',\n", - " 'name': 'Reppas2015.cps'},\n", - " { 'description': 'Auto-generated SEDML file',\n", - " 'fileSize': '2191',\n", - " 'name': 'Reppas2015.sedml'}],\n", - " 'main': [{'fileSize': '62675', 'name': 'Reppas2015.xml'}]},\n", - " 'firstPublished': 1562858819000,\n", - " 'format': {'name': 'SBML', 'version': 'L3V1'},\n", - " 'history': { 'revisions': [ { 'comment': 'Edited model metadata online.',\n", - " 'submitted': 1562858737000,\n", - " 'submitter': 'Jinghao Men',\n", - " 'version': 2},\n", - " { 'comment': 'Automatically added model '\n", - " 'identifier BIOMD0000000749',\n", - " 'submitted': 1562858822000,\n", - " 'submitter': 'Jinghao Men',\n", - " 'version': 3}]},\n", - " 'name': 'Reppas2015 - tumor control via alternating immunostimulating and '\n", - " 'immunosuppressive phases',\n", - " 'publication': { 'affiliation': 'a Center for Advancing Electronics; '\n", - " 'Technische Universität Dresden ; Dresden , '\n", - " 'Germany.',\n", - " 'authors': [ {'name': 'Reppas AI'},\n", - " {'name': 'Alfonso JC'},\n", - " { 'name': 'Hatzikirou H',\n", - " 'orcid': '0000-0002-1270-7885'}],\n", - " 'issue': '2',\n", - " 'journal': 'Virulence',\n", - " 'link': 'http://identifiers.org/pubmed/26305801',\n", - " 'month': '1',\n", - " 'pages': '174-186',\n", - " 'synopsis': 'Despite recent advances in the field of '\n", - " 'Oncoimmunology, the success potential of '\n", - " 'immunomodulatory therapies against cancer '\n", - " 'remains to be elucidated. One of the reasons '\n", - " 'is the lack of understanding on the complex '\n", - " 'interplay between tumor growth dynamics and '\n", - " 'the associated immune system responses. Toward '\n", - " 'this goal, we consider a mathematical model of '\n", - " 'vascularized tumor growth and the '\n", - " 'corresponding effector cell recruitment '\n", - " 'dynamics. Bifurcation analysis allows for the '\n", - " \"exploration of model's dynamic behavior and \"\n", - " 'the determination of these parameter regimes '\n", - " 'that result in immune-mediated tumor control. '\n", - " 'In this work, we focus on a particular tumor '\n", - " 'evasion regime that involves tumor and '\n", - " 'effector cell concentration oscillations of '\n", - " 'slowly increasing and decreasing amplitude, '\n", - " 'respectively. Considering a temporal '\n", - " 'multiscale analysis, we derive an analytically '\n", - " 'tractable mapping of model solutions onto a '\n", - " 'weakly negatively damped harmonic oscillator. '\n", - " 'Based on our analysis, we propose a '\n", - " 'theory-driven intervention strategy involving '\n", - " 'immunostimulating and immunosuppressive phases '\n", - " 'to induce long-term tumor control.',\n", - " 'title': 'In silico tumor control induced via alternating '\n", - " 'immunostimulating and immunosuppressive phases.',\n", - " 'volume': '7',\n", - " 'year': 2016},\n", - " 'publicationId': 'BIOMD0000000749',\n", - " 'submissionId': 'MODEL1907110002'}\n" - ] - } - ], - "source": [ - "# 1b. view model info for model source:\n", - "\n", - "pp(simple_tc_model.source_info)" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "a30f5e94167513c9", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:26.818017Z", - "start_time": "2024-03-15T20:13:26.816089Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "# 1c. define a TimeCourse process instance using the above object as a parameter. The other parameter is method. See BasiCO documentation for more details on solvers\n", - "\n", - "simple_tc_process = sed.TimeCourseProcess(model=simple_tc_model, method='lsoda')" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "a9c15126dda87970", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:26.821191Z", - "start_time": "2024-03-15T20:13:26.819433Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "TimeCourseProcess(model=TimeCourseModel(model_source='BIOMD0000000749',\n", - " model_id='model_from_BIOMD0000000749',\n", - " model_name='model_from_BIOMD0000000749',\n", - " model_language=(None,),\n", - " model_changes=None,\n", - " model_units=None),\n", - " method='lsoda')\n" - ] - } - ], - "source": [ - "# >> The process model instance is viewable as a dataclass...\n", - "\n", - "pp(simple_tc_process)" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "ba3d6e8bae50f216", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:26.823578Z", - "start_time": "2024-03-15T20:13:26.821925Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{ 'method': 'lsoda',\n", - " 'model': { 'model_changes': None,\n", - " 'model_id': 'model_from_BIOMD0000000749',\n", - " 'model_language': (None,),\n", - " 'model_name': 'model_from_BIOMD0000000749',\n", - " 'model_source': 'BIOMD0000000749',\n", - " 'model_units': None}}\n" - ] - } - ], - "source": [ - "# >> ...or a dict:\n", - "\n", - "pp(simple_tc_process.to_dict())" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "f6d099ae829fb063", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:26.826247Z", - "start_time": "2024-03-15T20:13:26.824768Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "# 2. instantiate the prompter:\n", - "\n", - "prompter = BuildPrompter()" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "6ff0228586348da1", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:35.794931Z", - "start_time": "2024-03-15T20:13:27.407984Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "simple process successfully added to the bi-graph!\n", - "All nodes including the most recently added simple processes connected!\n", - "Done adding single simple (CopasiProcess) to the bigraph.\n" - ] - } - ], - "source": [ - "# 3. add process(es) to the bigraph with the Time Course model instance we created above. For now, just one process will be added.\n", - "\n", - "prompter.add_single_process(config=simple_tc_process)" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "b833c7217603645c", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:36.417741Z", - "start_time": "2024-03-15T20:13:36.413643Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Builder({ 'emitter': { '_type': 'step',\n", - " 'address': 'local:ram-emitter',\n", - " 'config': {'emit': {}},\n", - " 'inputs': {},\n", - " 'instance': ,\n", - " 'outputs': {}},\n", - " 'simple': { '_type': 'process',\n", - " 'address': 'local:CopasiProcess',\n", - " 'config': { 'method': 'lsoda',\n", - " 'model': { 'model_changes': { 'global_parameter_changes': None,\n", - " 'reaction_changes': None,\n", - " 'species_changes': None},\n", - " 'model_id': 'model_from_BIOMD0000000749',\n", - " 'model_language': (None,),\n", - " 'model_name': 'model_from_BIOMD0000000749',\n", - " 'model_source': 'BIOMD0000000749',\n", - " 'model_units': None}},\n", - " 'inputs': { 'floating_species': ['floating_species_store'],\n", - " 'model_parameters': ['model_parameters_store'],\n", - " 'reactions': ['reactions_store'],\n", - " 'time': ['time_store']},\n", - " 'instance': ,\n", - " 'interval': 1.0,\n", - " 'outputs': { 'floating_species': ['floating_species_store'],\n", - " 'time': ['time_store']}}})\n" - ] - } - ], - "source": [ - "# 4. Inspect the builder instance within prompter:\n", - "\n", - "pp(prompter.builder_instance)" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "8400f44e3a2e8433", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:37.304578Z", - "start_time": "2024-03-15T20:13:37.084635Z" - }, - "collapsed": false - }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('time_store',)\n", - "\n", - "time_store\n", - "\n", - "\n", - "\n", - "('simple',)\n", - "\n", - "simple\n", - "\n", - "\n", - "\n", - "('time_store',)->('simple',)\n", - "\n", - "\n", - "time\n", - "\n", - "\n", - "\n", - "('time_store',)->('simple',)\n", - "\n", - "\n", - "time\n", - "\n", - "\n", - "\n", - "('floating_species_store',)\n", - "\n", - "floating_species_store\n", - "\n", - "\n", - "\n", - "('floating_species_store', 'E')\n", - "\n", - "E\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', 'E')\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store', 'R')\n", - "\n", - "R\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', 'R')\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store', 'f')\n", - "\n", - "f\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', 'f')\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store', "E'")\n", - "\n", - "E'\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', "E'")\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('simple',)\n", - "\n", - "\n", - "floating_species\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('simple',)\n", - "\n", - "\n", - "floating_species\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)\n", - "\n", - "model_parameters_store\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'B')\n", - "\n", - "B\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'B')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'lm')\n", - "\n", - "lm\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'lm')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'la')\n", - "\n", - "la\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'la')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'ld')\n", - "\n", - "ld\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'ld')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'c')\n", - "\n", - "c\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'c')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'k')\n", - "\n", - "k\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'k')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'd1')\n", - "\n", - "d1\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'd1')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'd0')\n", - "\n", - "d0\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'd0')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'sigma')\n", - "\n", - "sigma\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'sigma')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'r')\n", - "\n", - "r\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'r')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('simple',)\n", - "\n", - "\n", - "model_parameters\n", - "\n", - "\n", - "\n", - "('reactions_store',)\n", - "\n", - "reactions_store\n", - "\n", - "\n", - "\n", - "('reactions_store', 'tumor growth')\n", - "\n", - "tumor growth\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'tumor growth')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'tumor death')\n", - "\n", - "tumor death\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'tumor death')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'tumor killing')\n", - "\n", - "tumor killing\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'tumor killing')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'tumor nutrient supply')\n", - "\n", - "tumor nutrient supply\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'tumor nutrient supply')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'effector stimulation')\n", - "\n", - "effector stimulation\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'effector stimulation')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'effector exhaustion')\n", - "\n", - "effector exhaustion\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'effector exhaustion')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'effector death')\n", - "\n", - "effector death\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'effector death')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'effector source')\n", - "\n", - "effector source\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'effector source')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'tumor nutrient missuply')\n", - "\n", - "tumor nutrient missuply\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'tumor nutrient missuply')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('simple',)\n", - "\n", - "\n", - "reactions\n", - "\n", - "\n", - "\n", - "('emitter',)\n", - "\n", - "emitter\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# 5. Visualize the fully-connected composition:\n", - "\n", - "prompter.visualize_bigraph()" - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "38052757b3b95baa", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:39.609053Z", - "start_time": "2024-03-15T20:13:38.219045Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "Error while running the simulation: >ERROR 2024-03-15T16:13:39<\n", - " CCopasiTask (5): No output file defined for report of task 'Time-Course'.>EXCEPTION 2024-03-15T16:13:39<\n", - " CTrajectoryMethod (25): Invalid state at time '0.010000'.\n" - ] - }, - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Generating composite...\n", - "Composite generated!\n", - "Running generated composite for an interval of 1\n", - "Composite successfully run. Request complete. Done.\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/alex/Desktop/uchc_work/repos/biosimulator-processes/notebooks/../biosimulator_processes/processes/copasi_process.py:231: FutureWarning:\n", - "\n", - "Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", - "\n" - ] - } - ], - "source": [ - "# 6. Generate a composite engine and use to execute the bigraph that we just created:\n", - "\n", - "prompter.run()" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "45ae5b121110cdce", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:41.061921Z", - "start_time": "2024-03-15T20:13:41.057586Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "File 'simple_single_demo' successfully written in 'out' directory.\n", - "Builder flushed! This is verified because builder is: None\n" - ] - } - ], - "source": [ - "# 7. Clear the builder and start from scratch, writing it out first:\n", - "\n", - "prompter.flush(fp='simple_single_demo')" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "79fbea4fa6708088", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:13:42.252590Z", - "start_time": "2024-03-15T20:13:42.249942Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "prompter.builder_instance" - ] - }, - { - "cell_type": "markdown", - "id": "b65a6fab79ad097c", - "metadata": { - "collapsed": false - }, - "source": [ - "#### **_Experiment 2_**: Load an SBML model from a specified model filepath and add Model changes to the composite before adding it to the bigraph. Here, we expect the user to be familiar enough with the model file they are passing to make individual species/parameter/reaction changes for specific species types. In the Caravagna model, for example, the species involved are T, E, I. Let's change the initial concentration for some of these as an example of model changes:" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "89739e0302d6b89a", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:21:00.668323Z", - "start_time": "2024-03-15T20:21:00.664979Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "True\n" - ] - } - ], - "source": [ - "caravagna_model_filepath = '../biosimulator_processes/model_files/Caravagna2010.xml'\n", - "print(os.path.exists(caravagna_model_filepath))" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "55e063c857e51f3", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:14:50.814659Z", - "start_time": "2024-03-15T20:14:50.812026Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "TimeCourseModel(model_source='../biosimulator_processes/model_files/Caravagna2010.xml',\n", - " model_id='model_from_Caravagna2010.xml',\n", - " model_name='model_from_Caravagna2010.xml',\n", - " model_language=TimeCourseModelChanges(species_changes=SpeciesChange(species_name='T',\n", - " unit=None,\n", - " initial_concentration=0.234,\n", - " initial_particle_number=None,\n", - " initial_expression=None,\n", - " expression=None),\n", - " global_parameter_changes=None,\n", - " reaction_changes=None),\n", - " model_changes=None,\n", - " model_units=None)\n" - ] - } - ], - "source": [ - "# first make the timecourse model which is easily configured with objects related to model changes\n", - "adjusted_tc_model_from_file = sed.TimeCourseModel(\n", - " model_source=caravagna_model_filepath, \n", - " model_changes=sed.TimeCourseModelChanges(\n", - " species_changes=sed.SpeciesChange(species_name='T', initial_concentration=0.234)\n", - " )\n", - ")\n", - "\n", - "\n", - "pp(adjusted_tc_model_from_file)" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "c1ddec005282e13f", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:15:54.149790Z", - "start_time": "2024-03-15T20:15:54.147576Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "TimeCourseProcess(model=TimeCourseModel(model_source='../biosimulator_processes/model_files/Caravagna2010.xml',\n", - " model_id='model_from_Caravagna2010.xml',\n", - " model_name='model_from_Caravagna2010.xml',\n", - " model_language=TimeCourseModelChanges(species_changes=SpeciesChange(species_name='T',\n", - " unit=None,\n", - " initial_concentration=0.234,\n", - " initial_particle_number=None,\n", - " initial_expression=None,\n", - " expression=None),\n", - " global_parameter_changes=None,\n", - " reaction_changes=None),\n", - " model_changes=None,\n", - " model_units=None),\n", - " method='stochastic')\n" - ] - } - ], - "source": [ - "adjusted_tc_process = sed.TimeCourseProcess(model=adjusted_tc_model_from_file, method='stochastic')\n", - "\n", - "pp(adjusted_tc_process)" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "32b4be407a09f96", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:17:28.442782Z", - "start_time": "2024-03-15T20:17:14.426242Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "adjusted_tc_process_demo process successfully added to the bi-graph!\n", - "All nodes including the most recently added adjusted_tc_process_demo processes connected!\n", - "Done adding single adjusted_tc_process_demo (CopasiProcess) to the bigraph.\n" - ] - } - ], - "source": [ - "# add the process we just created with the prompter. The prompter will create a new instance of builder for us, if not passed:\n", - "\n", - "prompter.add_single_process(config=adjusted_tc_process)" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "d0121977a95c320c", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:17:46.077207Z", - "start_time": "2024-03-15T20:17:45.885890Z" - }, - "collapsed": false - }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('time_store',)\n", - "\n", - "time_store\n", - "\n", - "\n", - "\n", - "('adjusted_tc_process_demo',)\n", - "\n", - "adjusted_tc_process_demo\n", - "\n", - "\n", - "\n", - "('time_store',)->('adjusted_tc_process_demo',)\n", - "\n", - "\n", - "time\n", - "\n", - "\n", - "\n", - "('time_store',)->('adjusted_tc_process_demo',)\n", - "\n", - "\n", - "time\n", - "\n", - "\n", - "\n", - "('floating_species_store',)\n", - "\n", - "floating_species_store\n", - "\n", - "\n", - "\n", - "('floating_species_store', 'T')\n", - "\n", - "T\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', 'T')\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store', 'E')\n", - "\n", - "E\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', 'E')\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store', 'I')\n", - "\n", - "I\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('floating_species_store', 'I')\n", - "\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('adjusted_tc_process_demo',)\n", - "\n", - "\n", - "floating_species\n", - "\n", - "\n", - "\n", - "('floating_species_store',)->('adjusted_tc_process_demo',)\n", - "\n", - "\n", - "floating_species\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)\n", - "\n", - "model_parameters_store\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'r2')\n", - "\n", - "r2\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'r2')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'b')\n", - "\n", - "b\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'b')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'a')\n", - "\n", - "a\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'a')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'g2')\n", - "\n", - "g2\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'g2')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'p1')\n", - "\n", - "p1\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'p1')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'g1')\n", - "\n", - "g1\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'g1')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'mu2')\n", - "\n", - "mu2\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'mu2')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'c')\n", - "\n", - "c\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'c')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'p2')\n", - "\n", - "p2\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'p2')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'g3')\n", - "\n", - "g3\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'g3')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'mu3')\n", - "\n", - "mu3\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'mu3')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 'V')\n", - "\n", - "V\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 'V')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 's1')\n", - "\n", - "s1\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 's1')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store', 's2')\n", - "\n", - "s2\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('model_parameters_store', 's2')\n", - "\n", - "\n", - "\n", - "\n", - "('model_parameters_store',)->('adjusted_tc_process_demo',)\n", - "\n", - "\n", - "model_parameters\n", - "\n", - "\n", - "\n", - "('reactions_store',)\n", - "\n", - "reactions_store\n", - "\n", - "\n", - "\n", - "('reactions_store', 'Induction of tumor')\n", - "\n", - "Induction of tumor\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'Induction of tumor')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'Removal of tumor from the system by the action of immune response')\n", - "\n", - "Removal of tumor from the system by the action of immune response\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'Removal of tumor from the system by the action of immune response')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'Activation and transfer of effector cells to the action site')\n", - "\n", - "Activation and transfer of effector cells to the action site\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'Activation and transfer of effector cells to the action site')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'Deactivation and removal of effector cells from the site of tumor')\n", - "\n", - "Deactivation and removal of effector cells from the site of tumor\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'Deactivation and removal of effector cells from the site of tumor')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'Activation of interleukin 2')\n", - "\n", - "Activation of interleukin 2\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'Activation of interleukin 2')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store', 'Deactivation of interleukin2')\n", - "\n", - "Deactivation of interleukin2\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('reactions_store', 'Deactivation of interleukin2')\n", - "\n", - "\n", - "\n", - "\n", - "('reactions_store',)->('adjusted_tc_process_demo',)\n", - "\n", - "\n", - "reactions\n", - "\n", - "\n", - "\n", - "('emitter',)\n", - "\n", - "emitter\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# visualize the adjusted creation\n", - "\n", - "prompter.visualize_bigraph()" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "a6e83469c5b8b93d", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:18:12.068799Z", - "start_time": "2024-03-15T20:18:12.065680Z" - }, - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'emitter': {'_type': 'step',\n", - " 'address': 'local:ram-emitter',\n", - " 'config': {'emit': {}},\n", - " 'inputs': {},\n", - " 'outputs': {}},\n", - " 'adjusted_tc_process_demo': {'_type': 'process',\n", - " 'address': 'local:CopasiProcess',\n", - " 'config': {'model': {'model_source': '../biosimulator_processes/model_files/Caravagna2010.xml',\n", - " 'model_id': 'model_from_Caravagna2010.xml',\n", - " 'model_name': 'model_from_Caravagna2010.xml',\n", - " 'model_language': {'species_changes': {'species_name': 'T',\n", - " 'unit': None,\n", - " 'initial_concentration': 0.234,\n", - " 'initial_particle_number': None,\n", - " 'initial_expression': None,\n", - " 'expression': None},\n", - " 'global_parameter_changes': None,\n", - " 'reaction_changes': None},\n", - " 'model_changes': {'species_changes': None,\n", - " 'global_parameter_changes': None,\n", - " 'reaction_changes': None},\n", - " 'model_units': None},\n", - " 'method': 'stochastic'},\n", - " 'inputs': {'time': ['time_store'],\n", - " 'floating_species': ['floating_species_store'],\n", - " 'model_parameters': ['model_parameters_store'],\n", - " 'reactions': ['reactions_store']},\n", - " 'outputs': {'time': ['time_store'],\n", - " 'floating_species': ['floating_species_store']},\n", - " 'interval': 1.0}}" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "# view the builder document\n", - "\n", - "prompter.builder_instance.document()" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "121064387d7729b0", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:18:40.286441Z", - "start_time": "2024-03-15T20:18:37.849420Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Generating composite...\n", - "Composite generated!\n", - "Running generated composite for an interval of 30\n", - "Composite successfully run. Request complete. Done.\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/alex/Desktop/uchc_work/repos/biosimulator-processes/notebooks/../biosimulator_processes/processes/copasi_process.py:231: FutureWarning:\n", - "\n", - "Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n", - "\n" - ] - } - ], - "source": [ - "# run the composite\n", - "\n", - "prompter.run()" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "6918be74a9a99f7d", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-15T20:19:12.088099Z", - "start_time": "2024-03-15T20:19:12.086212Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "# stochastic works with Caravagna!!" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f160008fa3538b5", - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/notebooks/data_model_demo.ipynb b/notebooks/data_model_demo.ipynb deleted file mode 100644 index da0648c54..000000000 --- a/notebooks/data_model_demo.ipynb +++ /dev/null @@ -1,240 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "initial_id", - "metadata": { - "collapsed": true, - "is_executing": true - }, - "outputs": [], - "source": [ - "import sys \n", - "\"\"\n", - "sys.path.insert(0, '..')" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "3cd5053431aed7e1", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-01T17:36:13.415658Z", - "start_time": "2024-03-01T17:36:11.894800Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "CobraProcess registered successfully.\n", - "CopasiProcess not available. Error: No module named 'biosimulator_processes.process_types'\n", - "SmoldynProcess registered successfully.\n", - "TelluriumProcess registered successfully.\n" - ] - }, - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/alex/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/pydantic/_internal/_fields.py:151: UserWarning:\n", - "\n", - "Field \"model_id\" has conflict with protected namespace \"model_\".\n", - "\n", - "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n", - "\n", - "/Users/alex/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/pydantic/_internal/_fields.py:151: UserWarning:\n", - "\n", - "Field \"model_source\" has conflict with protected namespace \"model_\".\n", - "\n", - "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n", - "\n", - "/Users/alex/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/pydantic/_internal/_fields.py:151: UserWarning:\n", - "\n", - "Field \"model_language\" has conflict with protected namespace \"model_\".\n", - "\n", - "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n", - "\n", - "/Users/alex/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/pydantic/_internal/_fields.py:151: UserWarning:\n", - "\n", - "Field \"model_name\" has conflict with protected namespace \"model_\".\n", - "\n", - "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n", - "\n", - "/Users/alex/Library/Caches/pypoetry/virtualenvs/biosimulator-processes-KVuYbFzt-py3.10/lib/python3.10/site-packages/pydantic/_internal/_fields.py:151: UserWarning:\n", - "\n", - "Field \"model_changes\" has conflict with protected namespace \"model_\".\n", - "\n", - "You may be able to resolve this warning by setting `model_config['protected_namespaces'] = ()`.\n", - "\n" - ] - } - ], - "source": [ - "from biosimulator_processes.data_model import *\n", - "from process_bigraph import pf" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "6bf18cbc74f1f95f", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-01T17:36:13.418537Z", - "start_time": "2024-03-01T17:36:13.415607Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "speciesChangesA = SpeciesChanges(\n", - " species_name='A',\n", - " initial_concentration=20.017\n", - ")\n", - "\n", - "speciesChangesB = SpeciesChanges(\n", - " species_name='B',\n", - " expression='A + B = C'\n", - ")\n", - "\n", - "process_changes = TimeCourseModelChanges(\n", - " species_changes=[speciesChangesA, speciesChangesB]\n", - ")\n", - "\n", - "# process_biomodel_id = BiomodelId(value='BIOMD0000000861')\n", - "\n", - "process_model = TimeCourseModel(\n", - " model_id='BioModel',\n", - " model_source='BIOMD0000000861',\n", - " model_name='Bachmann2011',\n", - " model_changes=process_changes\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "6dd932af0c8358aa", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-01T17:36:15.889304Z", - "start_time": "2024-03-01T17:36:15.883583Z" - }, - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "biosimulator_processes.data_model.TimeCourseModel" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "type(process_model)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "909c4fc3a751659", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-01T17:36:16.365986Z", - "start_time": "2024-03-01T17:36:16.363866Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "copasi_process = CopasiProcessConfigSchema(\n", - " model=process_model,\n", - " method='stochastic'\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "2be623d00e2fc495", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-01T17:36:16.957634Z", - "start_time": "2024-03-01T17:36:16.954386Z" - }, - "collapsed": false - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "{ 'method': 'stochastic',\n", - " 'model': { 'model_changes': { 'global_parameter_changes': None,\n", - " 'reaction_changes': None,\n", - " 'species_changes': [ { 'expression': None,\n", - " 'initial_concentration': 20.017,\n", - " 'initial_expression': None,\n", - " 'initial_particle_number': None,\n", - " 'species_name': 'A',\n", - " 'unit': None},\n", - " { 'expression': 'A + B = '\n", - " 'C',\n", - " 'initial_concentration': None,\n", - " 'initial_expression': None,\n", - " 'initial_particle_number': None,\n", - " 'species_name': 'B',\n", - " 'unit': None}]},\n", - " 'model_id': 'BioModel',\n", - " 'model_language': 'sbml',\n", - " 'model_name': 'Bachmann2011',\n", - " 'model_source': 'sdfadf'}}\n" - ] - } - ], - "source": [ - "print(pf(copasi_process.model_dump()))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "7bca99082a8df8ef", - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/notebooks/parameter_scan.ipynb b/notebooks/parameter_scan.ipynb deleted file mode 100644 index 3915b5495..000000000 --- a/notebooks/parameter_scan.ipynb +++ /dev/null @@ -1,334 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "initial_id", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-05T20:03:39.588407Z", - "start_time": "2024-03-05T20:03:37.959396Z" - }, - "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", - "DeterministicTimeCourseParameterScan registered successfully.\n" - ] - } - ], - "source": [ - "import sys\n", - "\n", - "\n", - "sys.path.insert(0, '..')\n", - "import os\n", - "from process_bigraph import pp, pf\n", - "from biosimulator_processes.data_model import *\n", - "import numpy as np \n", - "from biosimulator_processes.biosimulator_builder import BiosimulatorBuilder" - ] - }, - { - "cell_type": "markdown", - "id": "178d4480c4770f6a", - "metadata": { - "collapsed": false - }, - "source": [ - "Choose an entrypoint to a non-spatial, COPASI/Tellurium-like simulation process and perform an n-iteration parameter scan of a selected parameter." - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "a81c920baf50d227", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-05T20:03:39.591344Z", - "start_time": "2024-03-05T20:03:39.589391Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "b = BiosimulatorBuilder()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "id": "608d3560b8dca4ab", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-05T20:03:39.594052Z", - "start_time": "2024-03-05T20:03:39.592267Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "# build process config\n", - "process_config = CopasiProcessConfigSchema(\n", - " process_name='parameter_scan',\n", - " model=TimeCourseModel(\n", - " model_source='../biosimulator_processes/model_files/Caravagna2010.xml',\n", - " model_id='Caravagna2010'\n", - " )\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "5965fb0e7363bbfd", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-05T20:03:39.617339Z", - "start_time": "2024-03-05T20:03:39.595258Z" - }, - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
compartmenttypeunitinitial_concentrationinitial_particle_numberinitial_expressionexpressionconcentrationparticle_numberrateparticle_number_ratekeysbml_id
name
Tcompartmentreactionsmmol/ml1.06.022141e+201.06.022141e+200.1799971.083967e+20Metabolite_0T
Ecompartmentreactionsmmol/ml1.06.022141e+201.06.022141e+20-0.010000-6.022137e+18Metabolite_1E
Icompartmentreactionsmmol/ml1.06.022141e+201.06.022141e+20-9.999512-6.021847e+21Metabolite_2I
\n", - "
" - ], - "text/plain": [ - " compartment type unit initial_concentration \\\n", - "name \n", - "T compartment reactions mmol/ml 1.0 \n", - "E compartment reactions mmol/ml 1.0 \n", - "I compartment reactions mmol/ml 1.0 \n", - "\n", - " initial_particle_number initial_expression expression concentration \\\n", - "name \n", - "T 6.022141e+20 1.0 \n", - "E 6.022141e+20 1.0 \n", - "I 6.022141e+20 1.0 \n", - "\n", - " particle_number rate particle_number_rate key sbml_id \n", - "name \n", - "T 6.022141e+20 0.179997 1.083967e+20 Metabolite_0 T \n", - "E 6.022141e+20 -0.010000 -6.022137e+18 Metabolite_1 E \n", - "I 6.022141e+20 -9.999512 -6.021847e+21 Metabolite_2 I " - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "from basico import load_model, get_species\n", - "\n", - "model = load_model('../biosimulator_processes/model_files/Caravagna2010.xml')\n", - "\n", - "get_species(model=model)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "46be2668efdfc8e", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-05T20:03:39.619681Z", - "start_time": "2024-03-05T20:03:39.617917Z" - }, - "collapsed": false - }, - "outputs": [], - "source": [ - "# build parameters to scan\n", - "scanned_parameters = [\n", - " ModelParameter(\n", - " name='T',\n", - " feature='initial_concentration',\n", - " value=25.0,\n", - " scope='species'\n", - " )\n", - "]" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "59a6dd39d4f665e1", - "metadata": { - "ExecuteTime": { - "end_time": "2024-03-05T20:03:39.907069Z", - "start_time": "2024-03-05T20:03:39.620252Z" - }, - "collapsed": false - }, - "outputs": [ - { - "ename": "TypeError", - "evalue": "DeterministicTimeCourseParameterScan.__init__() got an unexpected keyword argument 'core'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\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;43mparameter_scan\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;43mDeterministicTimeCourseParameterScan\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[43mn_iterations\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m100\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 4\u001b[0m \u001b[43m \u001b[49m\u001b[43mperturbation_magnitude\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m0.25\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 5\u001b[0m \u001b[43m \u001b[49m\u001b[43mparameters\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mscanned_parameters\u001b[49m\n\u001b[1;32m 6\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:124\u001b[0m, in \u001b[0;36mdeserialize_step\u001b[0;34m(schema, encoded, core)\u001b[0m\n\u001b[1;32m 119\u001b[0m config \u001b[38;5;241m=\u001b[39m core\u001b[38;5;241m.\u001b[39mhydrate_state(\n\u001b[1;32m 120\u001b[0m instantiate\u001b[38;5;241m.\u001b[39mconfig_schema,\n\u001b[1;32m 121\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 123\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--> 124\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 125\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 127\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", - "\u001b[0;31mTypeError\u001b[0m: DeterministicTimeCourseParameterScan.__init__() got an unexpected keyword argument 'core'" - ] - } - ], - "source": [ - "b['parameter_scan'].add_process(\n", - " name='DeterministicTimeCourseParameterScan',\n", - " n_iterations=100,\n", - " perturbation_magnitude=0.25,\n", - " parameters=scanned_parameters\n", - ")" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "74c9c1bbdb0058f4", - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.6" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/scripts/fix_notebooks.py b/scripts/fix_notebooks.py index b1e1481da..88dc52b15 100644 --- a/scripts/fix_notebooks.py +++ b/scripts/fix_notebooks.py @@ -17,7 +17,7 @@ def fix_execution_count(notebook_path): if __name__ == '__main__': - root = "notebooks" + root = "composer-notebooks" for f in os.listdir(root): fp = os.path.join(root, f) print(fp) diff --git a/scripts/trust-notebooks.sh b/scripts/trust-notebooks.sh index 0dc85c0f0..602272a98 100644 --- a/scripts/trust-notebooks.sh +++ b/scripts/trust-notebooks.sh @@ -1,4 +1,4 @@ #!/bin/bash -# Trust all notebooks in a specific directory +# Trust all composer-notebooks in a specific directory find /app/notebooks -name "*.ipynb" -exec jupyter trust {} \;