Hi Puck, sorry dor the delay in replying.
After removing the bond you will need to adjust the number of explicit Hs on both ends with SetNumExplicitHs(), and then add those Hs in the molecule graph as real atoms with Chem.AddHs():
rwmol = Chem.RWMol(mol) bonds = rwmol.GetBonds() b = rwmol.GetBondWithIdx(2) a1 = b.GetBeginAtom() a2 = b.GetEndAtom() rwmol.RemoveBond(a1.GetIdx(), a2.GetIdx()) a1.SetNumExplicitHs(a1.GetNumExplicitHs() + 1) a2.SetNumExplicitHs(a2.GetNumExplicitHs() + 1) rwmol = Chem.AddHs(rwmol, explicitOnly=True)The rdmolops.FragmentOnBonds() functions adjusts the valences for you, but you will need to adjust them manually if you do the fragmentation at a lower level with RemoveBond().
I have attached the modified notebook. Cheers, p. On 12/02/2020 10:03, Puck van Gerwen wrote:
Dear all,I am trying to read in SMILES to generate mol objects which I then break into fragments using rwmol.RemoveBond(). Thereafter I want to sanitize the fragments by saturating with hydrogen. However, I am finding that rdkit often doesn't sanitize the fragments consistently, leaving trivalent carbon atoms. I've attached a jupyter notebook of an example. Could anyone help me consistently generate sanitized fragments?Best regards -- *Puck van Gerwen* Doktorandin / PhD candidate Departement Chemie Klingelbergstrasse 80 CH-4056 Basel https://chemspacelab.org/ _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
NotSanitizing.ipynb
Description: application/ipynb
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss