コード例 #1
0
    def updateView(self):
	# Change the PyMOL view to only show the current model and optionally the base model that is
	# always shown, if one is indicated by the modelMenu
	# This is accomplished by making everything outside of the view transparent
	# Why did I use transparency? -> because "hiding" views causes PyMOL to lose the display 
	# information (i.e. it will forget if you had lines/sticks/spheres shown)
	# You don't lose this information by fiddling with transparencies
	if (len(self.selectedModels) == 0):
	    return
	model = self.selectedModels[self.currentModel]
	self.lblSelected.SetLabel(model)
	if (platform.system() == "Linux"):
	    resizeTextControlForUNIX(self.lblSelected, 35, 250)
	# The selection "seqsele" refers to what the user has indicated should be in the ensemble browsing
	# If it's not in "seqsele", then it will never be shown by the browser
	# First make everything transparent and turn off cartoons (the user will have to deal with the
	# cartoon settings changing)
	self.cmd.hide("cartoon", "all")
	self.cmd.set_bond("stick_transparency", 1, "all")
	self.cmd.set("sphere_transparency", 1, "all") # Use "set" for sphere_transparency
	# Now define a selection for the intersection of the current model atoms and "sele"
	self.cmd.select("ensemblesele", "seqsele and model " + model)
	self.cmd.show("cartoon", "ensemblesele")
	self.cmd.set_bond("stick_transparency", 0, "ensemblesele")
	self.cmd.set("sphere_transparency", 0, "ensemblesele") # Use "set" for sphere_transparency
	# Now show the "always show" model if one if selected and it's not the current model
	alwaysshow = self.modelMenu.GetStringSelection()
	logInfo("Browser view changed to show " + model + " with Always Show set to " + alwaysshow)
	if (alwaysshow != "None" and alwaysshow != "" and alwaysshow != model):
	    self.cmd.select("ensemblesele", "seqsele and model " + alwaysshow)
	    self.cmd.show("cartoon", "ensemblesele")
	    self.cmd.set_bond("stick_transparency", 0.7, "ensemblesele") # So you know which one is the "always shown" one
	    self.cmd.set("sphere_transparency", 0, "ensemblesele") # Use "set" for sphere_transparency
	self.cmd.delete("ensemblesele") # Clean up
	self.cmd.enable("seqsele") # This is needed otherwise the sequence window removes the selection since it is not enabled
コード例 #2
0
    def rightClick(self, event):
	self.currentModel = self.currentModel + 1
	if (self.currentModel >= len(self.selectedModels)):
	    self.currentModel = len(self.selectedModels) - 1
	self.updateView()
	logInfo("Right button clicked")
コード例 #3
0
    def leftClick(self, event):
	self.currentModel = self.currentModel - 1
	if (self.currentModel < 0):
	    self.currentModel = 0
	self.updateView()
	logInfo("Left button clicked")
