当前位置: 首页>>代码示例>>Python>>正文


Python AtomSet.uniq方法代码示例

本文整理汇总了Python中MolKit.molecule.AtomSet.uniq方法的典型用法代码示例。如果您正苦于以下问题:Python AtomSet.uniq方法的具体用法?Python AtomSet.uniq怎么用?Python AtomSet.uniq使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MolKit.molecule.AtomSet的用法示例。


在下文中一共展示了AtomSet.uniq方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: removeNeighbors

# 需要导入模块: from MolKit.molecule import AtomSet [as 别名]
# 或者: from MolKit.molecule.AtomSet import uniq [as 别名]
 def removeNeighbors(self, atDict):
     #filter out at-itself and at-bondedat up to 1:4
     #NB keys could be hydrogens OR donors
     for at in atDict.keys():
         closeAts = atDict[at]
         bondedAts = AtomSet([])
         for b in at.bonds:
             ###at2 = b.neighborAtom(at)
             at2 = b.atom1
             if id(at2)==id(at): at2 = b.atom2
             bondedAts.append(at2)
             #9/13 remove this:
             ##also remove 1-3
             for b2 in at2.bonds:
                 at3 = b2.atom1
                 if id(at3)==id(at2): at3 = b.atom2
                 #at3 = b2.neighborAtom(at2)
                 if id(at3)!=id(at):
                     bondedAts.append(at3)
                 #for b3 in at3.bonds:
                     #at4 = b2.neighborAtom(at3)
                     #if at4!=at and at4!=at2:
                         #bondedAts.append(at4)
         bondedAts = bondedAts.uniq()
         goodAts = []
         for i in range(len(closeAts)):
             cAt = closeAts[i]
             if cAt not in bondedAts:
                 goodAts.append(cAt)
         if len(goodAts):
             atDict[at] = goodAts
         else:
             del atDict[at]
     return atDict
开发者ID:Pymol-Scripts,项目名称:Pymol-script-repo,代码行数:36,代码来源:hydrogenBondBuilder.py

示例2: setAromaticCarbons

# 需要导入模块: from MolKit.molecule import AtomSet [as 别名]
# 或者: from MolKit.molecule.AtomSet import uniq [as 别名]
 def setAromaticCarbons(self, molecule, cutoff=None, debug=False):
     assert len(molecule.allAtoms.bonds[0])
     if cutoff: 
         if cutoff!=self.cutoff:
             old_aromCs = molecule.allAtoms.get(lambda x:\
                             (x.element=='C' and x.autodock_element=='A'))
             if old_aromCs is not None and len(old_aromCs)!=0:
                 if debug: print "resetting ", len(old_aromCs), " prior aromCs"
                 self.set_carbon_names(old_aromCs, 'C')
         self.cutoff = cutoff
     typed_atoms = molecule.allAtoms.get(lambda x: hasattr(x, 'autodock_element'))
     currentAromCs = AtomSet()
     if typed_atoms is not None and len(typed_atoms)==len(molecule.allAtoms):
         currentAromCs = molecule.allAtoms.get(lambda x: (x.element=='C' and x.autodock_element=='A'))
     if debug:
         if currentAromCs is not None and len(currentAromCs):
             print "now: ", len(currentAromCs)
         else:
             print "now: no aromCs"
     aromBnds = self.aromBndSel.select(molecule.allAtoms.bonds[0],
                                               self.cutoff)
     aromBndAts = self.aromBndSel.getAtoms(aromBnds)
     result = AtomSet()
     changed = AtomSet()
     if len(aromBndAts):
         aromCs =  AtomSet(filter(lambda x: x.element=='C', \
                                           aromBndAts))           
         aromCs = aromCs.uniq()
         if len(aromCs)>len(result):
             result = aromCs
         if debug: 
             print "len(aromCs)=", len(aromCs)
         changed = self.set_carbon_names(aromCs, 'A')
     #if len(changed)>len(result):
     #    result = changed
     #return  result
     return changed
开发者ID:8848,项目名称:Pymol-script-repo,代码行数:39,代码来源:atomTypeTools.py


注:本文中的MolKit.molecule.AtomSet.uniq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。