petab.sbml¶
Functions for direct access of SBML models
Functions
add_global_parameter (sbml_model, …) |
Add new global parameter to SBML model |
add_model_output (sbml_model, observable_id, …) |
Add PEtab-style output to model |
add_model_output_sigma (sbml_model, …) |
Add PEtab-style sigma for the given observable id |
add_model_output_with_sigma (sbml_model, …) |
Add PEtab-style output and corresponding sigma with single (newly created) parameter |
assignment_rules_to_dict (sbml_model[, …]) |
Turn assignment rules into dictionary. |
constant_species_to_parameters (sbml_model) |
Convert constant species in the SBML model to constant parameters. |
create_assigment_rule (sbml_model, …) |
Create SBML AssignmentRule |
globalize_parameters (sbml_model, …) |
Turn all local parameters into global parameters with the same properties |
is_sbml_consistent (sbml_document, check_units) |
Check for SBML validity / consistency |
log_sbml_errors (sbml_document[, …]) |
Log libsbml errors |
-
petab.sbml.
add_global_parameter
(sbml_model: libsbml.Model, parameter_id: str, parameter_name: str = None, constant: bool = False, units: str = 'dimensionless', value: float = 0.0) → libsbml.Parameter¶ Add new global parameter to SBML model
-
petab.sbml.
add_model_output
(sbml_model: libsbml.Model, observable_id: str, formula: str, observable_name: str = None) → None¶ Add PEtab-style output to model
We expect that all formula parameters are added to the model elsewhere.
Parameters: - sbml_model – Model to add output to
- formula – Formula string for model output
- observable_id – ID without “observable_” prefix
- observable_name – Any observable name
-
petab.sbml.
add_model_output_sigma
(sbml_model: libsbml.Model, observable_id: str, formula: str)¶ Add PEtab-style sigma for the given observable id
We expect that all formula parameters are added to the model elsewhere.
Parameters: - sbml_model – Model to add to
- observable_id – Observable id for which to add sigma
- formula – Formula for sigma
-
petab.sbml.
add_model_output_with_sigma
(sbml_model: libsbml.Model, observable_id: str, observable_formula: str, observable_name: str = None)¶ Add PEtab-style output and corresponding sigma with single (newly created) parameter
We expect that all formula parameters are added to the model elsewhere.
Parameters: - sbml_model – Model to add output to
- observable_formula – Formula string for model output
- observable_id – ID without “observable_” prefix
- observable_name – Any name
-
petab.sbml.
assignment_rules_to_dict
(sbml_model: libsbml.Model, filter_function=<function <lambda>>, remove: bool = False) → Dict[str, Dict[str, Any]]¶ Turn assignment rules into dictionary.
Parameters: - sbml_model – a sbml model instance.
- filter_function – callback function taking assignment variable as input and returning True/False to indicate if the respective rule should be turned into an observable.
- remove – Remove the all matching assignment rules from the model
Returns: { assigneeId: { 'name': assigneeName, 'formula': formulaString } }
-
petab.sbml.
constant_species_to_parameters
(sbml_model: libsbml.Model) → list¶ Convert constant species in the SBML model to constant parameters.
This can be used e.g. for setting up models with condition-specific constant species for PEtab, since there it is not possible to specify constant species in the condition table.
Parameters: sbml_model – libsbml model instance Returns: species IDs that have been turned into constants
-
petab.sbml.
create_assigment_rule
(sbml_model: libsbml.Model, assignee_id: str, formula: str, rule_id: str = None, rule_name: str = None) → libsbml.AssignmentRule¶ Create SBML AssignmentRule
Parameters: - sbml_model – Model to add output to
- assignee_id – Target of assignment
- formula – Formula string for model output
- rule_id – SBML id for created rule
- rule_name – SBML name for created rule
-
petab.sbml.
globalize_parameters
(sbml_model: libsbml.Model, prepend_reaction_id: bool = False) → None¶ Turn all local parameters into global parameters with the same properties
Local parameters are currently ignored by other PEtab functions. Use this function to convert them to global parameters. There may exist local parameters with identical IDs within different kinetic laws. This is not checked here. If in doubt that local parameter IDs are unique, enable prepend_reaction_id to create global parameters named ${reaction_id}_${local_parameter_id}.
Parameters: - sbml_model – The SBML model to operate on
- prepend_reaction_id – Prepend reaction id of local parameter when creating global parameters
-
petab.sbml.
is_sbml_consistent
(sbml_document: libsbml.SBMLDocument, check_units: bool = False)¶ Check for SBML validity / consistency
Parameters: - sbml_document – SBML document to check
- check_units – Also check for unit-related issues
Returns: False if problems were detected, otherwise True
-
petab.sbml.
log_sbml_errors
(sbml_document: libsbml.SBMLDocument, minimum_severity=1) → None¶ Log libsbml errors
Parameters: - sbml_document – SBML document to check
- minimum_severity – Minimum severity level to report (see libsbml)