plinder.core.structure.smallmols_utils#

plinder.core.structure.smallmols_utils.generate_input_conformer(template_mol: Mol, addHs: bool = False, minimize_maxIters: int = -1, skip_3d_confgen: bool = False) → Mol[source]#
plinder.core.structure.smallmols_utils.match_ligands(input_smiles: str, resolved_sdf: str | Path) → tuple[Mol, Mol, tuple[NDArray[int64], NDArray[int64]]][source]#
plinder.core.structure.smallmols_utils.get_template_to_mol_matches(template: Mol, mol: Mol) → tuple[NDArray[int64], NDArray[int64]][source]#

Function that works a lot like get_matched_template but can better deal with fragmented molecules

plinder.core.structure.smallmols_utils.compare_stereo_to_template(resolved_mol: Mol, template_mol: Mol) → bool | None[source]#

Check resolved 3D stereo against a template — tetrahedral R/S and E/Z.

Atoms are matched by PDB name. Template stereo is read from its tags via Chem.FindPotentialStereo(); a template that ships ideal coordinates (CCD) first has its atom + bond stereo perceived from them via Chem.AssignStereochemistryFrom3D(), while SMILES templates already carry tags — no conformer is generated either way. Each tetrahedral center’s descriptor (Tet_CW/Tet_CCW) fixes the sign of the signed volume of its controllingAtoms; each double bond’s descriptor (Bond_Cis/Bond_Trans) fixes the dihedral of its reference substituents. Both are checked against the resolved coordinates only — no CIP priority, no conformer generation and no empty filled coordinates.

Returns True if every fully-resolved stereo element matches (or the template has none), False on any mismatch, None if nothing could be matched. Elements with unresolved atoms or degenerate geometry are skipped.

plinder.core.structure.smallmols_utils.mol_assigned_bond_orders_by_template(template_mol: Mol, mol: Mol) → Mol[source]#
plinder.core.structure.smallmols_utils.get_matched_template(template: Mol, mol: Mol) → Mol[source]#

Trim template to the MCS with mol using Rascal MCES.

Handles fragmented molecules and unmatched bonds correctly.

plinder.core.structure.smallmols_utils.ligand_atom_features(mol: Mol) → NDArray[int64][source]#

Encode every atom of mol as categorical vocabulary indices.

Columns follow LIGAND_ATOM_FEATURE_NAMES: atomic number, chiral tag, total degree, formal charge, implicit valence, total hydrogen count, radical electrons, hybridization, aromaticity, number of rings the atom belongs to, and membership in rings of size 3 to 8. Chiral tags other than the two tetrahedral ones collapse onto CHI_OTHER. Only graph properties are used, so a 2D template without a conformer is sufficient.

Parameters:
molChem.Mol

Ligand with explicit atoms in the order the features should follow.

Returns:
NDArray[np.int64]

Array of shape (n_atoms, len(LIGAND_ATOM_FEATURE_NAMES)).