YAML configs

Parse data from HADDOCK3 to YAML and YAML to HADDOCK3 and related.

Accross this file you will see references to “yaml” as variables and function names. In these cases, we always mean the HADDOCK3 YAML configuration files which have specific keys.

haddock.gear.yaml2cfg.flat_yaml_cfg(cfg: MutableMapping[str, Any]) dict[str, Any][source]

Flat a yaml config.

haddock.gear.yaml2cfg.read_from_yaml_config(cfg_file: Path | str, default_only: bool = True) dict[source]

Read config from yaml by collapsing the expert levels.

Parameters:
  • cfg_file – Path to a .yaml configuration file

  • default_only (bool) – Set the return value of this function; if True (default value), only returns default values, else return the fully loaded configuration file

Returns:

  • ycfg (dict) – The full default configuration file as a dict

  • OR

  • cfg (dict) – A dictionary containing only the default parameters values

haddock.gear.yaml2cfg.yaml2cfg_text(ymlcfg: dict, module: str, explevel: str, details: bool = False) str[source]

Convert HADDOCK3 YAML config to HADDOCK3 user config text.

Adds commentaries with help strings.

Parameters:
  • ymlcfg (dict) – The dictionary representing the HADDOCK3 config file.

  • module (str) – The module to which the config belongs to.

  • explevel (str) – The expert level to consider. Provides all parameters for that level and those of inferior hierarchy. If you give “all”, all parameters will be considered.

  • details (bool) – Whether to add the ‘long’ description of each parameter.