Ghost/EM_effect.py
def load_pdb(self,filename=None):
        """Load a PDB file and build all the HNs"""
        import tkFileDialog, os
        if hasattr(self,'savedir'):
            savedir=self.savedir
        else:
            savedir=os.getcwd()
        if not filename:
            filename=tkFileDialog.askopenfilename(defaultextension="*.pdb",
                                                  initialdir=savedir,
                                                  filetypes=[("PDB file","*.pdb"),("All files","*.*")])
        if filename:
            if os.path.isfile(filename):
                wait_win=Toplevel()
                self.set_geometry(self.master,wait_win)
                wait_win.title('Please wait')
                Label(wait_win,text='Preparing PDB file').grid(row=0,column=0)
                statusvar=StringVar()
                statusvar.set('Reading PDB file')
                Label(wait_win,textvariable=statusvar).grid(row=1,column=0,sticky='news')
                self.master.update_idletasks()
                wait_win.update_idletasks()
                import Protool
                self.PI=Protool.structureIO()
                self.PI.readpdb(filename)
                self.PI.RemoveALT()
                #
                # Build all HNs
                #
                import Protool.hydrogens
                H=Protool.hydrogens.Hydrogens(self.PI)
                residues=self.PI.residues.keys()
                residues.sort()
                count=0
                for residue in residues:
                    statusvar.set('Building hydrogen #%d of %d' %(count,len(residues)))
                    wait_win.update_idletasks()
                    if self.PI.isaa(residue):
                        H.build_HN(residue)
                    count=count+1
                self.PI.Update()
                #
                # Count protein residues
                #
                count=0
                for residue in residues:
                    if self.PI.isaa(residue):
                        count=count+1
                wait_win.destroy()
                #
                # Redraw the canvas
                #
                self.draw_canvas(protein_length=count)
                #
                # Get the titratable groups
                #
                self.PI.get_titratable_groups()
                #
                # If we are started from yasara then load the pdb file
                #
                if self.yasara:
                    self.yasara.run('DelAll')
                    self.yasara.run('obj=LoadPDB %s' %filename)
                    self.yasara.run('Style Stick')
                    self.yasara.run('HideRes Hoh')
                    self.yasara.run('ColorAll Green')
                    self.yasara.run('HUD Off')
                    self.yasara.Finish()
            else:
                raise Exception,'PDB file not found: %s' %(filename)
        return
Load a PDB file and build all the HNs
Load a PDB file and build all the HNs
Load a PDB file and build all the HNs
def load_pdb(self,filename=None):
        import tkFileDialog, os
        if hasattr(self,'savedir'):
            savedir=self.savedir
        else:
            savedir=os.getcwd()
        if not filename:
            filename=tkFileDialog.askopenfilename(defaultextension="*.pdb",
                                                  initialdir=savedir,
                                                  filetypes=[("PDB file","*.pdb"),("All files","*.*")])
        if filename:
            if os.path.isfile(filename):
                wait_win=Toplevel()
                self.set_geometry(self.master,wait_win)
                wait_win.title('Please wait')
                Label(wait_win,text='Preparing PDB file').grid(row=0,column=0)
                statusvar=StringVar()
                statusvar.set('Reading PDB file')
                Label(wait_win,textvariable=statusvar).grid(row=1,column=0,sticky='news')
                self.master.update_idletasks()
                wait_win.update_idletasks()
                import Protool
                self.PI=Protool.structureIO()
                self.PI.readpdb(filename)
                self.PI.RemoveALT()
                 Build all HNs
                import Protool.hydrogens
                H=Protool.hydrogens.Hydrogens(self.PI)
                residues=self.PI.residues.keys()
                residues.sort()
                count=0
                for residue in residues:
                    statusvar.set('Building hydrogen %d of %d' %(count,len(residues)))
                    wait_win.update_idletasks()
                    if self.PI.isaa(residue):
                        H.build_HN(residue)
                    count=count+1
                self.PI.Update()
                 Count protein residues
                count=0
                for residue in residues:
                    if self.PI.isaa(residue):
                        count=count+1
                wait_win.destroy()
                 Redraw the canvas
                self.draw_canvas(protein_length=count)
                 Get the titratable groups
                self.PI.get_titratable_groups()
                 If we are started from yasara then load the pdb file
                if self.yasara:
                    self.yasara.run('DelAll')
                    self.yasara.run('obj=LoadPDB %s' %filename)
                    self.yasara.run('Style Stick')
                    self.yasara.run('HideRes Hoh')
                    self.yasara.run('ColorAll Green')
                    self.yasara.run('HUD Off')
                    self.yasara.Finish()
            else:
                raise Exception,'PDB file not found: %s' %(filename)
        return
def load_pdb ( self , filename = None ) : import tkFileDialog , os if hasattr ( self , 'savedir' ) : savedir = self . savedir else : savedir = os . getcwd ( ) if not filename : filename = tkFileDialog . askopenfilename ( defaultextension = "*.pdb" , initialdir = savedir , filetypes = [ ( "PDB file" , "*.pdb" ) , ( "All files" , "*.*" ) ] ) if filename : if os . path . isfile ( filename ) : wait_win = Toplevel ( ) self . set_geometry ( self . master , wait_win ) wait_win . title ( 'Please wait' ) Label ( wait_win , text = 'Preparing PDB file' ) . grid ( row = 0 , column = 0 ) statusvar = StringVar ( ) statusvar . set ( 'Reading PDB file' ) Label ( wait_win , textvariable = statusvar ) . grid ( row = 1 , column = 0 , sticky = 'news' ) self . master . update_idletasks ( ) wait_win . update_idletasks ( ) import Protool self . PI = Protool . structureIO ( ) self . PI . readpdb ( filename ) self . PI . RemoveALT ( ) import Protool . hydrogens H = Protool . hydrogens . Hydrogens ( self . PI ) residues = self . PI . residues . keys ( ) residues . sort ( ) count = 0 for residue in residues : statusvar . set ( 'Building hydrogen #%d of %d' % ( count , len ( residues ) ) ) wait_win . update_idletasks ( ) if self . PI . isaa ( residue ) : H . build_HN ( residue ) count = count + 1 self . PI . Update ( ) count = 0 for residue in residues : if self . PI . isaa ( residue ) : count = count + 1 wait_win . destroy ( ) self . draw_canvas ( protein_length = count ) self . PI . get_titratable_groups ( ) if self . yasara : self . yasara . run ( 'DelAll' ) self . yasara . run ( 'obj=LoadPDB %s' % filename ) self . yasara . run ( 'Style Stick' ) self . yasara . run ( 'HideRes Hoh' ) self . yasara . run ( 'ColorAll Green' ) self . yasara . run ( 'HUD Off' ) self . yasara . Finish ( ) else : raise Exception , 'PDB file not found: %s' % ( filename ) return
Load a PDB file and build all the HNs
Load a PDB file and build all the HNs
"""Load a PDB file and build all the HNs""" # # Build all HNs # # # Count protein residues # # # Redraw the canvas # # # Get the titratable groups # # # If we are started from yasara then load the pdb file #
self
filename