def splitMol(self, mol, bondsToKeep): ''' fragments a molecule on a particular set of BRICS bonds. Partially sanitizes the results ''' bbnds = BRICS.FindBRICSBonds(mol) bndsToTry = [] lbls = [] for aids, lbl in bbnds: if lbl in bondsToKeep: bndsToTry.append(mol.GetBondBetweenAtoms( aids[0], aids[1]).GetIdx()) lbls.append([int(x) for x in lbl]) if not bndsToTry: return [] res = Chem.FragmentOnSomeBonds(mol, bndsToTry, dummyLabels=lbls) # We need at least a partial sanitization for the rest of what we will be doing: for entry in res: entry.UpdatePropertyCache(False) Chem.FastFindRings(entry) return res