Exemple #1
0
    def test1(self):
        m = Chem.MolFromSmiles('OCCc1ccccc1')
        mrg = rdRG.GenerateMolExtendedReducedGraph(m)
        mrg.UpdatePropertyCache(False)
        self.assertEqual('*cCCO', Chem.MolToSmiles(mrg))

        m = Chem.MolFromSmiles('OCCC1CCCCC1')
        mrg = rdRG.GenerateMolExtendedReducedGraph(m)
        mrg.UpdatePropertyCache(False)
        self.assertEqual('*CCCO', Chem.MolToSmiles(mrg))
Exemple #2
0
 def testCanRetrieveProp(self):
     m = Chem.MolFromSmiles('OCCc1ccccc1')
     mrg = rdRG.GenerateMolExtendedReducedGraph(m)
     erg_types = [
         tuple(atom.GetPropsAsDict().get('_ErGAtomTypes'))
         for atom in mrg.GetAtoms()
     ]
     self.assertEqual(erg_types, [(0, 1), (), (), (), (5, )])
Exemple #3
0
    def test2(self):
        m = Chem.MolFromSmiles('OCCc1ccccc1')
        mrg = rdRG.GenerateMolExtendedReducedGraph(m)
        mrg.UpdatePropertyCache(False)
        self.assertEqual('*cCCO', Chem.MolToSmiles(mrg))

        fp1 = rdRG.GenerateErGFingerprintForReducedGraph(mrg)
        fp2 = rdRG.GetErGFingerprint(m)
        md = max(abs(fp1 - fp2))
        self.assertLess(md, 1e-4)