Esempio n. 1
0
  def testVectorDescriptors(self):
    m = Chem.MolFromSmiles('CCCc1ccccc1')
    results = rdMolDescriptors.BCUT2D(m)
    names = ["BCUT2D_%s"%s for s in ('MWHI',"MWLOW","CHGHI","CHGLO",
                                     "LOGPHI","LOGPLOW","MRHI","MRLOW")]
    for i,n in  enumerate(names):
      f = getattr(Descriptors, n)
      self.assertEqual(results[i], f(m))

    results = rdMolDescriptors.CalcAUTOCORR2D(m)
    names = ["AUTOCORR2D_%s"%str(i+1) for i in range(192)]
    for i,n in enumerate(names):
      f = getattr(Descriptors, n)
      self.assertEqual(results[i], f(m))

    def testVectorDescriptorsInDescList(self):
      # First try only bcuts should exist
      descriptors = set([n for n,_ in Descriptors.descList])
      names = set(["BCUT2D_%s"%str(i+1) for i in range(8)])
      self.assertEqual(descriptors.intersection(names), names)
      
      Descriptors.setupAUTOCORRDescriptors()
      descriptors2 = set([n for n,_ in Descriptors.descList])
      self.assertEqual(descriptors2.intersection(descriptors), descriptors)

      names = ["AUTOCORR2D_%s"%str(i+1) for i in range(192)]
      self.assertEqual(descriptors.intersection(names), names)
Esempio n. 2
0
 def test1AUTOCORR2D(self):
     # not really a 3D descriptor, but this was added at the same time
     with open(os.path.join(self.dataDir, 'auto2D.out')) as refFile:
         for i, m in enumerate(self.suppl):
             if i > 10: break
             nm = m.GetProp('_Name')
             inl = refFile.readline()
             split = inl.split('\t')
             self.assertEqual(split[0], nm)
             split.pop(0)
             vs = rdMD.CalcAUTOCORR2D(m)
             for rv, nv in zip(split, vs):
                 self.assertAlmostEqual(float(rv), nv, delta=0.05)
Esempio n. 3
0
    def testVectorDescriptors(self):
        m = Chem.MolFromSmiles('CCCc1ccccc1')
        results = rdMolDescriptors.BCUT2D(m)
        names = [
            "BCUT2D_%s" % s for s in ('MWHI', "MWLOW", "CHGHI", "CHGLO",
                                      "LOGPHI", "LOGPLOW", "MRHI", "MRLOW")
        ]
        for i, n in enumerate(names):
            f = getattr(Descriptors, n)
            self.assertEqual(results[i], f(m))

        results = rdMolDescriptors.CalcAUTOCORR2D(m)
        names = ["AUTOCORR2D_%s" % str(i + 1) for i in range(192)]
        for i, n in enumerate(names):
            f = getattr(Descriptors, n)
            self.assertEqual(results[i], f(m))
Esempio n. 4
0
def AutoCorr2D(mol):
    from rdkit.Chem import rdMolDescriptors
    vector = rdMolDescriptors.CalcAUTOCORR2D(mol)
    return vector