def buildCloseContactAtoms(self, percentCutoff):
     pairDict = self.distanceSelector.select(self.lig_atoms, 
                     self.macro_atoms, percentCutoff=percentCutoff)
     self.pairDict = pairDict
     #reset here
     lig_close_ats = AtomSet()
     macro_close_ats = AtomSet()
     closeAtoms = AtomSet()  #both sets
     cdict = {}
     for k,v in pairDict.items():
         if len(v):
             cdict[k] = 1
         for at in v:
             if at not in macro_close_ats:
                 cdict[at] = 1
     closeAtoms = AtomSet(cdict.keys())
     
     #macro_close_ats = closeAtoms.get(lambda x: x.top==self.macro)
     #lig_close_ats = closeAtoms.get(lambda x: x.top==self.lig)
     lig_close_ats = closeAtoms.get(lambda x: x in self.lig_atoms)
     macro_close_ats = closeAtoms.get(lambda x: x in self.macro_atoms)
     rdict = self.results
     rdict['lig_close_atoms'] = lig_close_ats
     rdict['lig_close_res'] = lig_close_ats.parent.uniq()
     rdict['lig_close_carbons'] = lig_close_ats.get(lambda x: x.element=='C')
     rdict['lig_close_non_hb'] = lig_close_ats - rdict['lig_hb_atoms']
     rdict['macro_close_atoms'] = macro_close_ats
     rdict['macro_close_res'] = ResidueSet(macro_close_ats.parent.uniq())
     rdict['macro_close_carbons'] = macro_close_ats.get(lambda x: x.element=='C')
     rdict['macro_close_non_hb'] = macro_close_ats - rdict['macro_hb_atoms']
     #deprecate this
     rdict['macro_close_only'] = macro_close_ats - rdict['macro_hb_atoms']
Esempio n. 2
0
 def buildCloseContactAtoms(self, percentCutoff):
     pairDict = self.distanceSelector.select(self.lig_atoms, 
                     self.macro_atoms, percentCutoff=percentCutoff)
     self.pairDict = pairDict
     #reset here
     lig_close_ats = AtomSet()
     macro_close_ats = AtomSet()
     closeAtoms = AtomSet()  #both sets
     cdict = {}
     for k,v in pairDict.items():
         if len(v):
             cdict[k] = 1
         for at in v:
             if at not in macro_close_ats:
                 cdict[at] = 1
     closeAtoms = AtomSet(cdict.keys())
     
     #macro_close_ats = closeAtoms.get(lambda x: x.top==self.macro)
     #lig_close_ats = closeAtoms.get(lambda x: x.top==self.lig)
     lig_close_ats = closeAtoms.get(lambda x: x in self.lig_atoms)
     macro_close_ats = closeAtoms.get(lambda x: x in self.macro_atoms)
     rdict = self.results
     rdict['lig_close_atoms'] = lig_close_ats
     rdict['lig_close_res'] = lig_close_ats.parent.uniq()
     rdict['lig_close_carbons'] = lig_close_ats.get(lambda x: x.element=='C')
     rdict['lig_close_non_hb'] = lig_close_ats - rdict['lig_hb_atoms']
     rdict['macro_close_atoms'] = macro_close_ats
     rdict['macro_close_res'] = ResidueSet(macro_close_ats.parent.uniq())
     rdict['macro_close_carbons'] = macro_close_ats.get(lambda x: x.element=='C')
     rdict['macro_close_non_hb'] = macro_close_ats - rdict['macro_hb_atoms']
     #deprecate this
     rdict['macro_close_only'] = macro_close_ats - rdict['macro_hb_atoms']
 def buildHydrogenBonds(self):
     self.results = d = {}
     h_pairDict = self.hydrogen_bond_builder.build(self.lig_atoms, self.macro_atoms)
     self.h_pairDict = h_pairDict
     #keys should be from lig, values from macro 
     #sometimes are not...@@check this@@
     h_results = {}
     for k, v in h_pairDict.items():
         h_results[k] = 1
         for at in v:
             h_results[at] = 1
     all_hb_ats = AtomSet(h_results.keys())  #all
     macro_hb_ats = d['macro_hb_atoms'] = all_hb_ats.get(lambda x: x.top==self.macro)
     # process lig
     lig_hb_res = d['lig_hb_res'] = ResidueSet()
     lig_hb_sidechains = d['lig_hb_sidechains'] = AtomSet()
     lig_gly_atoms = AtomSet()
     lig_hb_ats = d['lig_hb_atoms'] = all_hb_ats.get(lambda x: x in self.lig_atoms)
     if len(lig_hb_ats):
         d['lig_hb_res'] = lig_hb_res = lig_hb_ats.parent.uniq()
         d['lig_hb_sidechains'] = lig_hb_sidechains = lig_hb_res.atoms.get('sidechain')
         #to visualize hbonding involving GLY residues which have no side chains, show backbone atoms
         lig_gly_res = d['lig_hb_gly_res'] = lig_hb_res.get(lambda x: x.type=='GLY')
         if len(lig_gly_res):
             lig_gly_atoms = lig_gly_res.atoms
     # build extended set of hbonding_atoms_to_show as lines, just in case
     lig_hbas = AtomSet(lig_hb_sidechains + lig_gly_atoms + lig_hb_ats) #all from lig
     extraAts = AtomSet()
     for at in lig_hbas:
         for b in at.bonds:
             at2 = b.atom1
             if at2==at: 
                 at2 = b.atom2
             #add it to the atomset
             if at2 not in lig_hbas:
                 extraAts.append(at2)
     if len(lig_hbas):
         for at in extraAts:
             lig_hbas.append(at)
     d['lig_hbas'] = lig_hbas
     # process macro
     macro_hb_res =  ResidueSet()
     d['macro_hb_res'] = macro_hb_res
     d['macro_hb_sidechains'] = AtomSet()
     d['macro_hb_gly_res'] = ResidueSet()
     if len(macro_hb_ats):
         macro_hb_res = macro_hb_ats.parent.uniq()
     #4. display sidechains of hbonding residues as sticksNballs
         macro_hb_sidechains = d['macro_hb_sidechains'] = macro_hb_res.atoms.get('sidechain')
         macro_hb_gly_res = d['macro_hb_gly_res'] = macro_hb_res.get(lambda x: x.type=='GLY')
     macro_hb_gly_res = ResidueSet()
     macro_hb_gly_atoms = AtomSet()
     if len(macro_hb_gly_res): 
         macro_hb_gly_atoms = macro_hb_gly_res.atoms
     d['macro_hb_gly_atoms'] = macro_hb_gly_atoms
     # build extended set of hbonding_atoms_to_show as lines
     macro_hbas = d['macro_hbas'] = AtomSet()
     if len(macro_hb_ats):
         macro_hbas = d['macro_hbas'] = AtomSet(macro_hb_sidechains + macro_hb_gly_atoms + macro_hb_ats) #all from macro
     #add atoms bonded to hb atoms to make lines displayed more reasonable
     extraAts = AtomSet()
     for at in macro_hbas:
         for b in at.bonds:
             at2 = b.atom1
             if at2==at: 
                 at2 = b.atom2
             #add it to the atomset
             if at2 not in macro_hbas:
                 extraAts.append(at2)
     if len(macro_hbas):
         for at in extraAts:
             macro_hbas.append(at)
     d['hbas_macro'] = macro_hbas
