Model: services
ModelComponentsService
Ergonomic typed service for model component operations.
Recommended default for component work. This wraps model-head reads/writes and exposes subtype-specific create/get/list helpers.
Returned by: Model.components
| Member | Kind | Description |
|---|---|---|
list | method | Return all components as typed wrapper handles. |
search | method | Search model components and optionally print the results as a table. |
list_parameters | method | List parameters as typed wrappers. |
list_species | method | List species as typed wrappers (filtered view over list()). |
list_compartments | method | List compartments as typed wrappers (filtered view over list()). |
list_reactions | method | List reactions as typed wrappers (filtered view over list()). |
list_events | method | List events as typed wrappers (filtered view over list()). |
list_odes | method | List ODEs as typed wrappers (filtered view over list()). |
list_categorical_parameters | method | List categorical parameters as typed wrappers. |
list_baseline_checks | method | List baseline checks as typed wrappers. |
list_algebraic_rules | method | List algebraic rules as typed wrappers. |
get | method | Return a component by id as a typed runtime wrapper. |
get_by_immutable_id | method | Return a component by immutable id. |
get_parameter | method | Get a parameter by id and enforce parameter type. |
get_species | method | Get a species by id and enforce species type. |
get_compartment | method | Get a compartment by id and enforce compartment type. |
get_reaction | method | Get a reaction by id and enforce reaction type. |
get_event | method | Get an event by id and enforce event type. |
get_ode | method | Get an ODE by id and enforce ODE type. |
get_categorical_parameter | method | Get a categorical parameter by id and enforce expected type. |
get_baseline_check | method | Get a baseline check by id and enforce expected type. |
get_algebraic_rule | method | Get an algebraic rule by id and enforce expected type. |
clone | method | Clone a persisted component and commit immediately. |
create_parameter | method | Create a parameter and commit immediately. |
create_species | method | Create a species and commit immediately. compartment should match a valid compartment component id. |
create_compartment | method | Create a compartment and commit immediately. |
create_event | method | Create an event and commit immediately. |
create_ode | method | Create an ODE and commit immediately. |
create_categorical_parameter | method | Create a categorical parameter and commit immediately. |
create_baseline_check | method | Create a baseline check and commit immediately. |
create_algebraic_rule | method | Create an algebraic rule and commit immediately. |
create_general_reaction | method | Create a reaction using the General kinetics law. |
create_mass_action_reaction | method | Create a reaction using the Mass Action kinetics law. |
create_michaelis_menten_reaction | method | Create a reaction using the Michaelis-Menten kinetics law. |
create_reversible_michaelis_menten_reaction | method | Create a reaction using Reversible Michaelis-Menten kinetics. |
create_hill_equation_reaction | method | Create a reaction using the Hill equation kinetics law. |
create_enzymatic_activation_reaction | method | Create a reaction using enzymatic activation kinetics. |
create_competitive_inhibition_reaction | method | Create a reaction using competitive inhibition kinetics. |
create_uncompetitive_inhibition_reaction | method | Create a reaction using uncompetitive inhibition kinetics. |
create_mixed_inhibition_reaction | method | Create a reaction using mixed inhibition kinetics. |
batch | method | Start a staged component edit batch. |
list
list(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[ModelComponentHandle]
Return all components as typed wrapper handles.
search
search(
text: str | None = None,
*,
ids: Sequence[str] | None = None,
kinds: str | Sequence[str] | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None,
has_errors: bool | None = None,
has_warnings: bool | None = None,
diagnostic_codes: Sequence[str] | None = None,
limit: int | None = 100,
order_by: Literal[
"id", "kind", "display_name", "description", "errors", "warnings"
] = "id",
desc_order: bool = False,
show_table: bool = True,
show_table_hint: bool = True,
columns: Literal["compact", "all"] | List[ComponentSearchColumn] = "all",
table_color: bool = True
) -> List[ModelComponentHandle]
Search model components and optionally print the results as a table.
list_parameters
list_parameters(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[ParameterComponent]
List parameters as typed wrappers.
This is a filtered view over list().
list_species
list_species(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[SpeciesComponent]
List species as typed wrappers (filtered view over list()).
list_compartments
list_compartments(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[CompartmentComponent]
List compartments as typed wrappers (filtered view over list()).
list_reactions
list_reactions(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[ReactionComponent]
List reactions as typed wrappers (filtered view over list()).
list_events
list_events(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[EventComponent]
List events as typed wrappers (filtered view over list()).
list_odes
list_odes(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[OdeComponent]
List ODEs as typed wrappers (filtered view over list()).
list_categorical_parameters
list_categorical_parameters(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[CategoricalParameterComponent]
List categorical parameters as typed wrappers.
list_baseline_checks
list_baseline_checks(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[BaselineCheckComponent]
List baseline checks as typed wrappers.
list_algebraic_rules
list_algebraic_rules(
*,
limit: int | None = None,
tags_all: Sequence[str | "Tag"] | None = None,
tags_any: Sequence[str | "Tag"] | None = None
) -> List[AlgebraicRuleComponent]
List algebraic rules as typed wrappers.
get
get(component_id: str) -> ModelComponentHandle
Return a component by id as a typed runtime wrapper.
Use typed getters like get_parameter when the subtype is known.
get_by_immutable_id
get_by_immutable_id(immutable_id: str) -> ModelComponentHandle
Return a component by immutable id.
get_parameter
get_parameter(component_id: str) -> ParameterComponent
Get a parameter by id and enforce parameter type.
get_species
get_species(component_id: str) -> SpeciesComponent
Get a species by id and enforce species type.
get_compartment
get_compartment(component_id: str) -> CompartmentComponent
Get a compartment by id and enforce compartment type.
get_reaction
get_reaction(component_id: str) -> ReactionComponent
Get a reaction by id and enforce reaction type.
get_event
get_event(component_id: str) -> EventComponent
Get an event by id and enforce event type.
get_ode
get_ode(component_id: str) -> OdeComponent
Get an ODE by id and enforce ODE type.
get_categorical_parameter
get_categorical_parameter(
component_id: str,
) -> CategoricalParameterComponent
Get a categorical parameter by id and enforce expected type.
get_baseline_check
get_baseline_check(component_id: str) -> BaselineCheckComponent
Get a baseline check by id and enforce expected type.
get_algebraic_rule
get_algebraic_rule(component_id: str) -> AlgebraicRuleComponent
Get an algebraic rule by id and enforce expected type.
clone
clone(
source: ModelComponentHandle, *, new_id: str | None
) -> ModelComponentHandle
Clone a persisted component and commit immediately.
Returns a persisted typed wrapper for the new component.
create_parameter
create_parameter(
*,
id: str,
formula: float | str,
unit: str | None = None,
constant: bool | None = None,
scale: float | str | None = None,
tolerance: float = 1,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ParameterComponent
Create a parameter and commit immediately.
p = model.components.create_parameter(id="k_new", formula=1.2, unit="1/h")
constantis forwarded as-is. If left asNone, the API applies its own default behavior (expected default:false).
create_species
create_species(
*,
id: str,
compartment: str,
initial_condition: float | str,
unit: str | None = None,
constant: bool = False,
boundary_condition: bool | None = None,
conversion_factor: str | None = None,
molar_mass: float | str | None = None,
scale: float | str | None = None,
tolerance: float = 1,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> SpeciesComponent
Create a species and commit immediately.
compartment should match a valid compartment component id.
create_compartment
create_compartment(
*,
id: str,
volume: float | str,
unit: str | None = None,
constant: bool = False,
scale: float | str | None = None,
tolerance: float = 1,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> CompartmentComponent
Create a compartment and commit immediately.
create_event
create_event(
*,
id: str,
updates: dict[str, Any],
condition_trigger: str | None = None,
time_trigger_first_time: float | str | None = None,
time_trigger_every: float | str | None = None,
time_trigger_count: float | str | None = None,
time_trigger_until: float | str | None = None,
priority: float | str | None = None,
solver_stop: bool | None = None,
persistent: bool | None = None,
initial_value: bool | None = None,
use_values_from_trigger_time: bool | None = None,
record: bool | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> EventComponent
Create an event and commit immediately.
- Accepted time trigger combinations are:
first_timeonly;first_time+every;first_time+every+count;first_time+every+until. countanduntilare mutually exclusive.count=1withouteveryis treated as a one-shot trigger and normalized as ifcountwas omitted.- For optional trigger/behavior flags (
persistent,initial_value,record,use_values_from_trigger_time,solver_stop),Nonemeans "let the API apply its expected default behavior". - Expected API defaults are:
persistent=true,initial_value=false,record=false,use_values_from_trigger_time=false.
create_ode
create_ode(
*,
id: str,
left_side: str,
right_side: float | str,
filter: str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> OdeComponent
Create an ODE and commit immediately.
create_categorical_parameter
create_categorical_parameter(
*,
id: str,
level: str,
available_levels: List[str],
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> CategoricalParameterComponent
Create a categorical parameter and commit immediately.
create_baseline_check
create_baseline_check(
*,
id: str,
condition: str,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> BaselineCheckComponent
Create a baseline check and commit immediately.
create_algebraic_rule
create_algebraic_rule(
*,
id: str,
equation: float | str,
filter: str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> AlgebraicRuleComponent
Create an algebraic rule and commit immediately.
create_general_reaction
create_general_reaction(
*,
id: str,
reactants: dict[str, Any],
products: dict[str, Any],
rate: float | str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using the General kinetics law.
create_mass_action_reaction
create_mass_action_reaction(
*,
id: str,
reactants: dict[str, Any],
products: dict[str, Any],
k_plus: str,
k_minus: str | None = None,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using the Mass Action kinetics law.
create_michaelis_menten_reaction
create_michaelis_menten_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
k_cat: str,
k_m: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using the Michaelis-Menten kinetics law.
create_reversible_michaelis_menten_reaction
create_reversible_michaelis_menten_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
k_cat: str,
k_m: str,
k_inv: str,
k_p: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using Reversible Michaelis-Menten kinetics.
create_hill_equation_reaction
create_hill_equation_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
k_cat: str,
k_m: str,
hill_coefficient: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using the Hill equation kinetics law.
create_enzymatic_activation_reaction
create_enzymatic_activation_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
activator: str,
k_cat: str,
k_m: str,
k_a: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using enzymatic activation kinetics.
create_competitive_inhibition_reaction
create_competitive_inhibition_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
inhibitor: str,
k_cat: str,
k_m: str,
k_i_enzyme: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using competitive inhibition kinetics.
create_uncompetitive_inhibition_reaction
create_uncompetitive_inhibition_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
inhibitor: str,
k_cat: str,
k_m: str,
k_i_enzymatic_complex: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using uncompetitive inhibition kinetics.
create_mixed_inhibition_reaction
create_mixed_inhibition_reaction(
*,
id: str,
substrate: str,
product: str,
enzyme: str,
inhibitor: str,
k_cat: str,
k_m: str,
k_i_enzyme: str,
k_i_enzymatic_complex: str,
filter: str | None = None,
rate_multiplier: float | str | None = None,
description: str | None = None,
display_name: str | None = None,
tags: Sequence[str | Tag] | None = None,
links: Sequence[str | ProjectItem] | None = None
) -> ReactionComponent
Create a reaction using mixed inhibition kinetics.
batch
batch(*, version: str | dict | None = None) -> ComponentsBatch
Start a staged component edit batch.
batch() snapshots the model component list once at creation time,
then stages edits locally until commit() or context-manager exit.
with model.components.batch(version="retune") as b:
b.edit_parameter("k").set_formula("CL / V")
b.create_parameter(id="k_new", formula=1.2)