haddock.modules.analysis.alascan.scan module

alascan module.

class haddock.modules.analysis.alascan.scan.AddDeltaBFactor(model: PDBFile, path: Path, model_results: List[MutationResult])[source]

Bases: object

Add delta score in bfactor column of a PDB.

normalize_score(score: float) float[source]

Normalise the input score based on observed scores for this model

In case normalisation cannot be performed, returns 50.0

Parameters:

score (float) – Input score to be normalized

Returns:

norm100 (float) – Normalized score between 0 and 100

reorder_results() None[source]

Perform initial data manuputation to simply downstream access.

Organise mutation results into dictionary, with chain-resid keys and values delta score (e.g.: {“A-115”: 5}), and determine min and max score within the model to normalize data.

run() PDBFile[source]

Perform the addition of delta scores as bfactor in pdb file.

write_delta_score_to_pdb(output_path: Path) Path[source]

Add delta scores as b-factors in PDB file.

Parameters:

output_path (Path) – Path to the pdb file.

Returns:

output_path (Path) – Path to the pdb file with the b-factors added.

class haddock.modules.analysis.alascan.scan.ClusterOutputer(cluster_scan_data: Dict[str, Dict[str, float | int]], clt_id: str, clt_population: int, scan_residue: str = 'ALA', generate_plot: bool = False, offline: bool = False)[source]

Bases: object

Manage the generation of alascan outputs for cluster-based analysis.

gen_alascan_plot(df_scan_clt: DataFrame) None[source]

Generate the alascan plot based on provided data.

Parameters:

df_scan_clt (pd.DataFrame) – The data frame containing the data to be plotted.

run() str[source]

Wrtie cluster alascan output to scan_clt_X.tsv file, including average and stdard deviation data per residue and optionally save cluster alascan plots (if generate_plot == True)

Returns:

scan_clt_filename (str) – Name of the tsv file written

class haddock.modules.analysis.alascan.scan.InterfaceScanner(model: str | Path | Any, mutation_res: str = 'ALA', params: Dict[str, Any] | None = None, library_mode: bool = True)[source]

Bases: object

Scan interface of a model to get tartget residues and create corresponding mutation jobs.

run()[source]

Get interface residues and create mutation jobs. If library_mode=True, also execute the mutations sequentially.

Returns:

Optional[List[ModelPointMutation]] – List of mutation jobs if library_mode=False, None if library_mode=True

class haddock.modules.analysis.alascan.scan.ModelPointMutation(model_path: Path, model_id: str, chain: str, resid: int, ori_resname: str, target_resname: str, native_scores: Tuple[float, float, float, float, float], output_mutants: bool = False)[source]

Bases: object

Executes a single point mutation.

run()[source]

Execute the point mutation.

class haddock.modules.analysis.alascan.scan.MutationResult(model_id: str, chain: str, resid: int, ori_resname: str, target_resname: str, mutant_scores: Tuple[float, float, float, float, float], delta_scores: Tuple[float, float, float, float, float], success: bool, error_msg: str | None = None)[source]

Bases: object

Result from a single mutation.

chain: str
delta_scores: Tuple[float, float, float, float, float]
error_msg: str | None = None
model_id: str
mutant_scores: Tuple[float, float, float, float, float]
ori_resname: str
resid: int
success: bool
target_resname: str
haddock.modules.analysis.alascan.scan.add_zscores(df_scan_clt, column='delta_score')[source]

Add z-scores to the dataframe.

Parameters:
  • df_scan (pandas.DataFrame) – Dataframe with the scan results for the model.

  • colunm (str) – Column to calculate the z-score.

Returns:

df_scan (pandas.DataFrame) – Dataframe with the z-scores added.

haddock.modules.analysis.alascan.scan.calc_score(pdb_f, run_dir, outputpdb=False)[source]

Calculate the score of a model.

Parameters:
  • pdb_f (str) – Path to the pdb file.

  • run_dir (str) – Path to the run directory.

  • outputpdb (bool, optional) – If True, the output, energy-minimized pdb file will be written. Default is False.

Returns:

  • score (float) – Haddock score.

  • vdw (float) – Van der Waals energy.

  • elec (float) – Electrostatic energy.

  • desolv (float) – Desolvation energy.

  • bsa (float) – Buried surface area.

haddock.modules.analysis.alascan.scan.get_score_string(pdb_f, run_dir, outputpdb=False)[source]

Get score output from cli_score.main.

Parameters:
  • pdb_f (str) – Path to the pdb file.

  • run_dir (str) – Path to the run directory.

  • outputpdb (bool, optional) – If True, the output, energy-minimized pdb file will be written. Default is False.

Returns:

out (list) – List of strings with the score output.

haddock.modules.analysis.alascan.scan.group_scan_by_cluster(models: List[PDBFile], results_by_model: Dict[str, MutationResult]) Tuple[Dict[str, Dict[str, Dict[str, float | int]]], Dict[str, int]][source]

Group models alascan data per cluster.

Parameters:

models (List[PDBFile]) – List of input models

Returns:

  • clt_scan (Dict[str, Dict[str, Dict[str, Union[float, int]]]]) – Dictionary containing alascan data for each cluster, grouped by residue identifyer.

  • clt_pops (Dict[str, int]) – Dictionary containing number of entries for each cluster.

haddock.modules.analysis.alascan.scan.mutate(pdb_f, target_chain, target_resid, mut_resname)[source]

Mutate a residue in a PDB file into a different residue.

Parameters:
  • pdb_f (str) – Path to the pdb file.

  • target_chain (str) – Chain of the residue to be mutated.

  • target_resid (int) – Residue number of the residue to be mutated.

  • mut_resname (str) – Residue name of the residue to be mutated.

Returns:

mut_pdb_fname (str) – Path to the mutated pdb file.

haddock.modules.analysis.alascan.scan.write_scan_out(results: List[MutationResult], model_id: str) None[source]

Save mutation results per model to tsv file.

Parameters:
  • results (List[MutationResult]) – List of mutation results from scanning (comes from MutationResult)

  • model_id (str) – Identifier for the model used in filename.

Returns:

None – Function saves results to file scan_{model_id}.tsv.

Notes

If results list is empty, no file is created.