moleculekit.tools.preparation_propka module#

Reconcile PROPKA’s view of a structure with what the caller already decided.

PROPKA predicts pKas from an empirical model that reads a structure the way a PDB file describes it: elements come from the atom-name columns, chemistry is perceived from coordinates, and a residue it does not recognise is typed by geometry alone. That is the right set of assumptions for a bare crystal structure and the wrong one here, because by the time preparation calls PROPKA the caller has usually said more than the file does.

A residue templated with templateResidueFromSmiles() carries explicit hydrogens, bond orders and formal charges. Those are assertions about protonation, and re-deriving them from geometry throws them away. The helpers here hand PROPKA what it cannot work out for itself:

  • which residues are non-canonical, so their sidechains are grouped as ligands rather than ignored (_noncanonical_sidechain_plan(), _mark_ligand_like_sidechains())

  • the real element, where the two-letter symbol was misread from the atom-name column (_correct_propka_elements())

  • SYBYL atom types derived from the recorded bond orders rather than from a distance threshold (_apply_sybyl_types())

  • the input’s own formal charge, in place of PROPKA’s titration verdict (_apply_templated_formal_charges())

  • metals, both the ones buried inside a cofactor residue that PROPKA’s residue-name lookup cannot see, and the groups coordinating them (_add_cofactor_metal_groups(), _hold_metal_coordinated_groups())

  • PDB2PQR’s terminus decision, in place of the one PROPKA infers from the text (_clear_phantom_termini())

_run_propka() is the entry point and applies these in the order PROPKA’s own setup requires.