def startKarrigell(self,port,karrigell_start,karrigell_init): """ start the webserver Karrigell on the port specify in input return False for failure , True for sucess """ if hasattr(self,'cmd'): del(self.cmd) print "Trying to start Karrigell on port %d"%port self.cmd = SysCmdInThread("python -u %s -P %d %s "%(karrigell_start, port,karrigell_init), hasGui=False) self.cmd.start() status = self.checkKarrigellStatus() if not status: # print try to start on another port port = port + 1 if port > 8180: self.warningMsg("Could not start Karrigell server, no port available") return False,0 else: status,port =self.startKarrigell(port,karrigell_start,karrigell_init) return status,port
def guiCallback(self, event=None): fileList = [] fld_list = glob.glob('*.maps.fld') if not fld_list: tkMessageBox.showinfo( "AutoLigand Info", "AutoLigand requires input AutoGrid maps. \nPlease click OK to select directory containing grid maps." ) folder = tkFileDialog.askdirectory(title="Select A Folder") if folder: os.chdir(folder) fld_list = glob.glob('*.maps.fld') else: return for fld in fld_list: fileList.append(fld.split('.')[0]) entryfield_value = "" if fileList: fileList.sort() entryfield_value = fileList[0] ifd = InputFormDescr(title="Run AutoLigand") ifd.append({ 'name': "fileName", 'widgetType': Pmw.Group, 'container': { 'fileName': 'w.interior()' }, 'wcfg': { 'tag_text': "Base Name for Receptor Map Files" }, }) ifd.append({ 'widgetType': Pmw.ComboBox, 'name': 'FileBaseName', 'parent': 'fileName', 'tooltip': 'FileBaseName = Just the name part from map files (i.e., FileBaseName.C.map)', 'wcfg': { 'dropdown': 1, 'scrolledlist_items': fileList, 'entryfield_value': entryfield_value, 'selectioncommand': self.selectGrid, 'labelpos': 'w', } }) ifd.append({ 'name': "nGroup", 'widgetType': Pmw.Group, 'container': { 'nGroup': 'w.interior()' }, 'tooltip': 'Number of heavy atom for ligand or number of fill points to use.', 'wcfg': { 'tag_text': "Number of " }, }) ifd.append({ 'widgetType': Pmw.RadioSelect, 'parent': 'nGroup', 'name': 'type', 'defaultValue': 'Points', 'listtext': ["Heavy Atoms", "Points"], }) ifd.append({ 'widgetType': Pmw.EntryField, 'parent': 'nGroup', 'name': 'number', 'wcfg': { 'labelpos': 'w', 'value': '100', 'validate': { 'validator': 'integer' } } }) ifd.append({ 'widgetType': Pmw.NoteBook, 'name': 'autoligandNotebook', 'container': { 'Single Fill': "w.page('Single Fill')", 'Connected Fill': "w.page('Connected Fill')", 'Scan': "w.page('Scan')" }, 'componentcfg': [ { 'name': 'Single Fill', 'cfg': {} }, { 'name': 'Connected Fill', 'cfg': {} }, { 'name': 'Scan', 'cfg': {} }, # {'raisecommand':self.pageChanged} ], 'wcfg': { 'raisecommand': self.pageChanged }, 'gridcfg': { 'sticky': 'we' }, }) #Single Fill ifd.append({ 'name': "StartLoc", 'parent': 'Single Fill', 'widgetType': Pmw.Group, 'container': { 'StartLoc': 'w.interior()' }, 'wcfg': { 'tag_text': "Start Location" }, }) ifd.append({ 'widgetType': ExtendedSliderWidget, 'name': 'gridPointsX', 'parent': 'StartLoc', 'wcfg': { 'label': 'X: ', 'width': 190, 'immediate': 1, 'command': self.changeStartCross, 'entrypackcfg': { 'side': 'left' }, }, }) ifd.append({ 'widgetType': ExtendedSliderWidget, 'name': 'gridPointsY', 'parent': 'StartLoc', 'wcfg': { 'label': 'Y: ', 'width': 190, 'immediate': 1, 'command': self.changeStartCross, 'entrypackcfg': { 'side': 'left' }, }, }) ifd.append({ 'widgetType': ExtendedSliderWidget, 'name': 'gridPointsZ', 'parent': 'StartLoc', 'wcfg': { 'label': 'Z: ', 'width': 190, 'immediate': 1, 'command': self.changeStartCross, 'entrypackcfg': { 'side': 'left' }, }, }) ifd.append({ 'name': "output", 'widgetType': Pmw.Group, 'parent': 'Single Fill', 'container': { 'output': 'w.interior()' }, 'wcfg': { 'tag_text': "Output Options" }, }) ifd.append({ 'name': 'pdbFile', 'tooltip': """Creates PDB_fill_#Nout1.pdb file where #N is the number of fill points.""", 'parent': 'output', 'widgetType': Tkinter.Checkbutton, 'defaultValue': 1, 'wcfg': { 'text': 'Create PDB of the Final Fill', 'state': 'disabled', }, 'gridcfg': { 'sticky': 'w' } }) ifd.append({ 'name': 'showProgress', 'parent': 'output', 'tooltip': """Save intermediate results in a file and open flood player when AutoLigand finishes.""", 'widgetType': Tkinter.Checkbutton, 'defaultValue': 0, 'wcfg': { 'text': 'Save Intermediate Results for Movie', 'variable': Tkinter.IntVar(), }, 'gridcfg': { 'sticky': 'w' } }) #Connected Fill ifd.append({ 'widgetType': Tkinter.Label, 'name': 'label', 'parent': 'Connected Fill', 'wcfg': { 'text': 'Select End Location for Connected Fill' } }) ifd.append({ 'name': "EndLoc", 'parent': 'Connected Fill', 'widgetType': Pmw.Group, 'container': { 'EndLoc': 'w.interior()' }, 'wcfg': { 'tag_text': "End Location" }, }) ifd.append({ 'widgetType': ExtendedSliderWidget, 'name': 'gridPointsXEnd', 'parent': 'EndLoc', 'wcfg': { 'label': 'X: ', 'width': 190, 'immediate': 1, 'command': self.changeEndCross, 'entrypackcfg': { 'side': 'left' }, }, }) ifd.append({ 'widgetType': ExtendedSliderWidget, 'name': 'gridPointsYEnd', 'parent': 'EndLoc', 'wcfg': { 'label': 'Y: ', 'width': 190, 'immediate': 1, 'command': self.changeEndCross, 'entrypackcfg': { 'side': 'left' }, }, }) ifd.append({ 'widgetType': ExtendedSliderWidget, 'name': 'gridPointsZEnd', 'parent': 'EndLoc', 'wcfg': { 'label': 'Z: ', 'width': 190, 'immediate': 1, 'command': self.changeEndCross, 'entrypackcfg': { 'side': 'left' }, }, }) #Connected Fill # ifd.append({'widgetType':Tkinter.Label, # 'name':'label', # 'parent':'Scan', # 'wcfg':{'text':"""Results from the Scan mode will #be available under\n"""+os.getcwd()} # }) ifd.append({ 'widgetType': Pmw.EntryField, 'parent': 'Scan', 'name': 'nFills', 'wcfg': { 'label_text': "Number of Fills:", 'labelpos': 'w', 'value': '10', 'validate': { 'validator': 'integer' } } }) def initselect(arg): self.selectGrid(entryfield_value) self.ifd = ifd self.save = self.vf.ICmdCaller.commands.value["Shift_L"] self.vf.setICOM(self, modifier="Shift_L", topCommand=0) self.vf.setIcomLevel(Atom) self.endCross.Set(visible=0) val = self.vf.getUserInput(ifd, modal=0, blocking=1, initFunc=initselect) if self.save: self.vf.setICOM(self.save, modifier="Shift_L", topCommand=0) self.save = None # import pdb;pdb.set_trace() if val: if not val['FileBaseName'][0]: msg = "AutoGrid files are missing.\n" msg += "Please generate grid maps. AutoLigand requires input AutoGrid maps." tkMessageBox.showerror("Error!", msg) return selection = self.ifd.entryByName['autoligandNotebook'][ 'widget'].getcurselection() cmdString = [sys.executable, AutoLigandPath] cmdString.append('-r') cmdString.append(val['FileBaseName'][0]) self.fileBaseName = val['FileBaseName'][0] if val['type'] == 'Points': cmdString.append('-p') cmdString.append(str(val['number'])) else: cmdString.append('-a') cmdString.append(str(val['number'])) val['number'] = 6 * int(val['number']) if selection in ['Single Fill', 'Connected Fill']: cmdString.append('-x') cmdString.append(str(val['gridPointsX'])) cmdString.append('-y') cmdString.append(str(val['gridPointsY'])) cmdString.append('-z') cmdString.append(str(val['gridPointsZ'])) if selection == 'Connected Fill': cmdString.append('-i') cmdString.append(str(val['gridPointsXEnd'])) cmdString.append('-j') cmdString.append(str(val['gridPointsYEnd'])) cmdString.append('-k') cmdString.append(str(val['gridPointsZEnd'])) if os.name == 'nt': #sys.platform == "win32": self.cmdTxt = subprocess.list2cmdline(cmdString) else: self.cmdTxt = ' '.join(cmdString) if val['showProgress']: self.cmdTxt += " -m" self.showPlayer = True else: self.showPlayer = False self.cmd = SysCmdInThread(self.cmdTxt, shell=True) self.cmd.start() self.checkResults() self.N_of_pts = val['number'] elif selection == "Scan": cmdString.append('-f') cmdString.append(str(val['nFills'])) if os.name == 'nt': #sys.platform == "win32": self.cmdTxt = subprocess.list2cmdline(cmdString) else: self.cmdTxt = ' '.join(cmdString) self.cmdTxt += ' &' #run in a background subprocess.Popen(self.cmdTxt, shell=True) tkMessageBox.showinfo("Success!", """AutoLigand launched successfully.""") else: self.hideGeoms()