def main(list_input_dirs, energies_names, output_pre, scales, offsets):
    #read in and rename arguments
    inp_dir1=list_input_dirs[0][0]
    scoretype1=list_input_dirs[0][1]
    inp_dir2=list_input_dirs[1][0]
    scoretype2=list_input_dirs[1][1]

    title1 = os.path.basename(inp_dir1)
    title2 = os.path.basename(inp_dir2)

    #keep inp_dir1 as constant
    #loop through energies_names[scoretype2]
    #for each energies_names - make a list of weights either using random or centered around mean using sampling bins and nbins from input parameters

    #recursive method - input is list of energies, list of weights per energy, and index of energy. 
    #for that energy, loops thru list of weights, and kicks off further method per next index
    #base case - index = len(list). create weighted dec2, nat2.  merge dicts. convert_disc and get list of discs, one per pdb. return this.
    dec1_total = scorefileparse.read_dir(inp_dir1, scoretype1)
    dec1_total_disc = discparse.pdbs_dict_to_metrics(dec1_total)
    dec2_total = scorefileparse.read_dir(inp_dir2, scoretype2)
    dec2_total_disc = discparse.pdbs_dict_to_metrics(dec2_total)

    dec1 = scorefileparse.read_dir(inp_dir1, scoretype1, list_energies=energies_names[scoretype1])

    weights = [ np.linspace(-2.0, 2.0, num=9).tolist() for _ in energies_names[scoretype2] ] 

    lwd = [ [] for _ in xrange(0, len(weights)+1) ] # need list for each weight + one for pdb_disc_dict
    loop_weights(energies_names[scoretype2], weights, scales, offsets, dec1, inp_dir2, scoretype2, [], lwd)
    list_avg_pdbs_deltaS_R = [ avg_pdbs_deltaS(deltaS_pdbs_disc_dict(pdbs_disc_dict, dec1_total_disc)) for pdbs_disc_dict in lwd[-1] ] 
    list_avg_pdbs_deltaS_A = [ avg_pdbs_deltaS(deltaS_pdbs_disc_dict(pdbs_disc_dict, dec2_total_disc)) for pdbs_disc_dict in lwd[-1] ]

    list_weights_deltaS = lwd[:-1]
    list_weights_deltaS.append(list_avg_pdbs_deltaS_R)
    list_weights_deltaS.append(list_avg_pdbs_deltaS_A)
    
    weights_deltaS_arr = np.array(list_weights_deltaS, dtype="float")
    weights_deltaS_arr = weights_deltaS_arr.T
    
    unique_z_vals = np.unique(weights_deltaS_arr[:,2])

    low_dS = sorted(weights_deltaS_arr[:,3].tolist())[0:3]
    low_dS_ind = [ i for i,dS in enumerate(weights_deltaS_arr[:,3].tolist()) if dS in low_dS ]

    for ind in low_dS_ind:
	pdvd.plot(dec1_total_disc, lwd[-1][ind], "Rosetta", "Combined", "{0}{1}_".format(output_pre,ind,"_"), add_slash=False)
        pdvd.plot(dec2_total_disc, lwd[-1][ind], "Amber", "Combined", "{0}{1}_".format(output_pre,ind,"_"), add_slash=False)

    #w_dS_sorted = weights_deltaS_arr[np.lexsort((weights_deltaS_arr[:,0],weights_deltaS_arr[:,1]))]
    w_dS_sorted = weights_deltaS_arr

    plot_weights_dS(w_dS_sorted, 3, unique_z_vals, title1, title2, energies_names[scoretype2][0], energies_names[scoretype2][1], energies_names[scoretype2][2])

    plot_weights_dS(w_dS_sorted, 4, unique_z_vals, title1, title2, energies_names[scoretype2][0], energies_names[scoretype2][1], energies_names[scoretype2][2])

    filename_txt = args.output_pre + "/" + title1 + "_" + title2 + "_weights_vs_deltaS.txt"

    np.savetxt(filename_txt, w_dS_sorted, fmt='%2.5f', delimiter=",", header="gb,elec,dihedral,deltaSR,deltaSA")
def main(input_dir, output_pre, repl_orig):
    #read in and rename arguments
    title1 = os.path.basename(input_dir[0][0])
    title2 = os.path.basename(input_dir[1][0])

    d1 = scorefileparse.read_dir(input_dir[0][0], input_dir[0][1], repl_orig)
    d2 = scorefileparse.read_dir(input_dir[1][0], input_dir[1][1], repl_orig)
    [dec_inter1, dec_inter2] = scorefileparse.pdbs_scores_intersect([d1, d2])       
    disc_metrics_1 = discparse.pdbs_dict_to_metrics(dec_inter1,input_dir[0][1])
    disc_metrics_2 = discparse.pdbs_dict_to_metrics(dec_inter2,input_dir[1][1])
    print len(dec_inter1)
    print len(dec_inter2)
    print disc_metrics_2
    plot(disc_metrics_1, disc_metrics_2, title1, title2, output_pre)
def main(input_dir, output_file):
    #read in and rename arguments
    title1 = os.path.basename(input_dir[0][0])

    d1 = scorefileparse.read_dir(input_dir[0][0], input_dir[0][1], repl_orig=False)
    disc_metrics = discparse.pdbs_dict_to_metrics(d1,input_dir[0][1])

    discparse.show_pdbs_dict_metrics(disc_metrics, filename=output_file) 
def loop_weights(energies, weights, scales, offsets, dec1, inp_dir2, scoretype2, curr_weights, list_weight_discs):
    if len(curr_weights) == len(energies):
        dec2 = scorefileparse.read_dir(inp_dir2, scoretype2, list_energies=energies, weights=curr_weights, scales=scales, offsets=offsets)
        [dec_inter1, dec_inter2] = scorefileparse.pdbs_intersect([dec1, dec2])
        merged = scorefileparse.merge_pdbs_dicts([dec_inter1, dec_inter2])

        list_discs = discparse.pdbs_dict_to_metrics(merged)
        for ind, weight in enumerate(curr_weights):
            list_weight_discs[ind].append(weight)
        list_weight_discs[-1].append(list_discs)
        return 

    energies_ind = len(curr_weights)

    list_weights = weights[energies_ind]
    for w in list_weights:
        temp_weights = curr_weights[:]
        temp_weights.append(w)
        loop_weights(energies, weights, scales, offsets, dec1, inp_dir2, scoretype2, temp_weights, list_weight_discs)