Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
updated utils function to implement entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Feb 29, 2024
1 parent c313924 commit bfda29c
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 7,483 deletions.
13 changes: 4 additions & 9 deletions biosimulator_processes/process_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@

# The first 3 params are NOT optional below for a Model in SEDML. model_source has been adapted to mean point of residence
MODEL_TYPE = {
'model_id': 'string', # could be used as the BioModels id
'model_source': 'string', # could be used as the "model_file" below (SEDML l1V4 uses URIs); what if it was 'model_source': 'sbml:model_filepath' ?
'model_id': 'string',
'model_source': 'string', # could be used as the "model_file" or "biomodel_id" below (SEDML l1V4 uses URIs); what if it was 'model_source': 'sbml:model_filepath' ?
'model_language': { # could be used to load a different model language supported by COPASI/basico
'_type': 'string',
'_default': 'sbml' # perhaps concatenate this with 'model_source'.value? I.E: 'model_source': 'MODEL_LANGUAGE:MODEL_FILEPATH' <-- this would facilitate verifying correct model fp types.
Expand All @@ -47,11 +47,6 @@
'species_changes': 'tree[string]', # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs
'global_parameter_changes': 'tree[string]', # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs
'reaction_changes': 'tree[string]'
}
},
'model_units': 'tree[string]'
}


# ^ Here, the model changes would be applied in either two ways:
# A. (model_file/biomodel_id is passed): after model instatiation in the constructor
# B. (no model_file or biomodel_id is passed): used to extract reactions. Since adding reactions to an empty model technically
# is an act of "changing" the model (empty -> context), it is safe to say that you must pass 'model': {'model_changes': etc...} instead.
4 changes: 1 addition & 3 deletions biosimulator_processes/processes/copasi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class CopasiProcess(Process):
'reaction_changes': {
'reaction_name': {
'reaction_parameters': {
reaction_parameter_name: 'int' # (new reaction_parameter_name value) <-- this is done with set_reaction_parameters(name="(REACTION_NAME).REACTION_NAME_PARAM", value=VALUE)
reaction_parameter_name: 'float' # (new reaction_parameter_name value) <-- this is done with set_reaction_parameters(name="(REACTION_NAME).REACTION_NAME_PARAM", value=VALUE)
},
'reaction_scheme': 'string' # <-- this is done like set_reaction(name = 'R1', scheme = 'S + E + F = ES')
}
Expand Down Expand Up @@ -111,8 +111,6 @@ class CopasiProcess(Process):

config_schema = {
'model': MODEL_TYPE,
'biomodel_id': 'maybe[string]', # <-- implies the lack of either model_file or model_reactions
'units': 'tree[string]',
'method': {
'_type': 'string',
'_default': 'deterministic'
Expand Down
16 changes: 10 additions & 6 deletions biosimulator_processes/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Dict
from basico import biomodels, load_model_from_string
from process_bigraph import Composite, pf
from pydantic import BaseModel


def fetch_biomodel_by_term(term: str, index: int = 0):
Expand Down Expand Up @@ -101,6 +102,12 @@ def generate_emitter_schema(
emitter_type: str = "ram-emitter",
**emit_values_schema
) -> Dict:
"""
Args:
**emit_values_schema:`kwargs`: values to be emitted by the address
"""
return {
'_type': 'step',
'address': 'local:ram-emitter',
Expand Down Expand Up @@ -211,12 +218,9 @@ def generate_sed_model_config_schema(
}

for param_name, param_val in entrypoint.items():
if 'biomodel' in param_name.lower():
instance_schema[param_name] = param_val
elif 'model_source' in param_name.lower():
instance_schema['model'][param_name] = {
param_name: param_val
}
instance_schema['model'][param_name] = {
param_name: param_val
}

return instance_schema

Expand Down
Empty file removed builder/__init__.py
Empty file.
Empty file removed builder/containers/__init__.py
Empty file.
72 changes: 0 additions & 72 deletions builder/containers/container-assets/Dockerfile-base

This file was deleted.

Loading

0 comments on commit bfda29c

Please sign in to comment.