Ghost/make_figs_helper.py
def error_size(options):
    """Unused code for looking at the size of errorrs"""
    #
    # Split into large and small errors
    #
    sxs=[]
    sys=[]
    serr=[]
    bxs=[]
    bys=[]
    berr=[]
    calc_bigerr=[]
    calc_small_err=[]
    for count in range(len(xs)):
        x=xs[count]
        y=ys[count]
        err=experrors[count]
        c_err=calcerrors[count]
        diff=abs(x-y)
        if diff<abs(err)+abs(c_err):
            diff=0.0
        else:
            diff=diff-abs(err)-abs(c_err)
        if diff>0.2:
            bxs.append(x)
            bys.append(y)
            berr.append(err)
            calc_bigerr.append(c_err)
        else:
            sxs.append(x)
            sys.append(y)
            serr.append(err)
            calc_smallerr.append(c_err)
    #
    # Plot
    #
    pylab.errorbar(sxs,sys,xerr=serr,fmt='go',label='Small errors')
    pylab.errorbar(bxs,bys,xerr=berr,fmt='ro',label='Large errors')
    pylab.plot(xs,xs,'y-')
    pylab.xlabel('Experimental chemical shift')
    pylab.ylabel('Calculated chemical shift')
    pylab.title('All titratable groups, N only: %s, eps = %5.1f, RMSD= %6.3f' %(method,besteps/10.0,rmsds[0][0]))
    pylab.savefig('%s.png' %method)
    pylab.show()
    pylab.clf()
    #
    # Reformat the residues info
    #
    longres=[]
    for tg,ress in residues:
        for residue in ress:
            longres.append([tg,residue])
    #
    # Find the worst predictions
    #
    nxs=[]
    nys=[]
    nerrs=[]
    import Yasara
    #Y=Yasara.yasara_handler()
    #obj=Y.load_mol('2LZT.pdb')
    #Y.yasara.run('HideAtom Sidechain')
    #Y.yasara.run('Color Green')
    print 'Worst predictions for %s' %method
    tgs=sorted(bigdata[method].keys())
    for count in range(len(xs)):
        x=xs[count]
        y=ys[count]
        experr=abs(experrors[count])
        tg,residue=longres[count]
        #
        color=tgs.index(tg)*30
        tgnum=int(tg.split(':')[1])
       
        #
        diff=abs(x-y)
        if diff<experr:
            diff=0.0
        else:
            diff=diff-experr
        #
        if diff>0.2:
            print '%6s residue: %6s, exp: %6.3f, calc: %6.3f, error: %6.3f' %(tg,residue,x,y,diff)
            #Y.yasara.run('ShowRes %s' %tgnum)
            #Y.yasara.ColorRes(tgnum,color)
            #Y.yasara.run('ColorAtom N Res %d, %d' %(int(residue[1:]),color))
        else:
            nxs.append(x)
            nys.append(y)
            nerrs.append(experr)
    import pylab
    pylab.errorbar(nxs,nys,xerr=nerrs,fmt='ro')
    pylab.plot(nxs,nxs,'g-')
    pylab.xlabel('Exp')
    pylab.ylabel('calc')
    rmsd=RMSD(nxs,nys,nerrs)
    pylab.title('Removing large errors for %s RMSD: %6.3f' %(method,rmsd))
    pylab.show()
    raw_input('is this ok?')
    return
Unused code for looking at the size of errorrs
Unused code for looking at the size of errorrs
Unused code for looking at the size of errorrs
def error_size(options):
     Split into large and small errors
    sxs=[]
    sys=[]
    serr=[]
    bxs=[]
    bys=[]
    berr=[]
    calc_bigerr=[]
    calc_small_err=[]
    for count in range(len(xs)):
        x=xs[count]
        y=ys[count]
        err=experrors[count]
        c_err=calcerrors[count]
        diff=abs(x-y)
        if diff<abs(err)+abs(c_err):
            diff=0.0
        else:
            diff=diff-abs(err)-abs(c_err)
        if diff>0.2:
            bxs.append(x)
            bys.append(y)
            berr.append(err)
            calc_bigerr.append(c_err)
        else:
            sxs.append(x)
            sys.append(y)
            serr.append(err)
            calc_smallerr.append(c_err)
     Plot
    pylab.errorbar(sxs,sys,xerr=serr,fmt='go',label='Small errors')
    pylab.errorbar(bxs,bys,xerr=berr,fmt='ro',label='Large errors')
    pylab.plot(xs,xs,'y-')
    pylab.xlabel('Experimental chemical shift')
    pylab.ylabel('Calculated chemical shift')
    pylab.title('All titratable groups, N only: %s, eps = %5.1f, RMSD= %6.3f' %(method,besteps/10.0,rmsds[0][0]))
    pylab.savefig('%s.png' %method)
    pylab.show()
    pylab.clf()
     Reformat the residues info
    longres=[]
    for tg,ress in residues:
        for residue in ress:
            longres.append([tg,residue])
     Find the worst predictions
    nxs=[]
    nys=[]
    nerrs=[]
    import Yasara
    Y=Yasara.yasara_handler()
    obj=Y.load_mol('2LZT.pdb')
    Y.yasara.run('HideAtom Sidechain')
    Y.yasara.run('Color Green')
    print 'Worst predictions for %s' %method
    tgs=sorted(bigdata[method].keys())
    for count in range(len(xs)):
        x=xs[count]
        y=ys[count]
        experr=abs(experrors[count])
        tg,residue=longres[count]
        color=tgs.index(tg)*30
        tgnum=int(tg.split(':')[1])
        diff=abs(x-y)
        if diff<experr:
            diff=0.0
        else:
            diff=diff-experr
        if diff>0.2:
            print '%6s residue: %6s, exp: %6.3f, calc: %6.3f, error: %6.3f' %(tg,residue,x,y,diff)
            Y.yasara.run('ShowRes %s' %tgnum)
            Y.yasara.ColorRes(tgnum,color)
            Y.yasara.run('ColorAtom N Res %d, %d' %(int(residue[1:]),color))
        else:
            nxs.append(x)
            nys.append(y)
            nerrs.append(experr)
    import pylab
    pylab.errorbar(nxs,nys,xerr=nerrs,fmt='ro')
    pylab.plot(nxs,nxs,'g-')
    pylab.xlabel('Exp')
    pylab.ylabel('calc')
    rmsd=RMSD(nxs,nys,nerrs)
    pylab.title('Removing large errors for %s RMSD: %6.3f' %(method,rmsd))
    pylab.show()
    raw_input('is this ok?')
    return