Esempio n. 4
0
 def buildHydrogenBonds(self):
     self.results = d = {}
     h_pairDict = self.hydrogen_bond_builder.build(self.lig_atoms, self.macro_atoms)
     self.h_pairDict = h_pairDict
     #keys should be from lig, values from macro 
     #sometimes are not...@@check this@@
     h_results = {}
     for k, v in h_pairDict.items():
         h_results[k] = 1
         for at in v:
             h_results[at] = 1
     all_hb_ats = AtomSet(h_results.keys())  #all
     macro_hb_ats = d['macro_hb_atoms'] = all_hb_ats.get(lambda x: x.top==self.macro)
     # process lig
     lig_hb_res = d['lig_hb_res'] = ResidueSet()
     lig_hb_sidechains = d['lig_hb_sidechains'] = AtomSet()
     lig_gly_atoms = AtomSet()
     lig_hb_ats = d['lig_hb_atoms'] = all_hb_ats.get(lambda x: x in self.lig_atoms)
     if len(lig_hb_ats):
         d['lig_hb_res'] = lig_hb_res = lig_hb_ats.parent.uniq()
         d['lig_hb_sidechains'] = lig_hb_sidechains = lig_hb_res.atoms.get('sidechain')
         #to visualize hbonding involving GLY residues which have no side chains, show backbone atoms
         lig_gly_res = d['lig_hb_gly_res'] = lig_hb_res.get(lambda x: x.type=='GLY')
         if len(lig_gly_res):
             lig_gly_atoms = lig_gly_res.atoms
     # build extended set of hbonding_atoms_to_show as lines, just in case
     lig_hbas = AtomSet(lig_hb_sidechains + lig_gly_atoms + lig_hb_ats) #all from lig
     extraAts = AtomSet()
     for at in lig_hbas:
         for b in at.bonds:
             at2 = b.atom1
             if at2==at: 
                 at2 = b.atom2
             #add it to the atomset
             if at2 not in lig_hbas:
                 extraAts.append(at2)
     if len(lig_hbas):
         for at in extraAts:
             lig_hbas.append(at)
     d['lig_hbas'] = lig_hbas
     # process macro
     macro_hb_res =  ResidueSet()
     d['macro_hb_res'] = macro_hb_res
     d['macro_hb_sidechains'] = AtomSet()
     d['macro_hb_gly_res'] = ResidueSet()
     if len(macro_hb_ats):
         macro_hb_res = macro_hb_ats.parent.uniq()
     #4. display sidechains of hbonding residues as sticksNballs
         macro_hb_sidechains = d['macro_hb_sidechains'] = macro_hb_res.atoms.get('sidechain')
         macro_hb_gly_res = d['macro_hb_gly_res'] = macro_hb_res.get(lambda x: x.type=='GLY')
     macro_hb_gly_res = ResidueSet()
     macro_hb_gly_atoms = AtomSet()
     if len(macro_hb_gly_res): 
         macro_hb_gly_atoms = macro_hb_gly_res.atoms
     d['macro_hb_gly_atoms'] = macro_hb_gly_atoms
     # build extended set of hbonding_atoms_to_show as lines
     macro_hbas = d['macro_hbas'] = AtomSet()
     if len(macro_hb_ats):
         macro_hbas = d['macro_hbas'] = AtomSet(macro_hb_sidechains + macro_hb_gly_atoms + macro_hb_ats) #all from macro
     #add atoms bonded to hb atoms to make lines displayed more reasonable
     extraAts = AtomSet()
     for at in macro_hbas:
         for b in at.bonds:
             at2 = b.atom1
             if at2==at: 
                 at2 = b.atom2
             #add it to the atomset
             if at2 not in macro_hbas:
                 extraAts.append(at2)
     if len(macro_hbas):
         for at in extraAts:
             macro_hbas.append(at)
     d['hbas_macro'] = macro_hbas