Analysis client

Analyse a set of steps of a run.

Considering the example run:

run1/
    0_topoaa/
    1_rigidbody/
    2_seletop/
    3_flexref/
    (etc...)

USAGE:

haddock3-analyse -r <run_dir> -m <num_modules>
haddock3-analyse -r run1 -m 1 3
Where, -m 1 3 means that the analysis will be performed on 1_rigidbody

and 3_flexref.

haddock.clis.cli_analyse.analyse_step(step: str, run_dir: str | Path, capri_dict: dict[str, Any], target_path: Path, top_cluster: int, format: Literal['png', 'pdf', 'svg', 'jpeg', 'webp'] | None, scale: float | None, is_cleaned: bool | None, offline: bool = False, mode: str = 'local', ncores: int = 4) None[source]

Analyse a step.

If the step is a caprieval step, use the available capri files. Otherwise, launch a capri analysis.

Parameters:
  • step (str) – step name

  • run_dir (str or Path) – path to run directory

  • capri_dict (dict) – capri dictionary of parameters

  • target_path (Path) – path to the output folder

  • top_cluster (int) – Number of clusters to be considered

  • format (str) – Produce images in the selected format.

  • scale (int) – scale for images.

haddock.clis.cli_analyse.cli(ap: ArgumentParser, main: Callable[[...], None]) None[source]

Command-line interface entry point.

haddock.clis.cli_analyse.get_cluster_ranking(capri_clt_filename: str | Path, top_cluster: int) dict[int, int][source]

Get capri cluster ranking.

Parameters:
  • capri_clt_filename (str or Path) – capri cluster filename

  • top_cluster (int) – Number of clusters to be considered

Returns:

cl_ranking (dict) – {cluster_id : cluster_rank} dictionary

haddock.clis.cli_analyse.load_args(ap: ArgumentParser) Namespace[source]

Load argument parser args.

haddock.clis.cli_analyse.main(run_dir: str | Path, modules: list[int], top_cluster: int, format: Literal['png', 'pdf', 'svg', 'jpeg', 'webp'] | None, scale: float | None, inter: bool | None, is_cleaned: bool | None, offline: bool = False, mode: str | None = None, ncores: int | None = None, **kwargs: Any) None[source]

Analyse CLI.

Parameters:
  • run_dir (str or Path) – Path to the original run directory.

  • modules (list of ints) – List of the integer prefix of the modules to copy.

  • top_cluster (int) – Number of clusters to be considered.

  • format (str) – Produce images in the selected format.

  • scale (int) – scale for images.

  • inter (bool) – analyse only steps labelled as ‘interactive’

  • is_cleaned (bool) – is the directory going to be cleaned?

  • offline (bool) – Should plots js functions be self-contained?

  • mode (str) – mode of execution

  • ncores (int) – number of cores to use

haddock.clis.cli_analyse.maincli() None[source]

Execute main client.

haddock.clis.cli_analyse.run_capri_analysis(step: str, run_dir: str | Path, capri_dict: MutableMapping[str, Any], is_cleaned: bool, mode: str, ncores: int) None[source]

Run the caprieval analysis.

Parameters:
  • step (str) – step name

  • run_dir (str or Path) – path to run directory

  • capri_dict (dict) – capri dictionary of parameters

haddock.clis.cli_analyse.update_capri_dict(default_capri: dict[str, Any], kwargs: MutableMapping[str, Any]) dict[str, Any][source]

Update capri dictionary.

Parameters:
  • default_capri (dict) – default capri dictionary of parameters

  • kwargs (dict) – dictionary of input elements

Returns:

capri_dict (dict) – updated capri dictionary of parameters

haddock.clis.cli_analyse.update_paths(capri_ss_filename: str | Path, toch: str = '../', toadd: str = '../../') None[source]

Update paths in capri_ss_filename.

Parameters:
  • capri_ss_filename (str or Path) – capri ss filename

  • toch (str) – string to be replaced

  • toadd (str) – string to be added

haddock.clis.cli_analyse.update_paths_in_capri_dict(capri_dict: dict[str, Any], target_path: str | Path) dict[str, Any][source]

Make capri_dict specific to target_path.

Parameters:
  • capri_dict (dict) – capri dictionary of parameters

  • target_path (Path) – path to the output folder

Returns:

new_capri_dict (dict) – target_path-specific capri dictionary of parameters

haddock.clis.cli_analyse.validate_format(_format: Literal['png', 'pdf', 'svg', 'jpeg', 'webp'] | None) Literal['png', 'pdf', 'svg', 'jpeg', 'webp'] | None[source]

Validate the optional argument format.

Parameters:

_format (Optional[ImgFormat]) – A optential output format set by the user.

Returns:

Optional[ImgFormat] – A valid output format for the figures to be generated.

Raises:
  • ImportError – When the kaleido package is not installed.

  • ValueError – When the export format is not supported by plotly / kaleido.

haddock.clis.cli_analyse.zip_top_ranked(capri_filename: str | Path, cluster_ranking: dict[int, int], summary_name: str | Path) None[source]

Zip the top ranked structures.

Parameters:
  • cluster_ranking (dict) – {cluster_id : cluster_rank} dictionary

  • ss_file (str or Path) – capri ss filename

Returns:

output_zipfile (str or Path) – path to the zipped file