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

Commit

Permalink
updated process_types script decs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Feb 28, 2024
1 parent 52c2727 commit dedd260
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 42 deletions.
72 changes: 39 additions & 33 deletions biosimulator_processes/process_types.py
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
"""The following types have been derived from both SEDML L1v4 and basico itself."""
"""The following types have been derived from both SEDML L1v4 and basico itself.
BASICO_MODEL_CHANGES_TYPE = {
'model_changes': {
'species_changes': { # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs
'species_name': {
'new_unit_for_species_name': 'maybe[string]',
'new_initial_concentration_for_species_name': 'maybe[float]',
'new_initial_particle_number_for_species_name': 'maybe[float]',
'new_initial_expression_for_species_name': 'maybe[string]',
'new_expression_for_species_name': 'maybe[string]'
}
},
'global_parameter_changes': { # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs
'global_parameter_name': {
'new_initial_value_for_global_parameter_name': 'maybe[float]',
'new_initial_expression_for_global_parameter_name': 'maybe[string]',
'new_expression_for_global_parameter_name': 'maybe[string]',
'new_status_for_global_parameter_name': 'maybe[string]',
'new_type_for_global_parameter_name': 'maybe[string]' # (ie: fixed, assignment, reactions)
}
},
'reaction_changes': {
'reaction_name': {
'reaction_parameters': {
'reaction_parameter_name': 'maybe[int]' # (new reaction_parameter_name value) <-- this is done with set_reaction_parameters(name="(REACTION_NAME).REACTION_NAME_PARAM", value=VALUE)
},
'reaction_scheme': 'maybe[string]' # <-- this is done like set_reaction(name = 'R1', scheme = 'S + E + F = ES')
}
}
}
}
BASICO_MODEL_CHANGES_TYPE = {
'species_changes': { # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs
'species_name': {
'unit': 'maybe[string]',
'initial_concentration': 'maybe[float]',
'initial_particle_number': 'maybe[float]',
'initial_expression': 'maybe[string]',
'expression': 'maybe[string]'
}
},
'global_parameter_changes': { # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs
'global_parameter_name': {
'initial_value': 'maybe[float]',
'initial_expression': 'maybe[string]',
'expression': 'maybe[string]',
'status': 'maybe[string]',
'type': 'maybe[string]' # (ie: fixed, assignment, reactions)
}
},
'reaction_changes': {
'reaction_name': {
'parameters': {
'reaction_parameter_name': 'maybe[int]' # (new reaction_parameter_name value) <-- this is done with set_reaction_parameters(name="(REACTION_NAME).REACTION_NAME_PARAM", value=VALUE)
},
'reaction_scheme': 'maybe[string]' # <-- this is done like set_reaction(name = 'R1', scheme = 'S + E + F = ES')
}
}
}
"""


# The first 3 params are NOT optional below for a Model in SEDML. model_source has been adapted to mean point of residence
Expand All @@ -45,7 +44,14 @@
'_default': 'composite_process_model'
},
'model_changes': {
'_type': 'tree[string]',
'_default': BASICO_MODEL_CHANGES_TYPE
'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]'
}
}


# ^ 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.
15 changes: 6 additions & 9 deletions biosimulator_processes/processes/copasi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CopasiProcess(Process):
Entrypoints:
A. SBML model file:
B. Reactions (name: {scheme: reaction contents(also defines species))
B. Reactions (name: {scheme: reaction contents(also defines species)) 'model'.get('model_changes')
C. Model search term (load preconfigured model from BioModels)
Optional Parameters:
Expand Down Expand Up @@ -63,10 +63,7 @@ class CopasiProcess(Process):
'reaction_scheme': 'string' # <-- this is done like set_reaction(name = 'R1', scheme = 'S + E + F = ES')
}
}
^ 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.
B. 'method', changes the algorithm(s) used to solve the model
C. 'units', (tree): quantity, volume, time, area, length
Expand All @@ -75,18 +72,18 @@ class CopasiProcess(Process):
As per SEDML v4 specifications (section2.2.4), p.32:sed-ml-L1V4.
"""
# TODO: map this to SED syntax

config_schema = {
'model': { # <-- sourced from SEDML L1v4
'model': {
'_type': 'tree[string]',
'_default': MODEL_TYPE
},
'biomodel_id': 'string', # <-- implies the lack of either model_file or model_reactions
'units': 'maybe[tree[string]]',
'method': {
'_type': 'string',
'_default': 'lsoda'
},
'units': 'tree[string]'
}
}

def __init__(self, config=None, core=None):
Expand Down

0 comments on commit dedd260

Please sign in to comment.