Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation or Problem
This PR adds several helper functions related to protonation & ionization.
Description of Changes
New "big" functions:
uncharge_mol(mol, method)
: Input = charged molecule (ion or zwitterion), output = uncharged form. Provides two algorithms for doing uncharging, default is to try both in case the other fails, starting with the rdkit algorithm.is_symmetric_to_substructure(mol, substructure)
: Check whether a mol is symmetric to a provided substructure, i.e. return "True" for comparing ethylene glycol to "OH" substructureHelper functions:
protonate_at_site(mol, site)
: Add a proton to a mol at a given idx and adjust formal chargesdeprotonate_at_site(mol, site)
: Remove a proton of a mol at a given idx and adjust formal chargesis_implicit(mol)
: Infer whether a molecule is an implicit or explicit mol objectfind_symmetry_classes(mol)
: provides a set of symmetry classes for atoms in a mol object, based on code by Greg Landrum.Testing
I included pytest modules for
uncharge_mol
andis_symmetric_to_substructure
Other notes
The two uncharging methods have different behaviors regarding explicit hydrogens.
vs.
Is the desired behavior to re-number?
They still return the same smiles if you use
mol_to_smiles
though.