haddock.modules.analysis.caprieval.capri module
CAPRI module.
- class haddock.modules.analysis.caprieval.capri.CAPRI(identificator: int, model: PDBFile | Path, path: Path, reference: PDBFile | Path, params: MutableMapping[str, Any])[source]
Bases:
object
CAPRI class.
- static add_chain_from_segid(pdb_path: PDBFile | Path) Path [source]
Replace the chainID with the segID.
- Parameters:
pdb_path (PosixPath or
haddock.libs.libontology.PDBFile
) – PDB file to be replaced
- calc_fnat(cutoff: float = 5.0) None [source]
Calculate the frequency of native contacts.
- Parameters:
cutoff (float) – The cutoff distance for the intermolecular contacts.
- calc_ilrmsd(cutoff: float = 10.0) None [source]
Calculate the Interface Ligand RMSD.
- Parameters:
cutoff (float) – The cutoff distance for the intermolecular contacts.
- calc_irmsd(cutoff: float = 5.0) None [source]
Calculate the I-RMSD.
- Parameters:
cutoff (float) – The cutoff distance for the intermolecular contacts.
- has_cluster_info() bool [source]
Check wether this object contains cluster information.
- Returns:
bool – True if this object contains cluster information.
- static identify_interface(pdb_f: PDBFile | Path, cutoff: float = 5.0) dict[str, list[int]] [source]
Identify the interface.
- Parameters:
pdb_f (PosixPath or
haddock.libs.libontology.PDBFile
) – PDB file of the model to have its atoms identifiedcutoff (float, optional) – Cutoff distance for the interface identification.
- Returns:
interface_resdic (dict[str, list[int]]) – Dictionary holding list of interface residues ids for each chains.
- exception haddock.modules.analysis.caprieval.capri.CAPRIError(msg: str = '')[source]
Bases:
Exception
Raised when something goes wrong with the CAPRI class.
- haddock.modules.analysis.caprieval.capri.calc_stats(data: list) tuple[float, float] [source]
Calculate the mean and stdev.
- Parameters:
data (list) – List of values.
- Returns:
mean (float) – Mean of the values.
stdev (float) – Standard deviation of the values.
- haddock.modules.analysis.caprieval.capri.capri_cluster_analysis(capri_list: Iterable[CAPRI], model_list: Iterable[PDBFile], output_fname: str | Path, clt_threshold: int, sort_key: str, sort_ascending: bool, path: str | Path) None [source]
Consider the cluster results for the CAPRI evaluation.
- haddock.modules.analysis.caprieval.capri.extract_data_from_capri_class(capri_objects: list[CAPRI], sort_key: str, sort_ascending: bool, output_fname: Path) dict[int, dict[str, Any]] | None [source]
Extracts data attributes from a list of CAPRI objects into a structured dictionary, optionally sorts the data based on a specified key, and writes the sorted data to a file.
- Parameters:
capri_objects (list[CAPRI]) – List of CAPRI objects containing data attributes to be extracted.
sort_key (str) – Key by which to sort the extracted data. Must correspond to a valid attribute in the CAPRI object (e.g., ‘score’, ‘irmsd’).
sort_ascending (bool) – If True, sorts the data in ascending order based on the sort_key; if False, sorts in descending order.
output_fname (Path) – Path to the output file where the sorted data will be written.
- Returns:
Optional[dict[int, ParamDict]] –
- The sorted and structured data dictionary if
successful, None if no data was processed.
- Raises:
(Include any specific exceptions the function may raise) –
- haddock.modules.analysis.caprieval.capri.get_previous_cns_step(sel_steps: list, st_order: int) str | None [source]
Get the previous CNS step.
- Parameters:
run_path (Path) – Path to the run folder.
- Returns:
cns_step (str) – Name of the CNS step.
- haddock.modules.analysis.caprieval.capri.load_contacts(pdb_f: Path | PDBFile, cutoff: float = 5.0, numbering_dic: dict[str, dict[int, int]] | None = None, model2ref_chain_dict: dict[str, str] | None = None) set[tuple] [source]
Load residue-based contacts.
- Parameters:
pdb_f (PosixPath or
haddock.libs.libontology.PDBFile
) – PDB file of the model to have its atoms identifiedcutoff (float, optional) – Cutoff distance for the interface identification.
- Returns:
set(con_list) (set) – set of unique contacts
- haddock.modules.analysis.caprieval.capri.rank_according_to_score(data: dict[int, dict[str, Any]], sort_key: str, sort_ascending: bool) dict[int, dict[str, Any]] [source]
Ranks a dictionary of data based on a specified sort key and sort order, and assigns a rank to each entry based on its ‘score’ attribute.
- Parameters:
data (dict[int, ParamDict]) – Dictionary where each key is an index and each value is a ParamDict containing data attributes.
sort_key (str) – Key by which to sort the data within the ParamDict. Must correspond to a valid attribute in ParamDict.
sort_ascending (bool) – If True, sorts the data in ascending order based on the sort_key; if False, sorts in descending order.
- Returns:
dict[int, ParamDict] –
- A new dictionary where entries are sorted according
to the sort_key and optionally sorted order. Each entry also includes a ‘caprieval_rank’ attribute indicating its rank based on the ‘score’.