pKaTool/pKacalc_interface.py
def pKaTool_pKa(self):
        """Perform a dirt-cheap pKa calculation using Jens' simple, simple method"""
        self.pHstart=0.1
        self.pHstop=20.0
        self.pHstep=0.1
        self.chwin.destroy()
        self.simple_win=Toplevel()
        self.simple_win.transient(self.master)
        self.simple_win.title('pKaTool cheap pKa calculation')
        self.set_geometry(self.master,self.simple_win)
        self.status=StringVar()
        self.status.set('Status: Initialising pKa calculation routines')
        Label(self.simple_win,textvariable=self.status).grid(row=5,column=0,columnspan=2)
        self.status2=StringVar()
        self.status2.set('---')
        Label(self.simple_win,textvariable=self.status2,bg='white').grid(row=6,column=0,columnspan=2)
        self.update()
        #
        # Do we have a PDB file?
        #
        if not self.pdbfilename:
            tkMessageBox.showwarning("No PDB file",
            "You did not load a PDB file",
            parent=self.simple_win)
            self.simple_win.destroy()
            return
        #
        # Start the pKa calculation
        #
        import Protool
        import Protool.errors
        P=Protool.structureIO()
        self.status.set('Reading PDB file')
        self.update()
        P.readpdb(self.pdbfilename)
        self.status.set('Removing non AA atoms')
        P.Remove_All_NonAminoAcids()
        try:
            self.status.set('Calculating site-site interaction energies')
            self.update()
            matrix=P.calculate_matrix(self.pdbfilename,updater=self.full_pKa_updater)
            self.status.set('Calculating desolvation energies')
            self.update()
            desolv=P.calculate_desolvation(self.pdbfilename,updater=self.full_pKa_updater)
            #
            self.status.set('Calculating background interaction energies')
            self.update()
            backgr=P.calculate_background(self.pdbfilename,updater=self.full_pKa_updater)
        except Protool.errors.AtomNotFoundError,inst:
            tkMessageBox.showwarning("Atom missing",
                                     "At least one atom is missing in the PDB file.\nMake sure that all atoms are present before starting a pKa calculation.\nYou can e.g. use the pdb2pqr server for that.\nError:\n%s" %inst,
                                     parent=self.simple_win)
            self.simple_win.destroy()
            return

        self.status.set('Calculating titration using Monte Carlo sampling')
        self.update()

        import pKa_calc
        try:
            C=pKa_calc.Monte_Carlo_CPP()
            C.test()
        except:
            tkMessageBox.showwarning("C++ module not found",
                                     'C++ module pMC not found. I will revert to a python implementation of the Tanford-Roxby algorithm.\n\nIf you are running linux, then you should try to cd to the pKaTool directory and type "make"',
                                     parent=self.master)
            self.status.set('Calculating titration curves using Tanford-Roxby algorithm')
            self.update()
            C=pKa_calc.Tanford_Roxby()
        #
        # Load the values
        #
        C.matrix=matrix
        C.desolv=desolv
        C.backgr=backgr
        C.calc_pKas(mcsteps=200000,phstep=self.pHstep,phstart=self.pHstart,phend=self.pHstop,complete_pka=1)
        #
        # Write the titration curve file and the PKA.DAT file
        #
        import pKaIO
        X=pKaIO.pKaIO()
        X.write_titration_curve(self.pdbfilename+'.TITCURV.DAT',C.prot_states)
        X.write_pka(self.pdbfilename+'.PKA.DAT',C.pka)

        self.status.set('Done')
        self.update()
        #
        # Load the results
        #
        self.simple_win.destroy()
        self.chwin.destroy()
        self.load_titration(pdbfilename=self.pdbfilename)
        tkMessageBox.showwarning("pKa calculation done",'The pKa calculation has finished',parent=self.master)
        return
Perform a dirt-cheap pKa calculation using Jens' simple, simple method
Perform a dirt-cheap pKa calculation using Jens' simple, simple method
Perform a dirt - cheap pKa calculation using Jens ' simple simple method
def pKaTool_pKa(self):
        self.pHstart=0.1
        self.pHstop=20.0
        self.pHstep=0.1
        self.chwin.destroy()
        self.simple_win=Toplevel()
        self.simple_win.transient(self.master)
        self.simple_win.title('pKaTool cheap pKa calculation')
        self.set_geometry(self.master,self.simple_win)
        self.status=StringVar()
        self.status.set('Status: Initialising pKa calculation routines')
        Label(self.simple_win,textvariable=self.status).grid(row=5,column=0,columnspan=2)
        self.status2=StringVar()
        self.status2.set('---')
        Label(self.simple_win,textvariable=self.status2,bg='white').grid(row=6,column=0,columnspan=2)
        self.update()
         Do we have a PDB file?
        if not self.pdbfilename:
            tkMessageBox.showwarning("No PDB file",
            "You did not load a PDB file",
            parent=self.simple_win)
            self.simple_win.destroy()
            return
         Start the pKa calculation
        import Protool
        import Protool.errors
        P=Protool.structureIO()
        self.status.set('Reading PDB file')
        self.update()
        P.readpdb(self.pdbfilename)
        self.status.set('Removing non AA atoms')
        P.Remove_All_NonAminoAcids()
        try:
            self.status.set('Calculating site-site interaction energies')
            self.update()
            matrix=P.calculate_matrix(self.pdbfilename,updater=self.full_pKa_updater)
            self.status.set('Calculating desolvation energies')
            self.update()
            desolv=P.calculate_desolvation(self.pdbfilename,updater=self.full_pKa_updater)
            self.status.set('Calculating background interaction energies')
            self.update()
            backgr=P.calculate_background(self.pdbfilename,updater=self.full_pKa_updater)
        except Protool.errors.AtomNotFoundError,inst:
            tkMessageBox.showwarning("Atom missing",
                                     "At least one atom is missing in the PDB file.\nMake sure that all atoms are present before starting a pKa calculation.\nYou can e.g. use the pdb2pqr server for that.\nError:\n%s" %inst,
                                     parent=self.simple_win)
            self.simple_win.destroy()
            return
        self.status.set('Calculating titration using Monte Carlo sampling')
        self.update()
        import pKa_calc
        try:
            C=pKa_calc.Monte_Carlo_CPP()
            C.test()
        except:
            tkMessageBox.showwarning("C++ module not found",
                                     'C++ module pMC not found. I will revert to a python implementation of the Tanford-Roxby algorithm.\n\nIf you are running linux, then you should try to cd to the pKaTool directory and type "make"',
                                     parent=self.master)
            self.status.set('Calculating titration curves using Tanford-Roxby algorithm')
            self.update()
            C=pKa_calc.Tanford_Roxby()
         Load the values
        C.matrix=matrix
        C.desolv=desolv
        C.backgr=backgr
        C.calc_pKas(mcsteps=200000,phstep=self.pHstep,phstart=self.pHstart,phend=self.pHstop,complete_pka=1)
         Write the titration curve file and the PKA.DAT file
        import pKaIO
        X=pKaIO.pKaIO()
        X.write_titration_curve(self.pdbfilename+'.TITCURV.DAT',C.prot_states)
        X.write_pka(self.pdbfilename+'.PKA.DAT',C.pka)
        self.status.set('Done')
        self.update()
         Load the results
        self.simple_win.destroy()
        self.chwin.destroy()
        self.load_titration(pdbfilename=self.pdbfilename)
        tkMessageBox.showwarning("pKa calculation done",'The pKa calculation has finished',parent=self.master)
        return
