PEATDB/Actions.py
def addPDBFile(self, DB=None, name=None, pdbfile=None,
                       pdbdata=None, pdbname=None, gui=True):
        """Add a PDB file to the record given as argument"""
        import os, tkMessageBox
        if pdbdata == None and pdbfile == None:
            savedir=os.getcwd()
            global PDB_code
            pdbfile=tkFileDialog.askopenfilename(defaultextension='.pdb',
                                         initialdir=savedir,
                                         filetypes=[("PDB file","*.pdb"),
                                                    ("PDB file","*.brk"),
                                                    ("All files","*.*")])
            if not pdbfile:
                return
        if pdbfile:    
            pdbname = os.path.basename(pdbfile)
        import Protool
        self.X=Protool.structureIO()
        # Extracting PDB_code from pdbfile
        if pdbdata != None: 
            self.X.readpdb(data=pdbdata)
        elif os.path.isfile(pdbfile):
            PDB_code=pdbfile.split('/').pop().split('.')[0]
            # Try to read it using Protool    
            try:
                self.X.readpdb(filename=pdbfile)
            except:
                tkMessageBox.showwarning('Error reading PDB file',
                                         'I could not read the PDB file. This probably means that the PDB file is corrupt in some way.')
                return
            
        AlignmentMap = None    
        if gui==True:
            if tkMessageBox.askyesno('Reset AA Seq?',
                                     'Do you want to reset the amino acid Sequence?'):      
                AlignmentMap = self.checkPDBSequence(name)               
            
        #store it    
        DB.storePDB(name, self.X, AlignmentMap)
        if hasattr(DB.meta,'refprotein'):                
            ref = DB.meta.refprotein
            #if this is the reference protein remodel mutations and rewrite mut codes   
            if name == ref:
                print name, ref
                print 'rechecking mutation codes, ref prot structure has changed'                
                #get new mutation codes
                import PEATSA.Core as Core
                for p in DB.getRecs():
                    self.checkMutation(DB, p, ref, self.X)
                #self.checkModels(DB)
                
        #add the original pdb name
        DB.data[name]['pdbname'] = pdbname
        return
Add a PDB file to the record given as argument
Add a PDB file to the record given as argument
Add a PDB file to the record given as argument
def addPDBFile(self, DB=None, name=None, pdbfile=None,
                       pdbdata=None, pdbname=None, gui=True):
        import os, tkMessageBox
        if pdbdata == None and pdbfile == None:
            savedir=os.getcwd()
            global PDB_code
            pdbfile=tkFileDialog.askopenfilename(defaultextension='.pdb',
                                         initialdir=savedir,
                                         filetypes=[("PDB file","*.pdb"),
                                                    ("PDB file","*.brk"),
                                                    ("All files","*.*")])
            if not pdbfile:
                return
        if pdbfile:    
            pdbname = os.path.basename(pdbfile)
        import Protool
        self.X=Protool.structureIO()
        if pdbdata != None: 
            self.X.readpdb(data=pdbdata)
        elif os.path.isfile(pdbfile):
            PDB_code=pdbfile.split('/').pop().split('.')[0]
            try:
                self.X.readpdb(filename=pdbfile)
            except:
                tkMessageBox.showwarning('Error reading PDB file',
                                         'I could not read the PDB file. This probably means that the PDB file is corrupt in some way.')
                return
        AlignmentMap = None    
        if gui==True:
            if tkMessageBox.askyesno('Reset AA Seq?',
                                     'Do you want to reset the amino acid Sequence?'):      
                AlignmentMap = self.checkPDBSequence(name)               
        DB.storePDB(name, self.X, AlignmentMap)
        if hasattr(DB.meta,'refprotein'):                
            ref = DB.meta.refprotein
            if name == ref:
                print name, ref
                print 'rechecking mutation codes, ref prot structure has changed'                
                import PEATSA.Core as Core
                for p in DB.getRecs():
                    self.checkMutation(DB, p, ref, self.X)
        DB.data[name]['pdbname'] = pdbname
        return
def addPDBFile ( self , DB = None , name = None , pdbfile = None , pdbdata = None , pdbname = None , gui = True ) : import os , tkMessageBox if pdbdata == None and pdbfile == None : savedir = os . getcwd ( ) global PDB_code pdbfile = tkFileDialog . askopenfilename ( defaultextension = '.pdb' , initialdir = savedir , filetypes = [ ( "PDB file" , "*.pdb" ) , ( "PDB file" , "*.brk" ) , ( "All files" , "*.*" ) ] ) if not pdbfile : return if pdbfile : pdbname = os . path . basename ( pdbfile ) import Protool self . X = Protool . structureIO ( ) if pdbdata != None : self . X . readpdb ( data = pdbdata ) elif os . path . isfile ( pdbfile ) : PDB_code = pdbfile . split ( '/' ) . pop ( ) . split ( '.' ) [ 0 ] try : self . X . readpdb ( filename = pdbfile ) except : tkMessageBox . showwarning ( 'Error reading PDB file' , 'I could not read the PDB file. This probably means that the PDB file is corrupt in some way.' ) return AlignmentMap = None if gui == True : if tkMessageBox . askyesno ( 'Reset AA Seq?' , 'Do you want to reset the amino acid Sequence?' ) : AlignmentMap = self . checkPDBSequence ( name ) DB . storePDB ( name , self . X , AlignmentMap ) if hasattr ( DB . meta , 'refprotein' ) : ref = DB . meta . refprotein if name == ref : print name , ref print 'rechecking mutation codes, ref prot structure has changed' import PEATSA . Core as Core for p in DB . getRecs ( ) : self . checkMutation ( DB , p , ref , self . X ) DB . data [ name ] [ 'pdbname' ] = pdbname return
Add a PDB file to the record given as argument
Add a PDB file to the record given as argument
"""Add a PDB file to the record given as argument""" # Extracting PDB_code from pdbfile # Try to read it using Protool     #store it     #if this is the reference protein remodel mutations and rewrite mut codes    #get new mutation codes #self.checkModels(DB) #add the original pdb name
self
DB
name
pdbfile
pdbdata
pdbname
gui