Ghost/make_figs_helper.py
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
|Make a heatmap - not sure what this function does...
|Make a heatmap - not sure what this function does
|Make a heatmap - not sure what this function does
def heatmap():
    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
def heatmap ( ) : 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
|Make a heatmap - not sure what this function does...
|Make a heatmap - not sure what this function does ...
"""|Make a heatmap - not sure what this function does...""" # # ----- # # # # # # #