model.symbols¶
The symbols of a model which a simulation can change.
A target of a change is named like a selection of roadrunner: S is the
amount of a species, [S] its concentration, a parameter or a compartment is
its id. ModelSymbols reads what the targets of a model are from its SBML once
and answers what kind a target is, which the compile step and the executor
need: a compartment change keeps the concentration of the species in it, a
parameter with an initial assignment cannot be set before the initialization
without deriving the model, and the target of an assignment rule cannot be set
at all.
EventSymbols
dataclass
¶
EventSymbols(
eid,
trigger,
delayed,
assignments,
priority=None,
use_values_from_trigger_time=True,
persistent=True,
)
An event of a model in the selections of roadrunner.
The executor fires an event whose trigger a change of a simulation makes
true, which roadrunner does not, see sbmlsim.simulator.executor.
Attributes:
| Name | Type | Description |
|---|---|---|
eid |
str
|
id of the event. |
trigger |
str | None
|
the trigger, a formula of selections, see
|
delayed |
bool
|
whether the event has a delay. |
assignments |
tuple[tuple[str, str], ...]
|
the selection and the formula of every assignment. |
priority |
str | None
|
the priority formula, or |
use_values_from_trigger_time |
bool
|
evaluate assignments when triggered. |
persistent |
bool
|
keep the event when its trigger becomes false. |
TargetKind
¶
Bases: StrEnum
The kind of a target of a change.
ModelSymbols
dataclass
¶
ModelSymbols(
parameters,
compartments,
species,
species_compartment,
only_substance,
initial_assignments,
assignment_rules,
rate_rules,
initial_assignment_order=(),
initial_assignment_dependencies=None,
initial_concentration=frozenset(),
events=(),
time_dependent=False,
)
The entities of a model a simulation refers to.
Attributes:
| Name | Type | Description |
|---|---|---|
parameters |
frozenset[str]
|
ids of the global parameters. |
compartments |
frozenset[str]
|
ids of the compartments. |
species |
frozenset[str]
|
ids of the species. |
species_compartment |
dict[str, str]
|
species -> its compartment. |
only_substance |
frozenset[str]
|
species with |
initial_assignments |
frozenset[str]
|
entities with an initial assignment. |
assignment_rules |
frozenset[str]
|
entities which are the variable of an assignment rule. |
rate_rules |
frozenset[str]
|
entities which are the variable of a rate rule. |
initial_assignment_order |
tuple[str, ...]
|
the entities with an initial assignment, an assignment after the ones it reads. |
initial_assignment_dependencies |
dict[str, frozenset[str]] | None
|
entity with an initial assignment -> the entities its math reads, through assignment rules. |
initial_concentration |
frozenset[str]
|
species whose initial value is a concentration, which a change of their compartment before the initialization keeps. |
events |
tuple[EventSymbols, ...]
|
the symbols of the events. |
time_dependent |
bool
|
whether a math of the model reads the csymbol time or
delay, or an event has a delay, see |
from_sbml
classmethod
¶
Read the symbols of a model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sbml
|
str | Path
|
path of the SBML file or the SBML itself. |
required |
Returns:
| Type | Description |
|---|---|
ModelSymbols
|
The symbols of the model. |
entity
staticmethod
¶
Get the entity of a target, the species of a concentration [S].
kind
¶
Get the kind of a target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
TargetKind
|
The kind of the target. |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the model has no such entity, if a concentration is not one of a species, or if the entity is the variable of an assignment rule, which a change cannot set. |