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

Commit

Permalink
added granular species pydantic types
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexPatrie committed Mar 1, 2024
1 parent fbdba63 commit f6a031b
Show file tree
Hide file tree
Showing 4 changed files with 1,510 additions and 1,565 deletions.
42 changes: 38 additions & 4 deletions biosimulator_processes/process_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from abc import ABC, abstractmethod


class ModelChange(BaseModel):
'''class ModelChange(BaseModel):
config: Union[Dict[str, Dict[str, Dict[str, Union[float, str]]]], Dict[str, Dict[str, Union[Dict[str, float], str]]]]
Expand Down Expand Up @@ -51,7 +51,7 @@ class SedModel(BaseModel):
model_source: str
model_language: str = 'sbml'
model_name: str = 'composite_process_model'
model_changes: ModelChanges
model_changes: ModelChanges'''


changes = {
Expand All @@ -72,10 +72,44 @@ class SedModel(BaseModel):
}
}


class SpeciesChanges(BaseModel): # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs
species_name: str
unit: str
initial_concentration: float
initial_particle_number: float
initial_expression: str
expression: str


class GlobalParameterChanges(BaseModel): # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs
parameter_name: str
initial_value: float
initial_expression: str
expression: str
status: str
param_type: str # ie: fixed, assignment, reactions, etc


class ReactionParameter(BaseModel):
name: str
value: Union[float, int, str]


class ReactionChanges(BaseModel):
reaction_name: str
reaction_parameters: Dict[str, ReactionParameter]
reaction_scheme: str


# class ModelChanges:



CHANGES_SCHEMA = """The following types have been derived from both SEDML L1v4 and basico itself.
BASICO_MODEL_CHANGES_TYPE = {
'species_changes': { # <-- this is done like set_species('B', kwarg=) where the inner most keys are the kwargs
'species_changes': {
'species_name': {
'unit': 'maybe[string]',
'initial_concentration': 'maybe[float]',
Expand All @@ -84,7 +118,7 @@ class SedModel(BaseModel):
'expression': 'maybe[string]'
}
},
'global_parameter_changes': { # <-- this is done with set_parameters(PARAM, kwarg=). where the inner most keys are the kwargs
'global_parameter_changes': {
'global_parameter_name': {
'initial_value': 'maybe[float]',
'initial_expression': 'maybe[string]',
Expand Down
4 changes: 2 additions & 2 deletions biosimulator_processes/processes/copasi_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,5 +328,5 @@ def test_process():
assert ('emitter',) in results.keys(), "This instance was not properly configured with an emitter."


if __name__ == "__main__":
test_process()
# if __name__ == "__main__":
# test_process()
Loading

0 comments on commit f6a031b

Please sign in to comment.