petab.yaml¶
Code regarding the PEtab YAML config files
-
petab.yaml.
assert_single_condition_and_sbml_file
(problem_config: Dict) → 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.
create_problem_yaml
(sbml_files: Union[str, List[str]], condition_files: Union[str, List[str]], measurement_files: Union[str, List[str]], parameter_file: str, observable_files: Union[str, List[str]], yaml_file: str, visualization_files: Optional[Union[str, List[str]]] = None) → None¶ Create and write default YAML file for a single PEtab problem
- Parameters
sbml_files – Path of SBML model file or list of such
condition_files – Path of condition file or list of such
measurement_files – Path of measurement file or list of such
parameter_file – Path of parameter file
observable_files – Path of observable file or lsit of such
yaml_file – Path to which YAML file should be written
visualization_files – Optional Path to visualization file or list of
such –
-
petab.yaml.
get_handle
(path_or_buf: Union[PathLike[str], str, IO[T], io.RawIOBase, io.BufferedIOBase, io.TextIOBase, _io.TextIOWrapper, mmap.mmap], mode: str, encoding: Optional[str] = None, compression: Optional[Union[str, Dict[str, Any]]] = None, memory_map: bool = False, is_text: bool = True, errors: Optional[str] = None, storage_options: Optional[Dict[str, Any]] = None) → pandas.io.common.IOHandles¶ Get file handle for given path/buffer and mode.
- Parameters
path_or_buf (str or file handle) – File path or object.
mode (str) – Mode to open path_or_buf with.
encoding (str or None) – Encoding to use.
compression (str or dict, default None) –
If string, specifies compression mode. If dict, value at key ‘method’ specifies compression mode. Compression mode must be one of {‘infer’, ‘gzip’, ‘bz2’, ‘zip’, ‘xz’, None}. If compression mode is ‘infer’ and filepath_or_buffer is path-like, then detect compression from the following extensions: ‘.gz’, ‘.bz2’, ‘.zip’, or ‘.xz’ (otherwise no compression). If dict and compression mode is one of {‘zip’, ‘gzip’, ‘bz2’}, or inferred as one of the above, other entries passed as additional compression options.
Changed in version 1.0.0: May now be a dict with key ‘method’ as compression mode and other keys as compression options if compression mode is ‘zip’.
Changed in version 1.1.0: Passing compression options as keys in dict is now supported for compression modes ‘gzip’ and ‘bz2’ as well as ‘zip’.
memory_map (boolean, default False) – See parsers._parser_params for more information.
is_text (boolean, default True) – Whether the type of the content passed to the file/buffer is string or bytes. This is not the same as “b” not in mode. If a string content is passed to a binary file/buffer, a wrapper is inserted.
errors (str, default 'strict') – Specifies how encoding and decoding errors are to be handled. See the errors argument for
open()
for a full list of options.storage_options (StorageOptions = None) – Passed to _get_filepath_or_buffer
versionchanged: (.) – 1.2.0:
the dataclass IOHandles (Returns) –
-
petab.yaml.
is_composite_problem
(yaml_config: Union[Dict, 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, str]) → Dict¶ Load YAML
Convenience function to allow for providing YAML inputs as filename, URL or as dictionary.
- Parameters
yaml_config – PEtab YAML config as filename or dict or URL.
- Returns
The unmodified dictionary if
yaml_config
was dictionary. Otherwise the parsed the YAML file.
-
petab.yaml.
validate
(yaml_config: Union[Dict, 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, 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, str], schema: Union[None, Dict, 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 –
-
petab.yaml.
write_yaml
(yaml_config: Dict[str, Any], filename: str) → None¶ Write PEtab YAML file
- Parameters
yaml_config – Data to write
filename – File to create