def plot(dec_inter1, dec_inter2, nat_inter1, nat_inter2, ax, pdb, title1, title2): d1e = scorefileparse.get_energies(dec_inter1[pdb]) d2e = scorefileparse.get_energies(dec_inter2[pdb]) n1e = scorefileparse.get_energies(nat_inter1[pdb]) n2e = scorefileparse.get_energies(nat_inter2[pdb]) r = scorefileparse.get_rmsd(dec_inter1[pdb]) scatterplot.draw_actual_plot(ax, d1e, d2e, r, pdb, title1,title2) #scatterplot.draw_actual_plot(ax, n1e, n2e, [], pdb, title1,title2) scatterplot.plot_regression(ax, scorefileparse.get_energies(dec_inter1[pdb])+scorefileparse.get_energies(nat_inter1[pdb]) ,scorefileparse.get_energies(dec_inter2[pdb])+scorefileparse.get_energies(nat_inter2[pdb]),False)
def main(args): #read in and rename arguments inp_dir=args[1] scoretype=args[2] dec, nat = scorefileparse.read_dec_nat(inp_dir, [], scoretype) disc = discparse.read_dir(inp_dir) dec_norm = scorefileparse.norm_pdbs(dec) nat_norm = scorefileparse.norm_pdbs(nat,dec) [dec_inter, nat_inter, disc_inter] = scorefileparse.pdbs_intersect([dec_norm, nat_norm, disc]) #labels = ["Average","1.0","1.5","2.0","2.5","3.0","4.0","6.0"] labels = ["Average"] energy_gap = [[] for l in labels] avg_disc = [[] for l in labels] for pdb in dec_inter.keys(): for ind in xrange(0,len(labels)): lowest_dec = min([ e[0] for e in dec_inter[pdb].values() ]) lowest_nat = min([ n[0] for n in nat_inter[pdb].values() if n[1] < 2.0 ]) energy_gap[ind].append(lowest_nat - lowest_dec) avg_disc[ind].append(disc_inter[pdb][0]) fig, axarr = conv.create_ax(len(labels), 1) for x_ind,l in enumerate(labels): ax = axarr[0,x_ind] scatterplot.draw_actual_plot(ax, avg_disc[x_ind], energy_gap[x_ind], [], l,"Disc","Energy Gap") scatterplot.plot_regression(ax, avg_disc[x_ind], energy_gap[x_ind], False, False) title = os.path.basename(inp_dir) filename=inp_dir + "/test.txt" conv.save_fig(fig, filename, "disc_v_egap", len(labels)*3, 4)
def plot(disc_metrics_1, disc_metrics_2, title1, title2, output_pre, add_slash=True): pdbs = sorted(disc_metrics_1.keys()) n_metrics = len(disc_metrics_1[pdbs[0]]) fig, axarr = conv.create_ax(n_metrics, 1) for x_ind,metric_name in enumerate(disc_metrics_1[pdbs[0]].keys()): x = [] y = [] ax = axarr[0,x_ind] for pdb in pdbs: x.append(disc_metrics_1[pdb][metric_name]) y.append(disc_metrics_2[pdb][metric_name]) scatterplot.draw_actual_plot(ax, x, y, 'b', metric_name, title1,title2, size=20, edgecolors='k') scatterplot.plot_regression(ax,x,y,False) if add_slash: filename = output_pre + "/" + title1 + "_" + title2 + ".txt" else: filename = output_pre + title1 + "_" + title2 + ".txt" suffix="disc_v_disc" conv.save_fig(fig, filename, suffix, n_metrics*3, 3, size=9)
def plot_corr(c_1, c_2, ax, x_axis, y_axis): scatterplot.draw_actual_plot(ax, c_1, c_2, 'b', "Counts vs. Counts", x_axis, y_axis, size=10) scatterplot.plot_regression(ax, c_1, c_2)