Skip to content

Neutralize

NEUTRALIZE_PASSES_PER_ATOM = 10

RXN_DATA = (('[#16+2:1]-[Ov1-1:2]', '[#16+1:1]=[O+0:2]'), ('[#16+1:1]-[Ov1-1:2]', '[#16+0:1]=[O+0:2]'), ('[#15+1:1]-[Ov1-1:2]', '[#15+0:1]=[O+0:2]'), ('[Ov1-1;!$([O-]-[#7+;!$([#7+]=O)]);!$([O-]-[#7+](=O)-[#8]-[H]):1]', '[Ov2+0:1]-[H]'), ('[Sv1-1:1]', '[Sv2+0:1]-[H]'), ('[#7v4+1:1]-[H]', '[#7v3+0:1]'), ('[Ov2-:1]', '[Ov2+0:1]'), ('[#7v3+1:1]', '[#7v3+0:1]'), ('[#7v2-1;!$([#7-]=[#7+]=[#6]):1]', '[#7+0:1]-[H]'), ('[H]-[N:1]-[N:2]#[N:3]', '[N:1]=[N+1:2]=[N:3]-[H]'), ('[#7+1;H0;!$([#7+]~[O-]):1]=[#6:2]-[#7+0;!H0:3]', '[#7+0:1]-[#6:2]=[#7+1:3]'), ('[n+1;H0;!$([n+]~[O-]):1]:[c:2]:[n+0;!H0:3]', '[n+0:1]:[c:2]:[n+1:3]'), ('[n+1;H0;!$([n+]~[O-]):1]:[n+0;!H0:2]', '[n+0:1]:[n+1:2]'))

MoleculeNeutralizer(rxn_data=None)

High-level class to take SMILES, handle preprocessing, add Hs, run neutralization, and return a clean SMILES.

registry = ReactionRegistry(rxn_data)

neutralize_smiles(smiles)

NeutralizationReaction(smarts_reactant, smarts_product)

Represents a single neutralization reaction defined by a pair of SMARTS strings

PARAMETER DESCRIPTION
smarts_reactant

SMARTS for detecting the reactants of a defined neutralization reaction.

TYPE: str

smarts_product

SMARTS for what the detected smarts_reactant should be transformed to.

TYPE: str

smarts_product = smarts_product

smarts_reactant = smarts_reactant

__repr__()

__str__()

apply(mol)

Apply the neutralization reaction to the molecule. Returns the first product. If multiple products are generated, only the first is returned.

matches(mol)

Check if this reaction can be applied to the given molecule.

ReactionRegistry(rxn_data)

Holds a collection of NeutralizationReaction objects and applies them repeatedly until no further matches are found.

reactions = []

neutralize(mol)

Apply all registered neutralization reactions to the molecule in a loop until no further transformations are possible. Assumes explicit H atoms have already been added.

clear_exchangeable_h_isotopes(mol)

Strips the isotope label from hydrogens bonded to O, N, or S, so that RemoveHs folds them into the heavy atom's hydrogen count.

RemoveHs keeps isotopic hydrogens as graph atoms, and deprotonation only lowers the heavy atom's hydrogen count, so an acidic O-D could never be deprotonated. These hydrogens exchange with water almost at once, so the label carries no meaning at the pH values modeled. Labels on carbon are left alone.

PARAMETER DESCRIPTION
mol

The molecule, with explicit hydrogens, to edit in place.

TYPE: Mol