t1 = numpy.identity(4) t1[:3,3] = initialConf negt1 = numpy.identity(4) for i in range(len(initialConf)): negt1[i,3] = initialConf[i] * -1 t2 = numpy.identity(4) t2[:3,3] = [tx, ty, tz] rot = numpy.identity(4) r = numpy.array(rotations[ri]) r.shape = (3,3) rot[0:3,0:3] = r self.mat = numpy.dot(t2, numpy.dot(t1, numpy.dot(rot,negt1))) geom = molecule.geomContainer.geoms['master'] geom.SetTransformation(self.mat, transpose=True) self.outputData(score=score, RMSD=rmsd) """ self.setFunction(code) from Vision.VPE import NodeLibrary F2Docklib = NodeLibrary('F2Dock', '#663366') F2Docklib.addNode(RotationFile, 'RotFile', 'Rotations') F2Docklib.addNode(ReadLog, 'ReadLog', 'Input') F2Docklib.addNode(BrowseLog, 'BrowseLog', 'Mapper')
def createLib_cb(self, event=None): classname = self.libclassnametkvar.get() if classname is None or len(classname)==0: return name = self.libnametkvar.get() if name is None or len(name)==0: return libfilename = self.libfiletkvar.get() if libfilename is None or len(libfilename) == 0: return if libfilename[-3:] != ".py": libfilename = libfilename + ".py" directory = self.libsGUI.get() if directory is None or len(directory)==0 or directory==(): return # libsGUI might return the data packed in a tuple if type(directory) == types.TupleType: directory = directory[0] # build path by joining the directory with the parent path path = os.path.join(self.editor.userLibsDirs[directory], directory) # then add the file name file = os.path.join(path, libfilename) if os.path.exists(file): from Dialog import Dialog d = Dialog(None, {'title': 'File exisits', 'text': 'File "%s" already exists.' ' Do you want to overwrite it ?'%file, 'bitmap': 'warning', 'default': 1, 'strings': ('Yes', 'No')}) if d.num==1: # 'No' return from Vision.VPE import NodeLibrary col = self.colorButton.cget('bg') newlib = NodeLibrary(name, col, mode='readWrite') newlib.varName = classname # write the library header f = open(file, 'w') map( f.write, newlib.getHeader()) f.write("%s = NodeLibrary('%s', '%s', mode='readWrite')\n"%( newlib.varName, name, col)) f.close() # load the library from the file using same mechanism as saved network from mglutil.util.packageFilePath import getObjectFromFile newlib = getObjectFromFile( file, classname) newlib.varName = classname modName = directory + "." + libfilename[:-3] modName = string.replace(modName, "/", ".") newlib.modName = modName # we need to __import__ to add this module to sys.modules # This fixes a problem when trying to add nodes to this new lib before # we restart and load the new library through 'loadLibrary' __import__(modName) self.editor.libraries[ newlib.name] = newlib self.editor.showLibrary(newlib) self.hide()
self.inputPortsDescr.append(datatype=None, name='data') self.inputPortsDescr.append(datatype=None, name='mec') self.outputPortsDescr.append(datatype=None, name='data') code = """def doit(self, function, data, mec): assert callable(function) result = mec.map(function, data) self.outputData(data=result) """ self.setFunction(code) from Vision.VPE import NodeLibrary iplib = NodeLibrary('IPython', 'grey75') iplib.addNode(IPmec, 'MEC', 'Objects') iplib.addNode(IPLocalMEC2, 'MEC2local', 'Objects') iplib.addNode(IPLocalMEC3, 'MEC3local', 'Objects') iplib.addNode(IPLocalMEC4, 'MEC4local', 'Objects') iplib.addNode(IPLocalMEC5, 'MEC5local', 'Objects') iplib.addNode(IPLocalMEC6, 'MEC6local', 'Objects') iplib.addNode(IPLocalMEC7, 'MEC7local', 'Objects') iplib.addNode(IPLocalMEC8, 'MEC8local', 'Objects') iplib.addNode(IPPull, 'Pull', 'Communication') iplib.addNode(IPPush, 'Push', 'Communication') #iplib.addNode(IPPushFunction, 'Push Func', 'Communication') iplib.addNode(IPScatter, 'Scatter', 'Communication') iplib.addNode(IPGather, 'Gather', 'Communication') iplib.addNode(IPmap, 'PMap', 'Mapper')
def createLib_cb(self, event=None): classname = self.libclassnametkvar.get() if classname is None or len(classname) == 0: return name = self.libnametkvar.get() if name is None or len(name) == 0: return libfilename = self.libfiletkvar.get() if libfilename is None or len(libfilename) == 0: return if libfilename[-3:] != ".py": libfilename = libfilename + ".py" directory = self.libsGUI.get() if directory is None or len(directory) == 0 or directory == (): return # libsGUI might return the data packed in a tuple if type(directory) == types.TupleType: directory = directory[0] # build path by joining the directory with the parent path path = os.path.join(self.editor.userLibsDirs[directory], directory) # then add the file name file = os.path.join(path, libfilename) if os.path.exists(file): from Dialog import Dialog d = Dialog( None, { 'title': 'File exisits', 'text': 'File "%s" already exists.' ' Do you want to overwrite it ?' % file, 'bitmap': 'warning', 'default': 1, 'strings': ('Yes', 'No') }) if d.num == 1: # 'No' return from Vision.VPE import NodeLibrary col = self.colorButton.cget('bg') newlib = NodeLibrary(name, col, mode='readWrite') newlib.varName = classname # write the library header f = open(file, 'w') map(f.write, newlib.getHeader()) f.write("%s = NodeLibrary('%s', '%s', mode='readWrite')\n" % (newlib.varName, name, col)) f.close() # load the library from the file using same mechanism as saved network from mglutil.util.packageFilePath import getObjectFromFile newlib = getObjectFromFile(file, classname) newlib.varName = classname modName = directory + "." + libfilename[:-3] modName = string.replace(modName, "/", ".") newlib.modName = modName # we need to __import__ to add this module to sys.modules # This fixes a problem when trying to add nodes to this new lib before # we restart and load the new library through 'loadLibrary' __import__(modName) self.editor.libraries[newlib.name] = newlib self.editor.showLibrary(newlib) self.hide()
'labelCfg': { 'text': 'URL' }, } self.inputPortsDescr.append({'name': 'url', 'datatype': 'string'}) code = """def doit(self, url): url = self.getInputPortByName('url').data webbrowser.open(url) """ if code: self.setFunction(code) from Vision.VPE import NodeLibrary wslib = NodeLibrary('Web Services', '#d7fdf9') wslib.addNode(GetWSNode, 'Load WS', 'Generic') wslib.addNode(DownloadNode, 'Download', 'Generic') wslib.addNode(DownloadSaveDirNode, 'DownloadSaveDir', 'Generic') wslib.addNode(DownloadToFileNode, 'DownloadToFile', 'Generic') wslib.addNode(GetMainURLNode, 'GetMainURL', 'Generic') wslib.addNode(GetMainURLFromListNode, 'GetMainURLFromList', 'Generic') wslib.addNode(GetURLFromListNode, 'GetURLFromList', 'Generic') wslib.addNode(IsURLNode, 'IsURL', 'Generic') wslib.addNode(ReplaceURLNode, 'ReplaceURL', 'Generic') wslib.addNode(WebBrowserNode, 'WebBrowser', 'Generic') #addOpalServerAsCategory('http://ws.nbcr.net/opal2') #addOpalServerAsCategory('http://krusty.ucsd.edu:8081/opal2') #addOpalServerAsCategory('http://kryptonite.ucsd.edu/opal2') try:
else: obj = Pmv.Mols.get(molecule) if obj: self.outputData(molecule=obj) """ self.setFunction(code) def beforeAddingToNetwork(self, net): # loading library molkitlib importMolKitLib(net) from Vision.VPE import NodeLibrary pmvlib = NodeLibrary('Pmv', '#7A7AFF') pmvlib.addNode(PmvChooseCommand, 'Choose Cmd', 'Filter',) pmvlib.addNode(PmvSetCPKRadii, 'Set CPK radii', 'Mapper',) pmvlib.addNode(PmvSetInstanceMatrices, 'Set Instances', 'Mapper',) pmvlib.addNode(PmvRunCommand, 'Run Command', 'Output',) pmvlib.addNode(PmvGetSelection, 'Get Selection', 'Input',) pmvlib.addNode(PmvMoleculeChooser, 'Choose Molecule', 'Input',) if msmsFound==1: pmvlib.addNode(GetMSMSGeom, 'Get MSMS Geom', 'Filter')
#AD4FlexibleDockingPreparation #prepare_ligand_dict #ReceptorWriter #AD4ReceptorWriter #LigandPreparation #AD4LigandPreparation #AutoDock3_AtomTyper #DockingParameters #DockingParameterFileMaker #GridParameters #GridParameterFileMaker #??Docking?? from Vision.VPE import NodeLibrary adtlib = NodeLibrary('adtlib', '#4444FF') #macros from other files in this directory #from AutoDockTools.VisionInterface.PrepareAD4Molecule import PrepareAD4Molecule #adtlib.addNode(PrepareAD4Molecule, 'Prepare AD4Molecule', 'Macro') #from AutoDockTools.VisionInterface.AD4Ligands import AD4Ligands #adtlib.addNode(AD4Ligands, 'Prepare AD4 Ligands', 'Macro') #from AutoDockTools.VisionInterface.Prepare_AD4_Ligands import Prepare_AD4_Ligands #adtlib.addNode(Prepare_AD4_Ligands, 'Prepare AD4 Ligands', 'Macro') ###from AutoDockTools.VisionInterface.PrepareAD3Ligand import PrepareAD3Ligand ###adtlib.addNode(PrepareAD3Ligand, 'Prepare AD3 Ligand', 'Macro') ###from AutoDockTools.VisionInterface.PrepareAD3Receptor import PrepareAD3Receptor ###adtlib.addNode(PrepareAD3Receptor, 'Prepare AD3Receptor', 'Macro') ###from AutoDockTools.VisionInterface.AD3Gpf import AD3Gpf ###adtlib.addNode(AD3Gpf, 'Prepare AD3 Gpf ', 'Macro') ###from AutoDockTools.VisionInterface.AD3Dpf import AD3Dpf
# this method is defined outside this node buildCGIWidget(node, form) self.editor.currentNetwork.addNode(node, posX, posY) #node.addOutputPort(name='html', datatype='list') node.CGIFormObj = form node.CGIFormObj.setURL(url) self.outputData(forms=forms)\n""" self.setFunction(code) from Vision.VPE import NodeLibrary weblib = NodeLibrary('Web', '#bb4040') weblib.addNode(ConsurfClientNode, 'Consurf', 'Filter') #weblib.addNode(WebBrowser, 'Web Browser', 'Output') # not supported any longr weblib.addNode(GetCGIForms, 'Get CGI Forms', 'Filter') #weblib.addNode(CGIFormNode, 'CGI Form Node', 'Output') if __name__ == '__main__': print 'Creating client Object' server = ConsurfServer() print 'submitting job' server.setArguments(pdb_ID='2plv', chain='1', ALGORITHM="Likelihood") result = server.run() print 'get temporary result page' resultPage = server.getResultPage(result) print ' wait for completion'
from os import sep, path from Vision.VPE import NodeLibrary from Vision.UserLibBuild import userLibBuild, addDirToSysPath, addTypes dependents = { } # {'scipy':'0.6.0',} the numbers indicate the highest tested version of the needed packages libraryColor = '#4444FF' addDirToSysPath(path.dirname(__file__) + sep + '..') fileSplit = __file__.split(sep) if fileSplit[-1] == '__init__.pyc' or fileSplit[-1] == '__init__.py': libInstanceName = fileSplit[-2] else: libInstanceName = path.splitext(fileSplit[-1])[0] try: from Vision import ed except: ed = None if ed is not None and ed.libraries.has_key(libInstanceName): locals()[libInstanceName] = ed.libraries[libInstanceName] else: locals()[libInstanceName] = NodeLibrary(libInstanceName, libraryColor, mode='readWrite') success = userLibBuild(eval(libInstanceName), __file__, dependents=dependents) if success is False: locals().pop(libInstanceName) elif path.isfile(path.dirname(__file__) + sep + 'libTypes.py'): addTypes(locals()[libInstanceName], libInstanceName + '.libTypes')
# this method is defined outside this node buildCGIWidget(node, form) self.editor.currentNetwork.addNode(node, posX, posY) #node.addOutputPort(name='html', datatype='list') node.CGIFormObj = form node.CGIFormObj.setURL(url) self.outputData(forms=forms)\n""" self.setFunction(code) from Vision.VPE import NodeLibrary weblib = NodeLibrary('Web', '#bb4040') weblib.addNode(ConsurfClientNode, 'Consurf', 'Filter') #weblib.addNode(WebBrowser, 'Web Browser', 'Output') # not supported any longr weblib.addNode(GetCGIForms, 'Get CGI Forms', 'Filter') #weblib.addNode(CGIFormNode, 'CGI Form Node', 'Output') if __name__ == '__main__': print 'Creating client Object' server = ConsurfServer() print 'submitting job' server.setArguments( pdb_ID='2plv', chain='1', ALGORITHM="Likelihood") result = server.run() print 'get temporary result page' resultPage = server.getResultPage(result)
}, 'master': 'node', 'widgetGridCfg': { 'labelSide': 'left' }, #, 'column': 1, 'row': 1}, 'labelCfg': { 'text': 'MPEG player pgm' }, 'class': 'NEEntryWithFileBrowser' } except ImportError: print 'Failed to import pymedia.video.vcodec' from Vision.VPE import NodeLibrary imagelib = NodeLibrary('Imaging', '#995699') imagelib.addNode(ImageFromArray, 'Image from array', 'Input') imagelib.addNode(ReadImage, 'Read Image', 'Input') imagelib.addNode(GetFrontBuffer, 'Grab Image', 'Input') #imagelib.addNode(GetZBuffer, 'RecordMPEGmovie', 'Input') imagelib.addNode(ShowImage, 'Show Image', 'Output') imagelib.addNode(ImageStat, 'Image Stat', 'Output') imagelib.addNode(SaveImage, 'Save Image', 'Output') try: import pymedia.video.vcodec as vcodec imagelib.addNode(RecordMPEGmovie, 'Record MPEG movie', 'Output') imagelib.addNode(PlayMPEG, 'Play MPEG', 'Output') except ImportError:
apply( NetworkNode.__init__, (self,), kw ) self.widgetDescr['url'] = {'class':'NEEntry', 'master':'node', 'labelCfg':{'text':'URL'}, } self.inputPortsDescr.append( {'name':'url', 'datatype':'string'} ) code = """def doit(self, url): url = self.getInputPortByName('url').data webbrowser.open(url) """ if code: self.setFunction(code) from Vision.VPE import NodeLibrary wslib = NodeLibrary('Web Services', '#d7fdf9') wslib.addNode(GetWSNode, 'Load WS', 'Generic') wslib.addNode(DownloadNode, 'Download', 'Generic') wslib.addNode(DownloadSaveDirNode, 'DownloadSaveDir', 'Generic') wslib.addNode(DownloadToFileNode, 'DownloadToFile', 'Generic') wslib.addNode(GetMainURLNode, 'GetMainURL', 'Generic') wslib.addNode(GetMainURLFromListNode, 'GetMainURLFromList', 'Generic') wslib.addNode(GetURLFromListNode, 'GetURLFromList', 'Generic') wslib.addNode(IsURLNode, 'IsURL', 'Generic') wslib.addNode(ReplaceURLNode, 'ReplaceURL', 'Generic') wslib.addNode(WebBrowserNode, 'WebBrowser', 'Generic') #addOpalServerAsCategory('http://ws.nbcr.net/opal2') #addOpalServerAsCategory('http://krusty.ucsd.edu:8081/opal2') #addOpalServerAsCategory('http://kryptonite.ucsd.edu/opal2') try:
c[p] = col i = i + 1 self.outputData(out1=c)\n""" if code: self.setFunction(code) self.inputPortsDescr.append({'name': 'in1', 'datatype': 'None'}) self.outputPortsDescr.append({'name': 'out1', 'datatype': 'None'}) class DefaultIndices(NetworkNode): def __init__(self, name='default indices', **kw): apply(NetworkNode.__init__, (self, ), kw) code = """def doit(self, in1): self.outputData(out1=[range(in1[0])])\n""" if code: self.setFunction(code) self.inputPortsDescr.append({'name': 'length', 'datatype': 'int'}) self.outputPortsDescr.append({'name': 'out1', 'datatype': 'None'}) from Vision.VPE import NodeLibrary flexlib = NodeLibrary('Flex', '#AA66AA') flexlib.addNode(DistanceMatrix, 'DM', 'Input') flexlib.addNode(DDM, 'DDM', 'Input') flexlib.addNode(Cluster, 'Cluster', 'Input') flexlib.addNode(ColorCluster, 'Color Cluster', 'Input') flexlib.addNode(DefaultIndices, 'indices', 'Input')
self.outputData(molecule=None) else: obj = Pmv.Mols.get(molecule) if obj: self.outputData(molecule=obj) """ self.setFunction(code) def beforeAddingToNetwork(self, net): # loading library molkitlib importMolKitLib(net) from Vision.VPE import NodeLibrary pmvlib = NodeLibrary('Pmv', '#7A7AFF') pmvlib.addNode( PmvChooseCommand, 'Choose Cmd', 'Filter', ) pmvlib.addNode( PmvSetCPKRadii, 'Set CPK radii', 'Mapper', ) pmvlib.addNode( PmvSetInstanceMatrices, 'Set Instances',