plinder.core.structure.ccd_template#
CCD component templates: missing-atom detection and opt-in completion.
- class plinder.core.structure.ccd_template.ComponentTemplate(heavy, elements, leaving, bonds)[source]#
Bases:
NamedTuple- heavy: tuple[str, ...]#
Alias for field number 0
- elements: dict[str, str]#
Alias for field number 1
- leaving: frozenset[str]#
Alias for field number 2
- bonds: tuple[tuple[str, str, int], ...]#
Alias for field number 3
- plinder.core.structure.ccd_template.ccd_component_template(comp_id: str) ComponentTemplate | None[source]#
Heavy atoms, elements, leaving atoms and bonds of a CCD component.
- plinder.core.structure.ccd_template.ccd_heavy_atom_names(comp_id: str) tuple[frozenset[str], frozenset[str]] | None[source]#
Heavy atom names and leaving-group atom names of a CCD component.
- plinder.core.structure.ccd_template.departed_leaving_atoms(template: ComponentTemplate, linked_atom_names: Collection[str]) frozenset[str][source]#
Leaving atoms whose anchor atom is bonded outside the residue, i.e. gone on linkage.
- plinder.core.structure.ccd_template.linked_atoms_by_residue(atoms: AtomArray, starts: ndarray) dict[int, set[str]][source]#
Residue start index -> names of its atoms bonded to another residue.
startsare residue starts with the exclusive stop appended.
- plinder.core.structure.ccd_template.unresolved_atoms_from_template(comp_id: str, resolved_atom_names: Iterable[str], linked_atom_names: Collection[str] | None = None) list[str] | None[source]#
CCD heavy atoms absent from
resolved_atom_names.Leaving atoms whose anchor is in
linked_atom_names(atoms bonded outside the residue) departed on linkage and are not missing; withlinked_atom_names=Noneevery leaving atom is excluded.Nonewhencomp_idis not in the CCD.
- plinder.core.structure.ccd_template.add_missing_atoms(atoms: AtomArray, *, mask_annotation: str = 'is_unresolved') AtomArray[source]#
Append CCD heavy atoms missing from each residue, with NaN coordinates.
A residue is completed only when its CCD template is known and every resolved heavy atom name is a template name; hydrogens are never added, leaving atoms only for a non-polymer residue not bonded through their anchor (never when
atomshas no bonds), and fully unresolved residues are not created. Added atoms copy their residue’s annotations, takeelementfrom the CCD, getoccupancy/b_factor/charge0 where present, andmask_annotationTrue (deposited atoms get False). Existing bonds are kept and the template bonds of added atoms appended. The input is not modified.