schrodinger.application.epik.phlash.phlash module¶
Epik pHlash protonation backend.
A lightweight, hot (load-once) predictor for the single best pH 7.4
protonation (n_labile_H) model. The EpikX pKa featurizer and the GNN are
loaded once when a Protonator instance is constructed and kept
resident, so repeated batch calls pay the model-loading cost only once.
Typical use:
from schrodinger.application.epik.phlash import phlash
predictor = phlash.Protonator() # loads pKa model + GNN once
out = predictor.protonate([...]) # SMILES or Mol in -> same type out
Inputs are protonated at pH 7.4 and returned as heavy-atom RDKit Mol
objects (protonation encoded as formal charges and explicit hydrogen
counts) or as canonical SMILES. A molecule with no ionizable sites, or one
that fails featurization/prediction, is returned unchanged.
Importing this module is cheap: the heavy dependencies (torch,
ligand_ml, torch_geometric) and the EpikX pKa predictor are imported
lazily when a Protonator is constructed, not at module import, so the
pure-RDKit helpers stay importable without those packages.
- class schrodinger.application.epik.phlash.phlash.Protonator(*, batch_size=128, pka_model_path=None, mesomerize=False)¶
Bases:
objectHot protonation predictor for the single best pH 7.4 model.
Constructing an instance loads the EpikX pKa featurizer and the GNN once and keeps them resident. Call
protonaterepeatedly to amortize that cost.- __init__(*, batch_size=128, pka_model_path=None, mesomerize=False)¶
- Parameters:
batch_size – molecules per GNN forward pass (e.g. 128 or 256)
pka_model_path – path to the EpikX pKa model package; defaults to the one shipped with the
epikinstallationmesomerize – when True, replace each protonated molecule with a canonical mesomer (Lewis structure) via
schrodinger.rdkit.mesomerizerbefore returning it
- protonate(molecules, output_type=None)¶
Protonate a collection of molecules at pH 7.4.
The input representation is auto-detected: a collection of SMILES strings or a collection of RDKit
Molobjects (Noneentries allowed, passing through asNone). By default the output is returned in the same representation as the input (SMILES -> SMILES, Mol -> Mol); pass output_type to force a representation, e.g.output_type="SMILES"returns SMILES regardless of the input type.- Parameters:
molecules – collection of SMILES strings or RDKit
Molobjects (Noneentries allowed); the non-Noneentries must all be the same typeoutput_type –
"SMILES"or"Mol"(case-insensitive) to force the output representation;None(default) matches the input
- Returns:
parallel list of results in the requested representation
- Raises:
TypeError – if the entries are neither
strnorMol, or mix the twoValueError – if output_type is not
"SMILES"or"Mol"
- schrodinger.application.epik.phlash.phlash.protonate(molecules, output_type=None)¶
Protonate SMILES strings or RDKit
Molobjects using a cached defaultProtonatorinstance. SeeProtonator.protonate.