コード例 #4
0
    def changeProtocol(self, event):
	logInfo("Go button clicked")
	selectedProtocol = self.protMenu.GetStringSelection()
	if (selectedProtocol != self.currentProtocol and selectedProtocol != ""):
	    # Destroy the old panel so we can free memory up and create the new protocol panel
	    if (self.currentProtocol == "Superimposition"):
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Energy Minimization"):
		# Check to see if the user has accepted the minimization
		# If not, ask if they really want to proceed
		if (self.protPanel.buttonState == "Finalize!"):
		    dlg = wx.MessageDialog(self, "You have not accepted your minimization and the results will be lost if you proceed.  Proceed anyway?", "Minimization Not Accepted", wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
		    if (dlg.ShowModal() == wx.ID_NO):
			logInfo("Go cancelled due to unaccepted minimization")
			dlg.Destroy()
			return
		    dlg.Destroy()
		    logInfo("Minimization job rejected")
		# Try to delete the minimized model if the user doesn't want to accept it
		try:
		    self.cmd.remove("minimized_view")
		    self.cmd.delete("minimized_view")
		except:
		    pass
		self.cmd.label("all", "")
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Ensemble Browser"):
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Ensemble Generation"):
		# Check to see if the user has accepted the design
		# If not, ask if they really want to proceed
		if (self.protPanel.buttonState == "Cancel!"):
		    dlg = wx.MessageDialog(self, "Your ensemble is not finished and the results will be lost if you proceed.  Proceed anyway?", "Design Not Accepted", wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
		    if (dlg.ShowModal() == wx.ID_NO):
			logInfo("Go cancelled due to unfinished ensemblegen job")
			dlg.Destroy()
			return
		    logInfo("Ensemblegen job rejected")
		    dlg.Destroy()
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Protein Design (Fixbb)"):
		# Check to see if the user has accepted the design
		# If not, ask if they really want to proceed
		if (self.protPanel.buttonState == "Finalize!"):
		    dlg = wx.MessageDialog(self, "You have not accepted your design and the results will be lost if you proceed.  Proceed anyway?", "Design Not Accepted", wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
		    if (dlg.ShowModal() == wx.ID_NO):
			logInfo("Go cancelled due to unaccepted fixbb job")
			dlg.Destroy()
			return
		    logInfo("Fixbb job rejected")
		    dlg.Destroy()
		# Try to delete the design model if the user doesn't want to accept it
		try:
		    self.cmd.remove("designed_view")
		    self.cmd.delete("designed_view")
		except:
		    pass
		self.cmd.label("all", "")
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Residue/Ligand Creator"):
		try:
		    self.cmd.remove("params")
		    self.cmd.delete("params")
		except:
		    pass
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Point Mutations"):
		try:
		    self.cmd.remove("rotamer_view")
		    self.cmd.delete("rotamer_view")
		except:
		    pass
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Point Mutant Scan"):
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Loop Modeling (KIC)"):
		# Check to see if the user has accepted the loop model
		# If not, ask if they really want to proceed
		if (self.protPanel.buttonState == "Finalize!"):
		    dlg = wx.MessageDialog(self, "You have not accepted your loop model and the results will be lost if you proceed.  Proceed anyway?", "KIC Not Accepted", wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
		    if (dlg.ShowModal() == wx.ID_NO):
			logInfo("Go cancelled due to unaccepted KIC job")
			dlg.Destroy()
			return
		    logInfo("KIC job rejected")
		    dlg.Destroy()
		# Try to delete the design model if the user doesn't want to accept it
		try:
		    self.cmd.remove("kic_view")
		    self.cmd.delete("kic_view")
		except:
		    pass
		self.cmd.label("all", "")
		self.protPanel.Destroy()
	    elif (self.currentProtocol == "Docking"):
		# Check to see if the user has accepted the docking model
		# If not, ask if they really want to proceed
		if (self.protPanel.buttonState != "Dock!"):
		    dlg = wx.MessageDialog(self, "You have not accepted your docking model and the results will be lost if you proceed.  Proceed anyway?", "Docking Not Accepted", wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
		    if (dlg.ShowModal() == wx.ID_NO):
			logInfo("Go cancelled due to unaccepted docking job")
			dlg.Destroy()
			return
		    logInfo("Docking job rejected")
		    dlg.Destroy()
		# Try to delete the design model if the user doesn't want to accept it
		try:
		    self.cmd.remove("dock_view")
		    self.cmd.delete("dock_view")
		except:
		    pass
		self.cmd.label("all", "")
		self.protPanel.Destroy()
	    elif (self.currentProtocol == "Structure Prediction (Comparative Modeling)"):
		# Check to see if the user has accepted the docking model
		# If not, ask if they really want to proceed
		if (self.protPanel.buttonState == "Finalize!"):
		    dlg = wx.MessageDialog(self, "You have not accepted your comparative modeling structure and the results will be lost if you proceed.  Proceed anyway?", "Docking Not Accepted", wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
		    if (dlg.ShowModal() == wx.ID_NO):
			logInfo("Go cancelled due to unaccepted comparative modeling job")
			dlg.Destroy()
			return
		    logInfo("Comparative modeling job rejected")
		    dlg.Destroy()
		# Try to delete the design model if the user doesn't want to accept it
		try:
		    self.cmd.remove("thread_view")
		    self.cmd.delete("thread_view")
		except:
		    pass
		self.cmd.label("all", "")
		self.protPanel.Destroy()
	    elif (self.currentProtocol == "Protein Design (MSD)"):
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Antibody Modeling"):
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Molecular Surfaces"):
		try:
		    self.cmd.delete("curr_surf_recp")
		except:
		    pass
		try:
		    self.cmd.delete("curr_surf_lig")
		except:
		    pass
		self.cmd.hide("surface", "all")
		if (self.parent.Selection.showSurf):
		    self.currentProtocol = "n/a"
		    self.parent.Selection.displaySurfaces()
		self.protPanel.Destroy()
		del self.protPanel
	    elif (self.currentProtocol == "Flexible Peptide Docking"):
		self.protPanel.Destroy()
		del self.protPanel
	    self.currentProtocol = selectedProtocol
	    self.seqWin.cannotDelete = False
	    # Restart the Rosetta daemon to clear its memory up
	    self.parent.restartDaemon()
	    logInfo("Changed protocol to " + selectedProtocol)
	    if (selectedProtocol == "Superimposition"):
		self.protPanel = SuperimpositionPanel(self, self.W, self.H)
	    elif (selectedProtocol == "Energy Minimization"):
		self.protPanel = MinimizationPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Ensemble Browser"):
		self.protPanel = EnsembleBrowserPanel(self, self.W, self.H)
	    elif (selectedProtocol == "Ensemble Generation"):
		self.protPanel = EnsembleGenPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Protein Design (Fixbb)"):
		self.protPanel = FixbbPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Residue/Ligand Creator"):
		self.protPanel = ResidueCreatorPanel(self, self.W, self.H)
	    elif (selectedProtocol == "Point Mutations"):
		self.protPanel = PointMutationsPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Point Mutant Scan"):
		self.protPanel = PointMutantScanPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Loop Modeling (KIC)"):
		self.protPanel = KICPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Docking"):
		self.protPanel = DockingPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Structure Prediction (Comparative Modeling)"):
		self.protPanel = CompModelPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Protein Design (MSD)"):
		self.protPanel = MSDPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    elif (selectedProtocol == "Antibody Modeling"):
		self.protPanel = AntibodyPanel(self, self.W, self.H)
	    elif (selectedProtocol == "Molecular Surfaces"):
		self.protPanel = SurfacesPanel(self, self.W, self.H)
		self.cmd.hide("surface", "all")
	    elif (selectedProtocol == "Flexible Peptide Docking"):
		self.protPanel = FlexPepDockPanel(self, self.W, self.H)
		self.protPanel.setSelectWin(self.selectWin)
	    self.protPanel.setSeqWin(self.seqWin)
	    self.protPanel.setPyMOL(self.pymol)
	    self.protPanel.activate()
	    self.seqWin.setProtocolPanel(self.protPanel)
コード例 #5
0
 def changeProtocol(self, event):
     logInfo("Go button clicked")
     selectedProtocol = self.protMenu.GetStringSelection()
     if (selectedProtocol != self.currentProtocol
             and selectedProtocol != ""):
         # Destroy the old panel so we can free memory up and create the new protocol panel
         if (self.currentProtocol == "Superimposition"):
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Energy Minimization"):
             # Check to see if the user has accepted the minimization
             # If not, ask if they really want to proceed
             if (self.protPanel.buttonState == "Finalize!"):
                 dlg = wx.MessageDialog(
                     self,
                     "You have not accepted your minimization and the results will be lost if you proceed.  Proceed anyway?",
                     "Minimization Not Accepted",
                     wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
                 if (dlg.ShowModal() == wx.ID_NO):
                     logInfo("Go cancelled due to unaccepted minimization")
                     dlg.Destroy()
                     return
                 dlg.Destroy()
                 logInfo("Minimization job rejected")
             # Try to delete the minimized model if the user doesn't want to accept it
             try:
                 self.cmd.remove("minimized_view")
                 self.cmd.delete("minimized_view")
             except:
                 pass
             self.cmd.label("all", "")
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Ensemble Browser"):
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Ensemble Generation"):
             # Check to see if the user has accepted the design
             # If not, ask if they really want to proceed
             if (self.protPanel.buttonState == "Cancel!"):
                 dlg = wx.MessageDialog(
                     self,
                     "Your ensemble is not finished and the results will be lost if you proceed.  Proceed anyway?",
                     "Design Not Accepted",
                     wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
                 if (dlg.ShowModal() == wx.ID_NO):
                     logInfo(
                         "Go cancelled due to unfinished ensemblegen job")
                     dlg.Destroy()
                     return
                 logInfo("Ensemblegen job rejected")
                 dlg.Destroy()
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Protein Design (Fixbb)"):
             # Check to see if the user has accepted the design
             # If not, ask if they really want to proceed
             if (self.protPanel.buttonState == "Finalize!"):
                 dlg = wx.MessageDialog(
                     self,
                     "You have not accepted your design and the results will be lost if you proceed.  Proceed anyway?",
                     "Design Not Accepted",
                     wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
                 if (dlg.ShowModal() == wx.ID_NO):
                     logInfo("Go cancelled due to unaccepted fixbb job")
                     dlg.Destroy()
                     return
                 logInfo("Fixbb job rejected")
                 dlg.Destroy()
             # Try to delete the design model if the user doesn't want to accept it
             try:
                 self.cmd.remove("designed_view")
                 self.cmd.delete("designed_view")
             except:
                 pass
             self.cmd.label("all", "")
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Residue/Ligand Creator"):
             try:
                 self.cmd.remove("params")
                 self.cmd.delete("params")
             except:
                 pass
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Point Mutations"):
             try:
                 self.cmd.remove("rotamer_view")
                 self.cmd.delete("rotamer_view")
             except:
                 pass
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Point Mutant Scan"):
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Loop Modeling (KIC)"):
             # Check to see if the user has accepted the loop model
             # If not, ask if they really want to proceed
             if (self.protPanel.buttonState == "Finalize!"):
                 dlg = wx.MessageDialog(
                     self,
                     "You have not accepted your loop model and the results will be lost if you proceed.  Proceed anyway?",
                     "KIC Not Accepted",
                     wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
                 if (dlg.ShowModal() == wx.ID_NO):
                     logInfo("Go cancelled due to unaccepted KIC job")
                     dlg.Destroy()
                     return
                 logInfo("KIC job rejected")
                 dlg.Destroy()
             # Try to delete the design model if the user doesn't want to accept it
             try:
                 self.cmd.remove("kic_view")
                 self.cmd.delete("kic_view")
             except:
                 pass
             self.cmd.label("all", "")
             self.protPanel.Destroy()
         elif (self.currentProtocol == "Docking"):
             # Check to see if the user has accepted the docking model
             # If not, ask if they really want to proceed
             if (self.protPanel.buttonState != "Dock!"):
                 dlg = wx.MessageDialog(
                     self,
                     "You have not accepted your docking model and the results will be lost if you proceed.  Proceed anyway?",
                     "Docking Not Accepted",
                     wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
                 if (dlg.ShowModal() == wx.ID_NO):
                     logInfo("Go cancelled due to unaccepted docking job")
                     dlg.Destroy()
                     return
                 logInfo("Docking job rejected")
                 dlg.Destroy()
             # Try to delete the design model if the user doesn't want to accept it
             try:
                 self.cmd.remove("dock_view")
                 self.cmd.delete("dock_view")
             except:
                 pass
             self.cmd.label("all", "")
             self.protPanel.Destroy()
         elif (self.currentProtocol ==
               "Structure Prediction (Comparative Modeling)"):
             # Check to see if the user has accepted the docking model
             # If not, ask if they really want to proceed
             if (self.protPanel.buttonState == "Finalize!"):
                 dlg = wx.MessageDialog(
                     self,
                     "You have not accepted your comparative modeling structure and the results will be lost if you proceed.  Proceed anyway?",
                     "Docking Not Accepted",
                     wx.YES_NO | wx.ICON_EXCLAMATION | wx.CENTRE)
                 if (dlg.ShowModal() == wx.ID_NO):
                     logInfo(
                         "Go cancelled due to unaccepted comparative modeling job"
                     )
                     dlg.Destroy()
                     return
                 logInfo("Comparative modeling job rejected")
                 dlg.Destroy()
             # Try to delete the design model if the user doesn't want to accept it
             try:
                 self.cmd.remove("thread_view")
                 self.cmd.delete("thread_view")
             except:
                 pass
             self.cmd.label("all", "")
             self.protPanel.Destroy()
         elif (self.currentProtocol == "Protein Design (MSD)"):
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Antibody Modeling"):
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Molecular Surfaces"):
             try:
                 self.cmd.delete("curr_surf_recp")
             except:
                 pass
             try:
                 self.cmd.delete("curr_surf_lig")
             except:
                 pass
             self.cmd.hide("surface", "all")
             if (self.parent.Selection.showSurf):
                 self.currentProtocol = "n/a"
                 self.parent.Selection.displaySurfaces()
             self.protPanel.Destroy()
             del self.protPanel
         elif (self.currentProtocol == "Flexible Peptide Docking"):
             self.protPanel.Destroy()
             del self.protPanel
         self.currentProtocol = selectedProtocol
         self.seqWin.cannotDelete = False
         # Restart the Rosetta daemon to clear its memory up
         self.parent.restartDaemon()
         logInfo("Changed protocol to " + selectedProtocol)
         if (selectedProtocol == "Superimposition"):
             self.protPanel = SuperimpositionPanel(self, self.W, self.H)
         elif (selectedProtocol == "Energy Minimization"):
             self.protPanel = MinimizationPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Ensemble Browser"):
             self.protPanel = EnsembleBrowserPanel(self, self.W, self.H)
         elif (selectedProtocol == "Ensemble Generation"):
             self.protPanel = EnsembleGenPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Protein Design (Fixbb)"):
             self.protPanel = FixbbPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Residue/Ligand Creator"):
             self.protPanel = ResidueCreatorPanel(self, self.W, self.H)
         elif (selectedProtocol == "Point Mutations"):
             self.protPanel = PointMutationsPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Point Mutant Scan"):
             self.protPanel = PointMutantScanPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Loop Modeling (KIC)"):
             self.protPanel = KICPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Docking"):
             self.protPanel = DockingPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol ==
               "Structure Prediction (Comparative Modeling)"):
             self.protPanel = CompModelPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Protein Design (MSD)"):
             self.protPanel = MSDPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         elif (selectedProtocol == "Antibody Modeling"):
             self.protPanel = AntibodyPanel(self, self.W, self.H)
         elif (selectedProtocol == "Molecular Surfaces"):
             self.protPanel = SurfacesPanel(self, self.W, self.H)
             self.cmd.hide("surface", "all")
         elif (selectedProtocol == "Flexible Peptide Docking"):
             self.protPanel = FlexPepDockPanel(self, self.W, self.H)
             self.protPanel.setSelectWin(self.selectWin)
         self.protPanel.setSeqWin(self.seqWin)
         self.protPanel.setPyMOL(self.pymol)
         self.protPanel.activate()
         self.seqWin.setProtocolPanel(self.protPanel)