petab.yaml

Code regarding the PEtab YAML config files

Functions

add_constructor
add_implicit_resolver
add_multi_constructor
add_multi_representer
add_path_resolver
add_representer
compose
compose_all
dump
dump_all
emit
full_load
full_load_all
load
load_all
load_warning
parse
safe_dump
safe_dump_all
safe_load
safe_load_all
scan
serialize
serialize_all
unsafe_load
unsafe_load_all
warnings Python part of the warnings subsystem.

Classes

YAMLObject
YAMLObjectMetaclass

Exceptions

YAMLLoadWarning
petab.yaml.assert_single_condition_and_sbml_file(problem_config: Dict[KT, VT]) → None

Check that there is only a single condition file and a single SBML file specified.

Parameters:problem_config – Dictionary as defined in the YAML schema inside the problems list.
Raises:NotImplementedError – If multiple condition or SBML files specified.
petab.yaml.is_composite_problem(yaml_config: Union[Dict[KT, VT], str]) → bool

Does this YAML file comprise multiple models?

Parameters:yaml_config – PEtab configuration as dictionary or YAML file name
petab.yaml.load_yaml(yaml_config: Union[Dict[KT, VT], str]) → Dict[KT, VT]

Load YAML

Convenience function to allow for providing YAML inputs either as filename or as dictionary.

Parameters:yaml_config – PEtab YAML config as filename or dict.
Returns:The unmodified dictionary if yaml_config was dictionary. Otherwise the parsed the YAML file.
petab.yaml.validate(yaml_config: Union[Dict[KT, VT], str], path_prefix: Optional[str] = None)

Validate syntax and semantics of PEtab config YAML

Parameters:
  • yaml_config – PEtab YAML config as filename or dict.
  • path_prefix – Base location for relative paths. Defaults to location of YAML file if a filename was provided for yaml_config or the current working directory.
petab.yaml.validate_yaml_semantics(yaml_config: Union[Dict[KT, VT], str], path_prefix: Optional[str] = None)

Validate PEtab YAML file semantics

Check for existence of files. Assumes valid syntax.

Version number and contents of referenced files are not yet checked.

Parameters:
  • yaml_config – PEtab YAML config as filename or dict.
  • path_prefix – Base location for relative paths. Defaults to location of YAML file if a filename was provided for yaml_config or the current working directory.
Raises:

AssertionError – in case of problems

petab.yaml.validate_yaml_syntax(yaml_config: Union[Dict[KT, VT], str], schema: Union[None, Dict[KT, VT], str] = None)

Validate PEtab YAML file syntax

Parameters:
  • yaml_config – PEtab YAML file to validate, as file name or dictionary
  • schema – Custom schema for validation
Raises:

see jsonschema.validate