def plot(): fd = open('Biso_v_resolution.gnuplotdata', 'r') lines = fd.readlines() fd.close() d_splot = {} l_resolution = [] l_Biso = [] for line in lines: l = line.split() resolution = float(l[1]) Biso = float(l[0]) resolution_rounded = round(resolution, 1) ## resolution_rounded = 0.1*round(resolution/0.1,0) Biso_rounded = round(Biso, 0) if not resolution_rounded in d_splot.keys(): d_splot[resolution_rounded] = {} if not Biso_rounded in d_splot[resolution_rounded].keys(): d_splot[resolution_rounded][Biso_rounded] = 0 d_splot[resolution_rounded][Biso_rounded] += 1 l_resolution += [resolution] l_Biso += [Biso] a, b, r, p = statistics.do_regression( l_resolution, l_Biso, verbose=False, ) print 'correlation = r =', r tcrit = 1.960 ## 95% confidence 2 tail (student table...) ## tcrit = 76. ## f,g,h = statistics.do_confidence_bands(l_resolution,l_Biso,tcrit,) lines = [] ## for resolution in range(5,35+1): for resolution in range(5, 35 + 1): resolution /= 10. for Biso in range(0, 100 + 1): Biso /= 1. if not resolution in d_splot.keys(): count = 0 elif not Biso in d_splot[resolution].keys(): count = 0 else: count = d_splot[resolution][Biso] lines += ['%s %s %s\n' % ( resolution, Biso, count, )] lines += ['\n'] gnuplot.contour_plot( 'validation_Biso_v_resolution', lines, xlabel='resolution (Angstrom)', ylabel='<Biso>', bool_remove=False, ) return
def plot(): fd = open('Biso_v_resolution.gnuplotdata','r') lines = fd.readlines() fd.close() d_splot = {} l_resolution = [] l_Biso = [] for line in lines: l = line.split() resolution = float(l[1]) Biso = float(l[0]) resolution_rounded = round(resolution,1) ## resolution_rounded = 0.1*round(resolution/0.1,0) Biso_rounded = round(Biso,0) if not resolution_rounded in d_splot.keys(): d_splot[resolution_rounded] = {} if not Biso_rounded in d_splot[resolution_rounded].keys(): d_splot[resolution_rounded][Biso_rounded] = 0 d_splot[resolution_rounded][Biso_rounded] += 1 l_resolution += [resolution] l_Biso += [Biso] a,b,r,p = statistics.do_regression(l_resolution,l_Biso,verbose=False,) print 'correlation = r =', r tcrit = 1.960 ## 95% confidence 2 tail (student table...) ## tcrit = 76. ## f,g,h = statistics.do_confidence_bands(l_resolution,l_Biso,tcrit,) lines = [] ## for resolution in range(5,35+1): for resolution in range(5,35+1): resolution /= 10. for Biso in range(0,100+1): Biso /= 1. if not resolution in d_splot.keys(): count = 0 elif not Biso in d_splot[resolution].keys(): count = 0 else: count = d_splot[resolution][Biso] lines += ['%s %s %s\n' %(resolution,Biso,count,)] lines += ['\n'] gnuplot.contour_plot( 'validation_Biso_v_resolution',lines, xlabel='resolution (Angstrom)',ylabel='<Biso>', bool_remove = False, ) return
lines = fd.readlines() fd.close() d_resolution = {} for line in lines: l = line.strip().split() pdb = l[0] v = l[1] if v == "['.']": continue if float(v[2:-2]) > 5.0: ## print pdb, 'resolution', v continue d_resolution[pdb] = v l_MV = [] l_resolution = [] lines_gnuplot = [] set_pdbs = set(d_MV.keys())&set(d_resolution.keys()) for pdb in set_pdbs: MV = float(d_MV[pdb]) resolution = float(d_resolution[pdb][2:-2]) l_MV += [MV] l_resolution += [resolution] lines_gnuplot += ['%s %s\n' %(resolution,MV,)] t = statistics.do_regression(l_resolution,l_MV) fd = open('tmp.txt','w') fd.writelines(lines_gnuplot) fd.close()
for line in lines: l = line.strip().split() pdb = l[0] v = l[1] if v == "['.']": continue if float(v[2:-2]) > 5.0: ## print pdb, 'resolution', v continue d_resolution[pdb] = v l_MV = [] l_resolution = [] lines_gnuplot = [] set_pdbs = set(d_MV.keys()) & set(d_resolution.keys()) for pdb in set_pdbs: MV = float(d_MV[pdb]) resolution = float(d_resolution[pdb][2:-2]) l_MV += [MV] l_resolution += [resolution] lines_gnuplot += ['%s %s\n' % ( resolution, MV, )] t = statistics.do_regression(l_resolution, l_MV) fd = open('tmp.txt', 'w') fd.writelines(lines_gnuplot) fd.close()