Cheminformatics definitions
The same molecule has several hydrogen-bond acceptor counts, several polar surface areas and several canonical SMILES, all correct under some definition. RDKit implements more than one of each. Compute with the definition the question uses, and print the definition next to the number; a bare "HBA = 7" is not reproducible.
Rules
- Lipinski counts. The original rule of five counts donors as the number of N-H and
O-H bonds and acceptors as the number of N and O atoms. In RDKit these are
rdMolDescriptors.CalcNumLipinskiHBDandCalcNumLipinskiHBA(also exposed asLipinski.NHOHCountandLipinski.NOCount).Lipinski.NumHDonorsandLipinski.NumHAcceptors(same asrdMolDescriptors.CalcNumHBDandCalcNumHBA) use SMARTS-based pharmacophore definitions that exclude, for example, amide nitrogens and include some sulfur; the two acceptor counts often differ by two or three. The rule's thresholds are MW <= 500, cLogP <= 5, HBD <= 5, HBA <= 10, with "at most one violation" in the original formulation. cLogP in RDKit is Wildman-Crippen (Crippen.MolLogP), which differs from XLogP3 or other predictors by up to a log unit; name the method. - Molecular weight.
Descriptors.MolWtis the average isotopic mass,Descriptors.ExactMolWtthe monoisotopic mass; both depend on whether the counterion was stripped first. - TPSA. Ertl's fragment method. RDKit's default (
Descriptors.TPSA(mol)orrdMolDescriptors.CalcTPSA(mol)) sums N and O contributions only, matching the reference values in the original paper;includeSandP=Trueadds S and P. Sulfonamides and phosphates shift by roughly 10 square angstroms between the two. - QED.
QED.qed(mol)uses Bickerton's mean weights by default;QED.weights_maxandQED.weights_nonegive different values, andQED.properties(mol)exposes the eight underlying components (which use RDKit's own HBA, HBD and alert definitions). Report "QED, RDKit, mean weights". - Rotatable bonds.
rdMolDescriptors.CalcNumRotatableBonds(mol, strict)hasNumRotatableBondsOptions.NonStrict,Strict(excludes amide C-N and similar) andStrictLinkages; Veber-style filters were derived with a particular definition, so state which was used. - InChI and InChIKey.
Chem.MolToInchi(mol)with no options yields standard InChI (InChI=1S/); any option such as/FixedHyields a non-standard InChI (InChI=1/) whose key is not comparable to standard keys.Chem.MolToInchiKey(mol)gives the 27-character key: a 14-character skeleton block, an 8-character block for stereo and isotopes, a version and standard flag, then a protonation character. Stereoisomers share the first block, so matching on it is skeleton matching. Standard InChI normalizes mobile hydrogens, so some tautomers collapse to one key and others do not. - SMILES.
Chem.MolToSmiles(mol)is canonical and isomeric by default (isomericSmiles=Truekeeps stereo and isotopes;Falsedrops them;kekuleSmiles=TrueafterChem.Kekulizewrites explicit bond orders). Canonical means canonical within one toolkit and version; never join tables from different toolkits on SMILES text. Recanonicalize everything through the same RDKit build or join on InChIKey. - Standardization order.
rdMolStandardize.Cleanup(sanitize, disconnect metals, normalize functional groups, reionize),FragmentParent(largest organic fragment, which is the usual salt stripping),ChargeParent(uncharged fragment parent, orUncharger().uncharge),TautomerEnumerator().Canonicalize(orTautomerParent).Chem.SaltRemover.SaltRemoverstrips a fixed list of counterions instead and behaves differently for solvates and mixed salts. Uncharging is not protonation at pH 7.4; a pKa-based protonation step is a different, separately named operation. Descriptors on the parent differ from descriptors on the drawn salt form; say which was profiled. - Aromaticity. RDKit's default model differs from the MDL model
(
Chem.SetAromaticity(mol, Chem.AromaticityModel.AROMATICITY_MDL)afterChem.Kekulize(mol, clearAromaticFlags=True)) and from OpenBabel or Daylight perception. Aromatic ring counts, aromatic-atom fractions and lowercase SMARTS matches all change with the model. Inputs with unusual valences may needChem.MolFromSmiles(smi, sanitize=False)followed byChem.SanitizeMolwith explicit flags; record any molecule that failed to parse rather than dropping it silently. - Hydrogens and stereo. Descriptors that count hydrogens need the implicit-H graph,
3D work needs
Chem.AddHs; write canonical SMILES afterChem.RemoveHs.Chem.FindMolChiralCenters(mol, includeUnassigned=True, useLegacyImplementation=False)reveals unspecified centers that will make "same molecule" comparisons ambiguous. - Always state
rdkit.__version__, the function and arguments, the standardization steps and their order, and whether values are for the parent or the drawn form. Put a definitions footnote under every property table.
Snippet
from rdkit import Chem
from rdkit.Chem import Lipinski, QED, rdMolDescriptors
from rdkit.Chem.MolStandardize import rdMolStandardize
def profile(smiles: str) -> dict:
# Descriptors on the drawn salt form would count the counterion's atoms.
mol = rdMolStandardize.ChargeParent(Chem.MolFromSmiles(smiles))
return {
"hbd_lipinski_nhoh": rdMolDescriptors.CalcNumLipinskiHBD(mol),
"hba_lipinski_no": rdMolDescriptors.CalcNumLipinskiHBA(mol),
"hbd_smarts": Lipinski.NumHDonors(mol),
"hba_smarts": Lipinski.NumHAcceptors(mol),
"tpsa_no": rdMolDescriptors.CalcTPSA(mol),
"tpsa_nosp": rdMolDescriptors.CalcTPSA(mol, includeSandP=True),
"qed_mean_weights": QED.qed(mol),
"inchikey_standard": Chem.MolToInchiKey(mol),
}
Sources
- RDKit Book (aromaticity models, TPSA implementation notes): https://www.rdkit.org/docs/RDKit_Book.html
- RDKit
rdMolDescriptorsAPI: https://www.rdkit.org/docs/source/rdkit.Chem.rdMolDescriptors.html - RDKit
Lipinskimodule: https://www.rdkit.org/docs/source/rdkit.Chem.Lipinski.html - RDKit
rdMolStandardizeAPI: https://www.rdkit.org/docs/source/rdkit.Chem.MolStandardize.rdMolStandardize.html - RDKit
QEDmodule: https://www.rdkit.org/docs/source/rdkit.Chem.QED.html - InChI Trust technical FAQ (standard InChI, InChIKey layout): https://www.inchi-trust.org/technical-faq/
- Lipinski et al. (2001), Adv. Drug Deliv. Rev. 46, 3-26: https://doi.org/10.1016/S0169-409X(00)00129-0
- Ertl, Rohde and Selzer (2000), J. Med. Chem. 43, 3714-3717: https://doi.org/10.1021/jm000942e