Esempio n. 1
0
    def test_classifierVSselectors(self):
        """
         make sure that the classifier returns the same results as its
         selectors
        """
        bndClassifier = BondClassifier({
            'amide':
            AmideBondSelector(),
            'cycle':
            CycleBondSelector(),
            'leaf':
            LeafBondSelector(),
            'peptide':
            PeptideBackBoneBondSelector(),
        })
        #all the bonds in the molecule as a BondSet
        bnds = self.mol.allAtoms.bonds[0]

        #get the specified bonds as a BondSet
        localDict = {}
        localDict['amide'] = AmideBondSelector().select(bnds)
        localDict['cycle'] = CycleBondSelector().select(bnds)
        localDict['leaf'] = LeafBondSelector().select(bnds)
        localDict['peptide'] = PeptideBackBoneBondSelector().select(bnds)

        #make the classifier do the same thing
        resultDict = bndClassifier.classify(bnds)

        for k in resultDict.keys():
            self.compareBondSets(localDict[k], resultDict[k])
 def test_CycleBondSelector_select_none(self):
     """
      test CycleBondSelector select: no bonds
     """
     cbSel = CycleBondSelector()
     ats = self.mol.allAtoms[4:8]
     bnds = ats.bonds[0]
     resultBnds = cbSel.select(bnds)
     #print 'no_cb_bonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds) , 0)
 def test_CycleBondSelector_select_none(self):
     """
      test CycleBondSelector select: no bonds
     """
     cbSel = CycleBondSelector()
     ats = self.mol.allAtoms[4:8]
     bnds = ats.bonds[0]
     resultBnds = cbSel.select(bnds)
     #print 'no_cb_bonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds), 0)
 def test_CycleBondSelector_select_all(self):
     """
      test CycleBondSelector select: all bonds
     """
     cbSel = CycleBondSelector()
     ats = self.mol.allAtoms
     bnds = ats.bonds[0]
     resultBnds = cbSel.select(bnds)
     #print 'all_cb_bonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 43)
     #because of di-sulfide bridges:
     #when increase RingFinder parameter "maxSize"
     self.assertEqual(len(resultBnds) , 165)
 def test_CycleBondSelector_select_all(self):
     """
      test CycleBondSelector select: all bonds
     """
     cbSel = CycleBondSelector()
     ats = self.mol.allAtoms
     bnds = ats.bonds[0]
     resultBnds = cbSel.select(bnds)
     #print 'all_cb_bonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 43)
     #because of di-sulfide bridges:
     #when increase RingFinder parameter "maxSize"
     self.assertEqual(len(resultBnds), 165)
 def test_CycleBondSelector_select_some(self):
     """
      test CycleBondSelector select: some bonds
     """
     cbSel = CycleBondSelector()
     ats = self.mol.allAtoms[:50]
     bnds = ats.bonds[0]
Esempio n. 7
0
 def __init__(self, tolerance=0.01, detectAll=True):
     self.detect_all_cycles = detectAll
     self.d = {
         'amide': AmideBondSelector(),
         'ppbb': PeptideBackBoneBondSelector(),
         'leaf': LeafBondSelector(),
         'cycle': CycleBondSelector(),
         'rotatable': RotatableBondSelector(),
         'bondOrder2': BondOrderBondSelector(2),
         'hydrogenRotators': HydrogenRotatorBondSelector(),
         'guanidinium': GuanidiniumBondSelector(),
         'aromatic': AromaticCycleBondSelector2()
     }
     BondClassifier.__init__(self, self.d)
     #used to detect colinear atoms
     #if dist1+dist2<dist13+0.1
     self.tolerance = 0.01
 def test_CycleBondSelector_constructor(self):
     """
      test CycleBondSelector constructor
     """
     cbSel = CycleBondSelector()
     self.assertEqual(cbSel.__class__, CycleBondSelector)