예제 #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])
예제 #2
0
 def test_PeptideBackBoneBondSelector_select_all(self):
     """
      test PetideBackBone select: all bonds
     """
     ppbbSel = PeptideBackBoneBondSelector()
     ats = self.mol.allAtoms
     bnds = ats.bonds[0]
     resultBnds = ppbbSel.select(bnds)
     #print 'all_ppbbbonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds) , 132)
예제 #3
0
 def test_PeptideBackBoneBondSelector_select_none(self):
     """
      test PetideBackBone select: no bonds
     """
     ppbbSel = PeptideBackBoneBondSelector()
     ats = self.mol.allAtoms[4:8]
     bnds = ats.bonds[0]
     resultBnds = ppbbSel.select(bnds)
     #print 'no_ppbbbonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds) , 0)
 def test_PeptideBackBoneBondSelector_select_all(self):
     """
      test PetideBackBone select: all bonds
     """
     ppbbSel = PeptideBackBoneBondSelector()
     ats = self.mol.allAtoms
     bnds = ats.bonds[0]
     resultBnds = ppbbSel.select(bnds)
     #print 'all_ppbbbonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds), 132)
 def test_PeptideBackBoneBondSelector_select_none(self):
     """
      test PetideBackBone select: no bonds
     """
     ppbbSel = PeptideBackBoneBondSelector()
     ats = self.mol.allAtoms[4:8]
     bnds = ats.bonds[0]
     resultBnds = ppbbSel.select(bnds)
     #print 'no_ppbbbonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds), 0)
예제 #6
0
 def test_PeptideBackBoneBondSelector_select_some(self):
     """
      test PetideBackBone select: some bonds
     """
     ppbbSel = PeptideBackBoneBondSelector()
     ats = self.mol.allAtoms[:50]
     bnds = ats.bonds[0]
     resultBnds = ppbbSel.select(bnds)
     #print 'some_ppbbbonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 22)
     self.assertEqual(len(resultBnds) , 17)
 def test_PeptideBackBoneBondSelector_select_some(self):
     """
      test PetideBackBone select: some bonds
     """
     ppbbSel = PeptideBackBoneBondSelector()
     ats = self.mol.allAtoms[:50]
     bnds = ats.bonds[0]
     resultBnds = ppbbSel.select(bnds)
     #print 'some_ppbbbonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 22)
     self.assertEqual(len(resultBnds), 17)
예제 #8
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_PeptideBackBoneBondSelector_constructor(self):
     """
      test PetideBackBone constructor
     """
     ppbbSel = PeptideBackBoneBondSelector()
     self.assertEqual(ppbbSel.__class__, PeptideBackBoneBondSelector)