neurosnap.algos.lddt module#

Code for LDDT (Local Distance Difference Test) calculation, adapted from ba-lab/disteval

neurosnap.algos.lddt.calc_lddt(reference, prediction, *, model_ref=None, model_pred=None, chains_ref=None, chains_pred=None, R=15.0, sep_thresh=-1, T_set=(0.5, 1.0, 2.0, 4.0), require_standard_aa=True)[source]#

Compute lDDT from distance maps or Protein structures.

Parameters:
  • reference (Union[ndarray, Protein]) – Distance map or Protein used as the ground truth.

  • prediction (Union[ndarray, Protein]) – Distance map or Protein to compare against the reference.

  • model_ref (Optional[int]) – Model index to select when reference is a Protein.

  • model_pred (Optional[int]) – Model index to select when prediction is a Protein.

  • chains_ref (Optional[List[str]]) – Chain identifiers to include when reference is a Protein.

  • chains_pred (Optional[List[str]]) – Chain identifiers to include when prediction is a Protein.

  • R (float) – Maximum reference distance to consider when defining the L set.

  • sep_thresh (int) – Minimum sequence separation between residue pairs.

  • T_set (Sequence[float]) – Error thresholds used to compute preserved distance fractions.

  • require_standard_aa (bool) – Skip residues with unknown amino-acid or nucleotide codes when True.

Return type:

float

Returns:

lDDT score between the reference and prediction. Typical range is [0.0, 1.0], where 1.0 indicates perfect local distance agreement and 0.0 indicates no preserved distances under the selected thresholds. Returns NaN when no residue pairs satisfy the L-set criteria (for example, no pairs within R and above sep_thresh).

Raises:
  • ValueError – If distance maps do not share the same shape.

  • TypeError – If the inputs are not both arrays or both Protein instances.