plinder.data.annotations.interaction_utils#

Protein-ligand interaction detection.

Computes interaction fingerprints (hydrogen bonds, salt bridges, pi-stacking, pi-cation, halogen bonds) via peppr’s ContactMeasurement, plus water- and metal-bridged interactions, covalent connections from _struct_conn, and crystallographic symmetry-mate contacts.

plinder.data.annotations.interaction_utils.get_symmetry_mate_contacts(mmcif: Path | CIFFile, contact_threshold: float = 5.0) → dict[tuple[str, int], dict[tuple[str, int], dict[int, set[int]]]][source]#

Find inter-residue contacts generated by crystallographic symmetry.

Only contacts involving symmetry mates (not identity) are returned.

Parameters:
mmcifPath or CIFFile

Parsed mmCIF or a path to one (supports .gz). Passing a parsed file avoids reading a large source entry again during ingest.

contact_thresholdfloat, optional

Distance cutoff in Angstrom, by default 5.0.

Returns:
dict[tuple[str, int], dict[tuple[str, int], dict[int, set[int]]]]

Mapping of (chain_id, residue_id) to partner residues, with atom serials mapped to the symmetry image indices.

plinder.data.annotations.interaction_utils.get_covalent_connections(cif_data: CIFBlock) → dict[str, list[tuple[str, str]]][source]#

Extract covalent connections from CIF block.

Parameters:
cif_datapdbx.CIFBlock

biotite CIF block

Returns:
dict[str, list[tuple[str, str]]]

conn_type -> [(end1, end2)]; each end is a residue_address() with atom, {auth_seq}:{comp_id}:{asym}:{label_seq}:{atom}

Parse covalant dictionary for a given ligand and its neighbours.

Parameters:
all_covalent_dictdict[str, list[tuple[str, str]]]

All covalent links as defined by mmcif annotations

ligand_asym_idstr

ligand asymmetric identification string

neighboring_asym_idsset[str]

set of neighbour asymmetric identification strings

link_typestr, optional

Covalent linkage type in the dictionary. Options include "covale" for a covalent linkage, "metalc" for a dative bond, and "hydrog" for a strong hydrogen bond in a nucleic acid. The default is "covale".

Returns:
set[str]

Links between the ligand and its neighbours as receptor_end__ligand_end

Notes

For the purpose of covalent annotations, we only consider “covale”.

plinder.data.annotations.interaction_utils.find_water_bridges(receptor: AtomArray, ligand: AtomArray, waters: AtomArray, distance_scaling: tuple[float, float] = (0.75, 1.15)) → list[tuple[NDArray[int64], NDArray[int64], NDArray[int64]]][source]#

Find water-mediated hydrogen bonds between receptor and ligand.

plinder.data.annotations.interaction_utils.find_metal_bridges(receptor: AtomArray, ligand: AtomArray, metals: AtomArray, cutoff: float = 3.0) → list[tuple[NDArray[int64], NDArray[int64], NDArray[int64]]][source]#

Find metal-mediated coordination between receptor and ligand.

plinder.data.annotations.interaction_utils.run_peppr_interactions(receptor: AtomArray, ligand: AtomArray, waters: AtomArray, metals: AtomArray, ligand_chain: str) → tuple[dict[str, dict[int, list[str]]], set[tuple[str, int]], list[str]][source]#

Compute interaction hash using peppr ContactMeasurement.

Parameters:
receptorAtomArray

Receptor heavy atoms.

ligandAtomArray

Ligand heavy atoms.

watersAtomArray

Water heavy atoms.

metalsAtomArray

Metal ion heavy atoms (used for metal bridge detection).

ligand_chainstr

Ligand chain identifier ({instance}.{chain}).

Returns:
interaction_hashesdict

{instance.chain: {residue_number: [interaction_strings]}}

water_setset

{(instance.chain, residue_number)} of bridging waters.

failed_interaction_typeslist[str]

Interaction types (from PEPPR_INTERACTION_TYPES) whose peppr detector raised, so an empty result for them means “not computed”, not “none found”. A failure to build the complex records all types.