pKaTool/pKa_calc.py
def prepare_matrix(self):
        """
        # Prepare the matrix
        #
        # Precompute full term
        """
        self.intene={}
        for key in self.matrix.keys():
            self.intene[key]={}
            for key2 in self.matrix[key].keys():
                #print key,key2,self.matrix[key][key2]
                self.intene[key][key2]=  self.matrix[key][key2][0] \
                                        -self.matrix[key][key2][1] \
                                        -self.matrix[key][key2][2] \
                                        +self.matrix[key][key2][3]

        #
        # Make sure that the matrix is symmetrical
        #
        residues=self.intene.keys()
        residues.sort()
        for key in residues:
            for key2 in residues:
                if not self.intene[key].has_key(key2):
                    print 'prepare matrix failed'
                    print 'Matrix[%s] is missing key; %s' %(key,key2)
                    print key
                    print self.intene[key].keys()
                    raise Exception('Matrix[%s] is missing key; %s' %(key,key2))
                E12=self.intene[key][key2]
                E21=self.intene[key2][key]
                new_ene=min(E12,E21)
                self.intene[key][key2]=new_ene
                self.intene[key2][key]=new_ene
        return

        # Prepare the matrix
        #
        # Precompute full term
        
Prepare the matrix
Precompute full term
Prepare the matrix Precompute full term
def prepare_matrix(self):
        self.intene={}
        for key in self.matrix.keys():
            self.intene[key]={}
            for key2 in self.matrix[key].keys():
                self.intene[key][key2]=  self.matrix[key][key2][0] \
                                        -self.matrix[key][key2][1] \
                                        -self.matrix[key][key2][2] \
                                        +self.matrix[key][key2][3]
         Make sure that the matrix is symmetrical
        residues=self.intene.keys()
        residues.sort()
        for key in residues:
            for key2 in residues:
                if not self.intene[key].has_key(key2):
                    print 'prepare matrix failed'
                    print 'Matrix[%s] is missing key; %s' %(key,key2)
                    print key
                    print self.intene[key].keys()
                    raise Exception('Matrix[%s] is missing key; %s' %(key,key2))
                E12=self.intene[key][key2]
                E21=self.intene[key2][key]
                new_ene=min(E12,E21)
                self.intene[key][key2]=new_ene
                self.intene[key2][key]=new_ene
        return
def prepare_matrix ( self ) : self . intene = { } for key in self . matrix . keys ( ) : self . intene [ key ] = { } for key2 in self . matrix [ key ] . keys ( ) : self . intene [ key ] [ key2 ] = self . matrix [ key ] [ key2 ] [ 0 ] - self . matrix [ key ] [ key2 ] [ 1 ] - self . matrix [ key ] [ key2 ] [ 2 ] + self . matrix [ key ] [ key2 ] [ 3 ] residues = self . intene . keys ( ) residues . sort ( ) for key in residues : for key2 in residues : if not self . intene [ key ] . has_key ( key2 ) : print 'prepare matrix failed' print 'Matrix[%s] is missing key; %s' % ( key , key2 ) print key print self . intene [ key ] . keys ( ) raise Exception ( 'Matrix[%s] is missing key; %s' % ( key , key2 ) ) E12 = self . intene [ key ] [ key2 ] E21 = self . intene [ key2 ] [ key ] new_ene = min ( E12 , E21 ) self . intene [ key ] [ key2 ] = new_ene self . intene [ key2 ] [ key ] = new_ene return
Prepare the matrix
 Precompute full term
Prepare the matrix Precompute full term
"""
        # Prepare the matrix
        #
        # Precompute full term
        """ #print key,key2,self.matrix[key][key2] # # Make sure that the matrix is symmetrical #
self