def __init__(self):
     """Make permutations of a two-group acid-acid system"""
     self.pHstart=0.0
     self.pHend=20.0
     self.pHstep=0.1
     self.pKa_MCsteps=2000000
     
     import numpy
     pka_diffs=numpy.arange(0.0,2.0,0.01)
     int_enes=numpy.arange(0.0,2.0,0.01)
     #
     import math
     matrix={}
     for pka_diff in pka_diffs:
         print pka_diff
         matrix[pka_diff]={}
         for int_ene in int_enes:
             pKa_values, prot_states=self.do_pKa_calc(pka_diff,int_ene)
             #print int_ene,pKa_values
             #del prot_states[':0002:GLU']
             matrix[pka_diff][int_ene]=self.fit_curves(prot_states)
         #stop
     import TwoDplots
     TwoDplots.heatmap(matrix,'Two-group scan',firstkey='Difference in intrinsic pKa',secondkey='Interaction energy (kT)',zlabel='Average slope', 
     firstticks=[numpy.arange(0,200,10),numpy.arange(0.0,2.0,0.1)], 
     secondticks=[numpy.arange(0,200,10),numpy.arange(0.0,2.0,0.1)])
     #
     return
Ejemplo n.º 2
0
 def __init__(self,options):
     #
     # Read the dir
     #
     import large_dataset_manager
     self.DM=large_dataset_manager.data_manager(options.dir)
     #
     # Read all datasets
     #
     matrix={}
     count=0
     data=self.DM(count)
     while data:
         count=count+1
         data=self.DM(count)
         if count>1000:
             data=None
         print '\b.',
         import sys
         sys.stdout.flush()
         #
         if data:
             sum_intpkadiff,sum_intene,tit_fit,pHact_fit=self.analyze_point(data)
             if not matrix.has_key(sum_intpkadiff):
                 matrix[sum_intpkadiff]={}
             if not matrix[sum_intpkadiff].has_key(sum_intene):
                 matrix[sum_intpkadiff][sum_intene]=[0,0]
             matrix[sum_intpkadiff][sum_intene][0]=matrix[sum_intpkadiff][sum_intene][0]+tit_fit
             matrix[sum_intpkadiff][sum_intene][1]=matrix[sum_intpkadiff][sum_intene][1]+pHact_fit
     #
     # Calculate ratio
     #
     minS=9999.9
     maxS=-9999.9
     for ip in matrix.keys():
         for ie in matrix[ip].keys():
             minS=min(minS,ie)
             maxS=max(maxS,ie)
             #
             vals=matrix[ip][ie]
             matrix[ip][ie]=vals[0]
     # Fill in empty values
     minF=min(matrix.keys())
     maxF=max(matrix.keys())
     print minF,maxF
     print minS,maxS
     #stop
     for ip in np.arange(minF,maxF+1,1):
         if not matrix.has_key(ip):
             matrix[ip]={}
         for ie in range(minS,maxS+1,1):
             if not matrix[ip].has_key(ie):
                 matrix[ip][ie]=0.0
     import TwoDplots
     TwoDplots.heatmap(matrix,firstkey='sum intpka diff',secondkey='sum intene (kT)')
             
     print 'I found %7.2e datasets' %count
     return
Ejemplo n.º 3
0
def heatmap():
    """|Make a heatmap - not sure what this function does..."""
    data = getdata()
    TGs = sorted(data.keys())
    for titgroup in TGs:
        thisN = []
        thisH = []
        for residue in sorted(data[titgroup].keys()):
            Hval = 0.0
            Nval = 0.0
            for atom in ['H', 'N']:
                if data[titgroup][residue].has_key(atom):
                    x = data[titgroup][residue][atom]
                    #
                    # -----
                    #
                    if x == 'absent':
                        print 'abs'
                        if atom == 'H':
                            Hval = -20
                        else:
                            Nval = -20
                    else:
                        if x[0] == 'q':
                            x = x[1:]
                        x = x.split(';')[0]
                        if x[0] in ['<', '>']:
                            x = x[1:]
                        x = float(x)
                        if atom == 'H':
                            Hval = 20
                        else:
                            Nval = 20
                    #
                    #
            thisN.append(Nval)
            thisH.append(Hval)
        for y in range(10):
            Ndata.append(thisN)
            Hdata.append(thisH)
    #
    #
    import TwoDplots
    blue_red1 = TwoDplots.LinearSegmentedColormap('BlueRed1', cdict1)
    #
    plt.imshow(Ndata, interpolation='nearest', cmap=blue_red1)
    cbar = plt.colorbar()
    cbar.set_label('score')
    #
    plt.yticks(range(5, 105, 10), TGs)
    plt.ylim([0, 100])
    plt.show()
    return
Ejemplo n.º 4
0
            exp[T2] = {}
        exp[T2][T1] = exp[T1][T2]

matrix2 = {}
tTGs = matrix.keys()
TGs = []
for tg in tTGs:
    if tg.find('TYR') == -1:
        TGs.append(tg)
for TG1 in TGs:
    matrix2[TG1] = {}
    for TG2 in TGs:
        value = 0.0
        if exp.has_key(TG1):
            if exp[TG1].has_key(TG2):
                import math
                value = math.log(10) * exp[TG1][TG2]
        #value=abs((matrix[TG1][TG2][0]+matrix[TG2][TG1][0])/2.0)
        #if value<0.7:
        #    value=value
        matrix2[TG1][TG2] = value

import TwoDplots

TwoDplots.heatmap(matrix2,
                  title='Interaction energy matrix',
                  firstkey='TG1',
                  secondkey='TG2',
                  zlabel='Interaction energy (kT)',
                  firstticks=sorted(TGs),
                  secondticks=sorted(TGs))
Ejemplo n.º 5
0
exp={':0035:GLU':{':0052:ASP':1.2,':0119:ASP':0.3,':0007:GLU':0.3}}
for T1 in exp.keys():
    for T2 in exp[T1].keys():
        if not exp.has_key(T2):
            exp[T2]={}
        exp[T2][T1]=exp[T1][T2]


matrix2={}
tTGs=matrix.keys()
TGs=[]
for tg in tTGs:
    if tg.find('TYR')==-1:
        TGs.append(tg)
for TG1 in TGs:
    matrix2[TG1]={}
    for TG2 in TGs:
        value=0.0
        if exp.has_key(TG1):
            if exp[TG1].has_key(TG2):
                import math
                value=math.log(10)*exp[TG1][TG2]
        #value=abs((matrix[TG1][TG2][0]+matrix[TG2][TG1][0])/2.0)
        #if value<0.7:
        #    value=value
        matrix2[TG1][TG2]=value

import TwoDplots

TwoDplots.heatmap(matrix2,title='Interaction energy matrix',firstkey='TG1',secondkey='TG2',zlabel='Interaction energy (kT)',firstticks=sorted(TGs),secondticks=sorted(TGs))