def error_size ( options ) : sxs = [ ] sys = [ ] serr = [ ] bxs = [ ] bys = [ ] berr = [ ] calc_bigerr = [ ] calc_small_err = [ ] for count in range ( len ( xs ) ) : x = xs [ count ] y = ys [ count ] err = experrors [ count ] c_err = calcerrors [ count ] diff = abs ( x - y ) if diff < abs ( err ) + abs ( c_err ) : diff = 0.0 else : diff = diff - abs ( err ) - abs ( c_err ) if diff > 0.2 : bxs . append ( x ) bys . append ( y ) berr . append ( err ) calc_bigerr . append ( c_err ) else : sxs . append ( x ) sys . append ( y ) serr . append ( err ) calc_smallerr . append ( c_err ) pylab . errorbar ( sxs , sys , xerr = serr , fmt = 'go' , label = 'Small errors' ) pylab . errorbar ( bxs , bys , xerr = berr , fmt = 'ro' , label = 'Large errors' ) pylab . plot ( xs , xs , 'y-' ) pylab . xlabel ( 'Experimental chemical shift' ) pylab . ylabel ( 'Calculated chemical shift' ) pylab . title ( 'All titratable groups, N only: %s, eps = %5.1f, RMSD= %6.3f' % ( method , besteps / 10.0 , rmsds [ 0 ] [ 0 ] ) ) pylab . savefig ( '%s.png' % method ) pylab . show ( ) pylab . clf ( ) longres = [ ] for tg , ress in residues : for residue in ress : longres . append ( [ tg , residue ] ) nxs = [ ] nys = [ ] nerrs = [ ] import Yasara print 'Worst predictions for %s' % method tgs = sorted ( bigdata [ method ] . keys ( ) ) for count in range ( len ( xs ) ) : x = xs [ count ] y = ys [ count ] experr = abs ( experrors [ count ] ) tg , residue = longres [ count ] color = tgs . index ( tg ) * 30 tgnum = int ( tg . split ( ':' ) [ 1 ] ) diff = abs ( x - y ) if diff < experr : diff = 0.0 else : diff = diff - experr if diff > 0.2 : print '%6s residue: %6s, exp: %6.3f, calc: %6.3f, error: %6.3f' % ( tg , residue , x , y , diff ) else : nxs . append ( x ) nys . append ( y ) nerrs . append ( experr ) import pylab pylab . errorbar ( nxs , nys , xerr = nerrs , fmt = 'ro' ) pylab . plot ( nxs , nxs , 'g-' ) pylab . xlabel ( 'Exp' ) pylab . ylabel ( 'calc' ) rmsd = RMSD ( nxs , nys , nerrs ) pylab . title ( 'Removing large errors for %s RMSD: %6.3f' % ( method , rmsd ) ) pylab . show ( ) raw_input ( 'is this ok?' ) return
Unused code for looking at the size of errorrs
Unused code for looking at the size of errorrs
"""Unused code for looking at the size of errorrs""" # # Split into large and small errors # # # Plot # # # Reformat the residues info # # # Find the worst predictions # #Y=Yasara.yasara_handler() #obj=Y.load_mol('2LZT.pdb') #Y.yasara.run('HideAtom Sidechain') #Y.yasara.run('Color Green') # # # #Y.yasara.run('ShowRes %s' %tgnum) #Y.yasara.ColorRes(tgnum,color) #Y.yasara.run('ColorAtom N Res %d, %d' %(int(residue[1:]),color))
options