Пример #1
0
 def test5(self):
   """ check containing mols, use Hs, no valence """
   tgts = [('CCC(O)C(=O)O', ('O[CH-][CH2-]', 'O[CH-][C-]=O')), ]
   for smi, matches in tgts:
     m = Chem.MolFromSmiles(smi)
     fp1 = Chem.RDKFingerprint(m, 2, 7, 9192, 4, 1)
     _ = fp1.GetOnBits()
     for match in matches:
       m2 = Chem.MolFromSmiles(match)
       fp2 = Chem.RDKFingerprint(m2, 2, 7, 9192, 4, 1)
       v1, _ = DataStructs.OnBitProjSimilarity(fp2, fp1)
       self.assertAlmostEqual(v1, 1, 'substruct %s not properly contained in %s' % (match, smi))
Пример #2
0
    def test4(self):
        """ check containing mols, no Hs, no valence

    """
        tgts = [
            ('CCC(O)C(=O)O', ('CCC', 'OCC', 'OCC=O', 'OCCO', 'CCCC', 'OC=O',
                              'CC(O)C')),
        ]
        for smi, matches in tgts:
            m = Chem.MolFromSmiles(smi)
            fp1 = Chem.RDKFingerprint(m, 2, 7, 9192, 4, 0)
            obs = fp1.GetOnBits()
            for match in matches:
                m2 = Chem.MolFromSmiles(match)
                fp2 = Chem.RDKFingerprint(m2, 2, 7, 9192, 4, 0)
                v1, v2 = DataStructs.OnBitProjSimilarity(fp2, fp1)
                assert feq(
                    v1,
                    1.0000), 'substruct %s not properly contained in %s' % (
                        match, smi)