def pKaTool_pKa ( self ) : self . pHstart = 0.1 self . pHstop = 20.0 self . pHstep = 0.1 self . chwin . destroy ( ) self . simple_win = Toplevel ( ) self . simple_win . transient ( self . master ) self . simple_win . title ( 'pKaTool cheap pKa calculation' ) self . set_geometry ( self . master , self . simple_win ) self . status = StringVar ( ) self . status . set ( 'Status: Initialising pKa calculation routines' ) Label ( self . simple_win , textvariable = self . status ) . grid ( row = 5 , column = 0 , columnspan = 2 ) self . status2 = StringVar ( ) self . status2 . set ( '---' ) Label ( self . simple_win , textvariable = self . status2 , bg = 'white' ) . grid ( row = 6 , column = 0 , columnspan = 2 ) self . update ( ) if not self . pdbfilename : tkMessageBox . showwarning ( "No PDB file" , "You did not load a PDB file" , parent = self . simple_win ) self . simple_win . destroy ( ) return import Protool import Protool . errors P = Protool . structureIO ( ) self . status . set ( 'Reading PDB file' ) self . update ( ) P . readpdb ( self . pdbfilename ) self . status . set ( 'Removing non AA atoms' ) P . Remove_All_NonAminoAcids ( ) try : self . status . set ( 'Calculating site-site interaction energies' ) self . update ( ) matrix = P . calculate_matrix ( self . pdbfilename , updater = self . full_pKa_updater ) self . status . set ( 'Calculating desolvation energies' ) self . update ( ) desolv = P . calculate_desolvation ( self . pdbfilename , updater = self . full_pKa_updater ) self . status . set ( 'Calculating background interaction energies' ) self . update ( ) backgr = P . calculate_background ( self . pdbfilename , updater = self . full_pKa_updater ) except Protool . errors . AtomNotFoundError , inst : tkMessageBox . showwarning ( "Atom missing" , "At least one atom is missing in the PDB file.\nMake sure that all atoms are present before starting a pKa calculation.\nYou can e.g. use the pdb2pqr server for that.\nError:\n%s" % inst , parent = self . simple_win ) self . simple_win . destroy ( ) return self . status . set ( 'Calculating titration using Monte Carlo sampling' ) self . update ( ) import pKa_calc try : C = pKa_calc . Monte_Carlo_CPP ( ) C . test ( ) except : tkMessageBox . showwarning ( "C++ module not found" , 'C++ module pMC not found. I will revert to a python implementation of the Tanford-Roxby algorithm.\n\nIf you are running linux, then you should try to cd to the pKaTool directory and type "make"' , parent = self . master ) self . status . set ( 'Calculating titration curves using Tanford-Roxby algorithm' ) self . update ( ) C = pKa_calc . Tanford_Roxby ( ) C . matrix = matrix C . desolv = desolv C . backgr = backgr C . calc_pKas ( mcsteps = 200000 , phstep = self . pHstep , phstart = self . pHstart , phend = self . pHstop , complete_pka = 1 ) import pKaIO X = pKaIO . pKaIO ( ) X . write_titration_curve ( self . pdbfilename + '.TITCURV.DAT' , C . prot_states ) X . write_pka ( self . pdbfilename + '.PKA.DAT' , C . pka ) self . status . set ( 'Done' ) self . update ( ) self . simple_win . destroy ( ) self . chwin . destroy ( ) self . load_titration ( pdbfilename = self . pdbfilename ) tkMessageBox . showwarning ( "pKa calculation done" , 'The pKa calculation has finished' , parent = self . master ) return
Perform a dirt-cheap pKa calculation using Jens' simple, simple method
Perform a dirt - cheap pKa calculation using Jens ' simple simple method
"""Perform a dirt-cheap pKa calculation using Jens' simple, simple method""" # # Do we have a PDB file? # # # Start the pKa calculation # # # # Load the values # # # Write the titration curve file and the PKA.DAT file # # # Load the results #
self