pKa/Design_pKa.py
def calc_dpKa(self):
        """
        # Calculate the dpKa for a particular set of mutations
        """
        # Initialise
        #
        self.initialise('calcdpka')
        #
        # Calculate starting state (wt pKa vals)
        #
        none_muts=[None]
        #
        # Set the mutations
        #
        mutations=self.params['mutations']
        if not mutations:
            self.O._print('You have to specify mutations with the -mutations flag when calculating dpKas',0)
            print 'I got these',mutations
            return

        #
        # Do we have multiple sets of multiple mutations?
        #
        results={}
        import types 
        self.O._print('Residue   Old pKa   New pKa   Difference   Energy     Mutation(s)',1)
        self.O._print('-------------------------------------------------------------------',1)
        if type(mutations[0]) is types.ListType:
            #
            # Multiple sets of mutations
            #
            results['target']=self.desired_pKa_changes.keys()
            for muts in mutations:
                do_it=1
                for mut in muts:
                    for key in self.desired_pKa_changes.keys():
                        if key[:-3]==mut[:-3]:
                            do_it=None
                if do_it:
                    import string
                    score,dpKas=self.calc_dpKa_sub(muts)
                    muts.sort()
                    results[str(muts)]=dpKas
            #
            # Set the outputfile extension
            #
            rtype='phidiff'
            if self.params['MC']:
                rtype='MC'
            #
            # How did we combine mutations?
            #
            comb_type='Explicit'
            if self.params['tabulated']:
                comb_type='Tabulated'
            #
            # Get the target residue
            #
            target_res=self.desired_pKa_changes.keys()
            target_res.sort()
            import string
            target_res=string.join(target_res,'+')
            #
            # Write the file
            #
            fd=open('performance_%s_%s_%s.pickle' %(rtype,comb_type,target_res),'w')
            import cPickle
            cPickle.dump(results,fd)
            fd.close()
        else:
            #
            # Just a single set of mutations
            #
            # Make sure that we don't mutate the residue that we are measuring!
            #
            do_it=1
            for mut in mutations:
                for key in self.desired_pKa_changes.keys():
                    if key[:-3]==mut[:-3]:
                        do_it=None      
            if do_it:
                score,results[str(mutations)]=self.calc_dpKa_sub(mutations)
        return results

        # Calculate the dpKa for a particular set of mutations
        
Calculate the dpKa for a particular set of mutations
Calculate the dpKa for a particular set of mutations
def calc_dpKa(self):
        self.initialise('calcdpka')
         Calculate starting state (wt pKa vals)
        none_muts=[None]
         Set the mutations
        mutations=self.params['mutations']
        if not mutations:
            self.O._print('You have to specify mutations with the -mutations flag when calculating dpKas',0)
            print 'I got these',mutations
            return
         Do we have multiple sets of multiple mutations?
        results={}
        import types 
        self.O._print('Residue   Old pKa   New pKa   Difference   Energy     Mutation(s)',1)
        self.O._print('-------------------------------------------------------------------',1)
        if type(mutations[0]) is types.ListType:
             Multiple sets of mutations
            results['target']=self.desired_pKa_changes.keys()
            for muts in mutations:
                do_it=1
                for mut in muts:
                    for key in self.desired_pKa_changes.keys():
                        if key[:-3]==mut[:-3]:
                            do_it=None
                if do_it:
                    import string
                    score,dpKas=self.calc_dpKa_sub(muts)
                    muts.sort()
                    results[str(muts)]=dpKas
             Set the outputfile extension
            rtype='phidiff'
            if self.params['MC']:
                rtype='MC'
             How did we combine mutations?
            comb_type='Explicit'
            if self.params['tabulated']:
                comb_type='Tabulated'
             Get the target residue
            target_res=self.desired_pKa_changes.keys()
            target_res.sort()
            import string
            target_res=string.join(target_res,'+')
             Write the file
            fd=open('performance_%s_%s_%s.pickle' %(rtype,comb_type,target_res),'w')
            import cPickle
            cPickle.dump(results,fd)
            fd.close()
        else:
             Just a single set of mutations
             Make sure that we don't mutate the residue that we are measuring!
            do_it=1
            for mut in mutations:
                for key in self.desired_pKa_changes.keys():
                    if key[:-3]==mut[:-3]:
                        do_it=None      
            if do_it:
                score,results[str(mutations)]=self.calc_dpKa_sub(mutations)
        return results
def calc_dpKa ( self ) : self . initialise ( 'calcdpka' ) none_muts = [ None ] mutations = self . params [ 'mutations' ] if not mutations : self . O . _print ( 'You have to specify mutations with the -mutations flag when calculating dpKas' , 0 ) print 'I got these' , mutations return results = { } import types self . O . _print ( 'Residue   Old pKa   New pKa   Difference   Energy     Mutation(s)' , 1 ) self . O . _print ( '-------------------------------------------------------------------' , 1 ) if type ( mutations [ 0 ] ) is types . ListType : results [ 'target' ] = self . desired_pKa_changes . keys ( ) for muts in mutations : do_it = 1 for mut in muts : for key in self . desired_pKa_changes . keys ( ) : if key [ : - 3 ] == mut [ : - 3 ] : do_it = None if do_it : import string score , dpKas = self . calc_dpKa_sub ( muts ) muts . sort ( ) results [ str ( muts ) ] = dpKas rtype = 'phidiff' if self . params [ 'MC' ] : rtype = 'MC' comb_type = 'Explicit' if self . params [ 'tabulated' ] : comb_type = 'Tabulated' target_res = self . desired_pKa_changes . keys ( ) target_res . sort ( ) import string target_res = string . join ( target_res , '+' ) fd = open ( 'performance_%s_%s_%s.pickle' % ( rtype , comb_type , target_res ) , 'w' ) import cPickle cPickle . dump ( results , fd ) fd . close ( ) else : do_it = 1 for mut in mutations : for key in self . desired_pKa_changes . keys ( ) : if key [ : - 3 ] == mut [ : - 3 ] : do_it = None if do_it : score , results [ str ( mutations ) ] = self . calc_dpKa_sub ( mutations ) return results
Calculate the dpKa for a particular set of mutations
Calculate the dpKa for a particular set of mutations
"""
        # Calculate the dpKa for a particular set of mutations
        """ # Initialise # # # Calculate starting state (wt pKa vals) # # # Set the mutations # # # Do we have multiple sets of multiple mutations? # # # Multiple sets of mutations # # # Set the outputfile extension # # # How did we combine mutations? # # # Get the target residue # # # Write the file # # # Just a single set of mutations # # Make sure that we don't mutate the residue that we are measuring! #
self