本文整理匯總了Python中MolKit.molecule.AtomSet.full_name方法的典型用法代碼示例。如果您正苦於以下問題:Python AtomSet.full_name方法的具體用法?Python AtomSet.full_name怎麽用?Python AtomSet.full_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MolKit.molecule.AtomSet
的用法示例。
在下文中一共展示了AtomSet.full_name方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: buildCloseContactAtoms
# 需要導入模塊: from MolKit.molecule import AtomSet [as 別名]
# 或者: from MolKit.molecule.AtomSet import full_name [as 別名]
def buildCloseContactAtoms(self, percentCutoff, ligand, comment="USER AD> "):
pairDict = self.distanceSelector.select(ligand.allAtoms,
self.macro_atoms, percentCutoff=percentCutoff)
self.pairDict = pairDict
#reset here
lig_close_ats = AtomSet()
macro_close_ats = AtomSet()
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())
lig_close_ats = closeAtoms.get(lambda x: x.top==ligand).uniq()
#ligClAtStr = lig_close_ats.full_name()
ligClAtStr = comment + "lig_close_ats: %d\n" %( len(lig_close_ats))
if len(lig_close_ats):
ligClAtStr += comment + "%s\n" %( lig_close_ats.full_name())
macro_close_ats = closeAtoms.get(lambda x: x in self.macro_atoms).uniq()
macroClAtStr = comment + "macro_close_ats: %d\n" %( len(macro_close_ats))
if len(macro_close_ats):
macroClAtStr += comment + "%s\n" %( macro_close_ats.full_name())
#macroClAtStr = "macro_close_ats: " + len(macro_close_ats)+"\n" +macro_close_ats.full_name()
rdict = self.results
rdict['lig_close_atoms'] = lig_close_ats
rdict['macro_close_atoms'] = macro_close_ats
if self.verbose: print "macroClAtStr=", macroClAtStr
if self.verbose: print "ligClAtStr=", ligClAtStr
if self.verbose: print "returning "+ macroClAtStr + '==' + ligClAtStr
return macroClAtStr , ligClAtStr
示例2: setupUndoAfter
# 需要導入模塊: from MolKit.molecule import AtomSet [as 別名]
# 或者: from MolKit.molecule.AtomSet import full_name [as 別名]
def setupUndoAfter(self, ats, angle,**kw):
#no atoms, <4 atoms,
aSet = AtomSet(self.atomList)
self.undoMenuString = self.name
if len(self.atomList)==0:
undoCmd = 'self.setTorsionGC.atomList=[]; self.setTorsionGC.update()'
elif len(self.atomList)<4:
#need to step back here
undoCmd = 'self.setTorsionGC.atomList=self.setTorsionGC.atomList[:-1]; self.setTorsionGC.update()'
elif self.origValue==self.oldValue:
return
else:
restoreAngle = self.origValue
self.undoNow = 1
undoCmd = 'self.setTorsionGC(\''+ aSet.full_name()+ '\',' + str(restoreAngle) + ', topCommand=0)'
self.vf.undo.addEntry((undoCmd), (self.name))
示例3: AddBondsGUICommand
# 需要導入模塊: from MolKit.molecule import AtomSet [as 別名]
# 或者: from MolKit.molecule.AtomSet import full_name [as 別名]
class AddBondsGUICommand(MVCommand, MVAtomICOM):
"""
The AddBondGUICommand provides an interactive way of creating bonds between two given atoms by picking on them. To use this command you need first to load it into PMV. Then you can find the entry 'addBonds' under the Edit menu. To add bonds you just need to pick on the 2 atoms you want to bind. If you drag select a bunch of atoms, the command will buildBondsByDistance between them.This command is undoable.
\nPackage : Pmv
\nModule : bondsCommands
\nClass : AddBondsGUICommand
\nCommand : addBondsGC
\nSynopsis:\n
None<-addBondsGC(atoms)\n
\nRequired Arguments:\n
atoms : atom(s)\n
"""
def __init__(self, func=None):
MVCommand.__init__(self, func)
MVAtomICOM.__init__(self)
self.atomList = AtomSet([])
self.undoAtList = AtomSet([])
self.labelStrs = []
def onRemoveObjectFromViewer(self, obj):
removeAts = AtomSet([])
for at in self.atomList:
if at in obj.allAtoms:
removeAts.append(at)
self.atomList = self.atomList - removeAts
removeAts = AtomSet([])
for at in self.undoAtList:
if at in obj.allAtoms:
removeAts.append(at)
self.undoAtList = self.undoAtList - removeAts
self.update()
def onAddCmdToViewer(self):
if not self.vf.commands.has_key('setICOM'):
self.vf.loadCommand('interactiveCommands', 'setICOM', 'Pmv',
topCommand=0)
if not self.vf.commands.has_key('addBonds'):
self.vf.loadCommand('bondsCommands', 'addBonds', 'Pmv',
topCommand=0)
if not self.vf.commands.has_key('removeBondsGC'):
self.vf.loadCommand('bondsCommands', 'removeBondsGC', 'Pmv',
topCommand=0)
self.masterGeom = Geom('addBondsGeom',shape=(0,0),
pickable=0, protected=True)
self.masterGeom.isScalable = 0
self.spheres = Spheres(name='addBondsSpheres', shape=(0,3),
inheritMaterial=0,
radii=0.2, quality=15,
materials = ((1.,1.,0.),), protected=True)
if not self.vf.commands.has_key('labelByExpression'):
self.vf.loadCommand('labelCommands',
['labelByExpression',], 'Pmv', topCommand=0)
if self.vf.hasGui:
miscGeom = self.vf.GUI.miscGeom
self.vf.GUI.VIEWER.AddObject(self.masterGeom, parent=miscGeom)
self.vf.GUI.VIEWER.AddObject(self.spheres, parent=self.masterGeom)
def __call__(self, atoms, **kw):
"""None<-addBondsGC(atoms)
\natoms : atom(s)"""
if type(atoms) is StringType:
self.nodeLogString = "'"+atoms+"'"
ats = self.vf.expandNodes(atoms)
if not len(ats): return 'ERROR'
return apply(self.doitWrapper, (ats,), kw)
def doit(self, ats):
if len(ats)>2:
if len(self.atomList):
atSet = ats + self.atomList
else: atSet = ats
parent = atSet[0].parent
parent.buildBondsByDistanceOnAtoms(atSet)
self.atomList = AtomSet([])
self.update(True)
else:
lenAts = len(self.atomList)
last = None
if lenAts:
last = self.atomList[-1]
top = self.atomList[0].top
for at in ats:
#check for repeats of same atom
if lenAts and at==last:
continue
#lenAts = len(self.atomList)
#if lenAts and at==self.atomList[-1]:
# continue
if lenAts and at.top!=self.atomList[-1].top:
msg = "intermolecular bond to %s disallowed"%(at.full_name())
self.warningMsg(msg)
self.atomList.append(at)
self.undoAtList.append(at)
lenAts = len(self.atomList)
self.update(True)
#.........這裏部分代碼省略.........