API documentation
Convert YAML to SBML
Translate ODEs in the YAML format into SBML.
- yaml2sbml.yaml2sbml.yaml2sbml(yaml_dir, sbml_dir, observables_as_assignments=False)[source]
Parse a YAML file with the specification of ODEs and write it to SBML.
SBML is written within this function. If observables_as_assignments=True, observables will be translated into parameter assignments of the form observable_<observable_id>.
Validate YAML file
Convert YAML to PEtab
- yaml2sbml.yaml2petab(yaml_dir, output_dir, sbml_name, petab_yaml_name=None, measurement_table_name=None)[source]
Translate a YAML model into a PEtab model.
Takes a YAML file with the ODE specification, parses it, converts it into SBML format, and writes the SBML file. Further it translates the given information into PEtab tables.
If a petab_yaml_name is given, a YAML file is created, that organizes the PEtab problem. If additionally a measurement_table_file_name is specified, this file name is written into the created YAML file.
- Parameters
yaml_dir (
str
) – path to the YAML file with the ODEs specificationoutput_dir (
str
) – path the output file(s) are be written outsbml_name (
str
) – name of SBML modelpetab_yaml_name (
Optional
[str
]) – name of YAML organizing the PEtab problem.measurement_table_name (
Optional
[str
]) – Name of measurement table
Validate PEtab tables
Model editor
- class yaml2sbml.YamlModel[source]
Functionality to set up, edit, load and write yaml models.
- add_assignment(assignment_id, formula, overwrite=False)[source]
Add assignment.
Overwrite an existing assignment with the same id, if overwrite==True.
- add_condition(condition_id, condition_dict, overwrite=False, condition_name=None)[source]
Add condition condition_id.
Conditions are not represented inside an SBML and only play a role when generating a PEtab problem (see PEtabs condition table).
Overwrite an existing condition with the same id, if overwrite==True.
- add_function(function_id, arguments, formula, overwrite=False)[source]
Add function.
Overwrite an existing function with the same id, if overwrite==True.
- add_observable(observable_id, observable_formula, noise_formula, overwrite=False, observable_name=None, observable_transformation=None, noise_distribution=None)[source]
Add observable.
Observables are not represented inside an SBML and only play a role when generating a PEtab problem see PEtabs observable table).
Overwrite an existing observable with the same id, if overwrite==True.
- Parameters
observable_id (
str
) – str, observable idobservable_formula (
str
) – str, formula of the observable functionnoise_formula (
str
) – str, formula of the noiseoverwrite (
bool
) – bool, indicates if an existing observable should be overwrittenobservable_name (
Optional
[str
]) – Observable name. Optional.observable_transformation (
Optional
[str
]) – Observable transformation (‘lin’/’log’/’log10’). Optional
- add_ode(state_id, right_hand_side, initial_value, overwrite=False)[source]
Add state/ODE.
Overwrite an existing state/ODE with the same id, if overwrite==True.
- add_parameter(parameter_id, overwrite=False, nominal_value=None, parameter_name=None, parameter_scale=None, lower_bound=None, upper_bound=None, estimate=None)[source]
Add a parameter.
Overwrite an existing parameter with the same id, if overwrite==True.
- Parameters
parameter_id (
str
) – str, parameter idoverwrite (
bool
) – bool, indicates if an existing state/ODE should be overwrittennominal_value (
Optional
[float
]) – float, nominal value of the parameter.parameter_name (
Optional
[str
]) – str, name of parameter in PEtab parameter table, optional.parameter_scale (
Optional
[str
]) – str. scale of parameter in PEtab parameter table, optional.lower_bound (
Optional
[float
]) – float, lower bound of parameter in PEtab parameter table, optional.upper_bound (
Optional
[float
]) – float, upper bound of parameter in PEtab parameter table, optional.estimate (
Optional
[int
]) – int, estimate flag of parameter in PEtab parameter table, optional.
- delete_assignment(assignment_id)[source]
Delete an assignment.
Raise a ValueError, if assignment does not exist.
- delete_condition(condition_id)[source]
Delete a condition.
Raise a ValueError, if condition does not exist.
- delete_function(function_id)[source]
Delete a function.
Raise a ValueError, if function does not exist.
- delete_observable(observable_id)[source]
Delete an observable.
Raise a ValueError, if observable does not exist.
- delete_parameter(parameter_id)[source]
Delete a parameter.
Raise a ValueError, if parameter does not exist.
- get_assignment_by_id(assignment_id)[source]
Return dict for corresponding assignment.
Raise a ValueError, if the assignment does not exist.
- get_condition_by_id(condition_id)[source]
Return dict for corresponding condition.
Raise a ValueError, if the condition does not exist.
- get_function_by_id(function_id)[source]
Return dict for corresponding function.
Raise a ValueError, if the function does not exist.
- get_observable_by_id(observable_id)[source]
Return dict for corresponding observable.
Raise a ValueError, if the observable does not exist.
- get_ode_by_id(state_id)[source]
Return dict for corresponding ODE/state.
Raise a ValueError, if the ODE/state does not exist.
- get_parameter_by_id(parameter_id)[source]
Return dict for corresponding parameter.
Raise a `ValueError, if the parameter does not exist.
- static load_from_yaml(yaml_dir)[source]
Create a model instance from a YAML file.
- Parameters
yaml_dir (
str
) – directory to the YAML file, that should be imported- Returns
new model
- Return type
cls
- write_to_petab(output_dir, model_name, petab_yaml_name=None, measurement_table_name=None)[source]
Write the YamlModel as a PEtab problem.
Equivalent to calling `yaml2petab on the file produced by the YAML output.
If a `petab_yaml_name is given, a YAML file is created, that organizes the petab problem. If additionally a `measurement_table_file_name is specified, this file name is written into the created YAML file.
- write_to_sbml(sbml_dir, overwrite=False)[source]
Write the model as an SBML file to the directory given in sbml_dir.
- Parameters
- Raises