def test_RotatableBondSelector_select_none(self):
     """
      test RotatableBond select: no bonds
     """
     rotSel = RotatableBondSelector()
     ats = self.mol.allAtoms[4:8]
     bnds = ats.bonds[0]
     resultBnds = rotSel.select(bnds)
     #print 'no_cb_bonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds) , 1)
 def test_RotatableBondSelector_select_none(self):
     """
      test RotatableBond select: no bonds
     """
     rotSel = RotatableBondSelector()
     ats = self.mol.allAtoms[4:8]
     bnds = ats.bonds[0]
     resultBnds = rotSel.select(bnds)
     #print 'no_cb_bonds:len(resultBnds)=', len(resultBnds)
     self.assertEqual(len(resultBnds), 1)
 def test_RotatableBondSelector_select_all(self):
     """
      test RotatableBond select: all bonds
     """
     rotSel = RotatableBondSelector()
     ats = self.mol.allAtoms
     bnds = ats.bonds[0]
     resultBnds = rotSel.select(bnds)
     #print 'all_cb_bonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 211)
     #because of disulfide bridges-> large cycles
     self.assertEqual(len(resultBnds), 89)
 def test_RotatableBondSelector_select_all(self):
     """
      test RotatableBond select: all bonds
     """
     rotSel = RotatableBondSelector()
     ats = self.mol.allAtoms
     bnds = ats.bonds[0]
     resultBnds = rotSel.select(bnds)
     #print 'all_cb_bonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 211)
     #because of disulfide bridges-> large cycles
     self.assertEqual(len(resultBnds), 89)
 def test_RotatableBondSelector_select_some(self):
     """
      test RotatableBond select: some bonds
     """
     rotSel = RotatableBondSelector()
     ats = self.mol.allAtoms[:50]
     bnds = ats.bonds[0]
     resultBnds = rotSel.select(bnds)
     #print 'some_cb_bonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 34)
     #because of disulfide bridges-> large cycles
     #self.assertEqual(len(resultBnds) , 27)
     self.assertEqual(len(resultBnds) , 20)
 def test_RotatableBondSelector_select_some(self):
     """
      test RotatableBond select: some bonds
     """
     rotSel = RotatableBondSelector()
     ats = self.mol.allAtoms[:50]
     bnds = ats.bonds[0]
     resultBnds = rotSel.select(bnds)
     #print 'some_cb_bonds:len(resultBnds)=', len(resultBnds)
     #self.assertEqual(len(resultBnds) , 34)
     #because of disulfide bridges-> large cycles
     #self.assertEqual(len(resultBnds) , 27)
     self.assertEqual(len(resultBnds), 20)
def setAutoFlexFields(res):
    #process residues
    if hasattr(res, 'setup'):
        return
    res.setup = 1
    res.atoms.used = 0
    res.atoms.bonds[0].possibleTors = 0
    res.atoms.bonds[0].activeTors = 0
    backbone_names = [
        'C', 'N', 'O', 'HN', 'HN1', 'HN2', 'HA', 'H1', 'H2', 'H3', 'HO', 'H'
    ]
    #includes CA
    sidechain = res.atoms.get(lambda x: x.name not in backbone_names)
    res.sideChain = sidechain
    bondlist = res.bondlist = sidechain.bonds[0]
    bondlist.leaf = 0
    bondlist.possibleTors = 0
    bondlist.activeTors = 0
    rbs = RotatableBondSelector()
    rotatables = rbs.select(bondlist)
    for b in rotatables:
        b.possibleTors = 1
        b.activeTors = 1
    amides = AmideBondSelector().select(bondlist)
    for b in amides:
        b.activeTors = 0
        b.possibleTors = 1
    guanidiniums = GuanidiniumBondSelector().select(bondlist)
    for b in guanidiniums:
        b.activeTors = 0
        b.possibleTors = 1
    leaves = LeafBondSelector().select(bondlist)
    for b in leaves:
        b.activeTors = 0
        b.possibleTors = 0
    res.torscount = len(bondlist.get(lambda x: x.activeTors == 1))
    #this field is not used in AutoDock4
    res.torsdof = res.torscount
    res.torscount = len(bondlist.get(lambda x: x.activeTors == 1))
    res.torsdof = res.torscount

    caAtoms = res.atoms.get(lambda x: x.name == 'CA')
    #get returns an AtomSet
    if caAtoms:  #this checks for len(caAtoms)
        res.rootlist = caAtoms
    else:
        res.rootlist = AtomSet([res.atoms.get(lambda x: x._uniqIndex == 0)[0]])
        res.sideChain = res.atoms
def setAutoFlexFields(res):
    #process residues
    if hasattr(res, 'setup'): 
        return
    res.setup = 1
    res.atoms.used = 0
    res.atoms.bonds[0].possibleTors = 0
    res.atoms.bonds[0].activeTors = 0
    backbone_names = ['C','N','O','HN','HN1','HN2', 'HA', 
                'H1','H2','H3','HO', 'H']
    #includes CA
    sidechain = res.atoms.get(lambda x: x.name not in backbone_names)
    res.sideChain = sidechain
    bondlist = res.bondlist = sidechain.bonds[0]
    bondlist.leaf = 0
    bondlist.possibleTors = 0
    bondlist.activeTors = 0
    rbs = RotatableBondSelector()
    rotatables = rbs.select(bondlist)
    for b in rotatables:
        b.possibleTors = 1
        b.activeTors = 1
    amides = AmideBondSelector().select(bondlist)
    for b in amides:
        b.activeTors = 0
        b.possibleTors = 1
    guanidiniums = GuanidiniumBondSelector().select(bondlist)
    for b in guanidiniums:
        b.activeTors = 0
        b.possibleTors = 1
    leaves = LeafBondSelector().select(bondlist)
    for b in leaves:
        b.activeTors = 0
        b.possibleTors = 0
    res.torscount = len(bondlist.get(lambda x: x.activeTors==1))
    #this field is not used in AutoDock4
    res.torsdof = res.torscount
    res.torscount = len(bondlist.get(lambda x: x.activeTors==1))
    res.torsdof = res.torscount
    
    caAtoms = res.atoms.get(lambda x: x.name=='CA')
    #get returns an AtomSet
    if caAtoms:  #this checks for len(caAtoms)
        res.rootlist = caAtoms
    else:
        res.rootlist = AtomSet([res.atoms.get(lambda x: x._uniqIndex == 0)[0]])
        res.sideChain = res.atoms
Exemple #9
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_RotatableBondSelector_constructor(self):
     """
      test RotatableBond constructor
     """
     rotSel = RotatableBondSelector()
     self.assertEqual(rotSel.__class__, RotatableBondSelector)