Exemple #1
0
def main(argv):
	args = get_args(argv)

	rec_dir, nrc_dir = args['recur_directory'], args['non_recur_directory']
	# rec_subdir_names, nrc_subdir_names = sorted(fm.get_subdir_names(rec_dir)), sorted(fm.get_subdir_names(nrc_dir))
	nrc_subdir_names = sorted(fm.get_subdir_names(nrc_dir))

	# rec_stats = _get_stats(rec_dir, rec_subdir_names)
	nrc_stats = _get_stats(nrc_dir, nrc_subdir_names)

	for key in nrc_stats:

		# rec_stat = rec_stats[key]
		nrc_stat = nrc_stats[key]

		printnow(key)
		# for group_name, stat in [ ('non-recurring', nrc_stat), ('recurring', rec_stat) ]:
		for group_name, stat in [ ('non-recurring', nrc_stat) ]:
			printnow('\t' + group_name + ':')
			printnow('\t\tmean:\t' + str(np.mean(stat)))
			printnow('\t\tstdev:\t' + str(np.std(stat)))
		printnow('')

	colors = ['#2ecc71', '#3498db', '#9b59b6']
	color = colors[2]

	for key in nrc_stats:
		parts = plt.violinplot(nrc_stats[key])
		# plt.violinplot(rec_stats[key], [2])
		if key == 'num_unique_clones':
			plt.ylabel('Number of Unique Clones')
		elif key == 'num_bps':
			plt.ylabel('Number of Breakpoints')
		elif key == 'diversities':
			plt.ylabel('Diversity')
		# plt.ylabel(key)
		# plt.legend([(1, 'non-recurring'), (2, 'recurring')])
		for pc in parts['bodies']:
			pc.set_facecolor(color)
			pc.set_edgecolor('black')
			pc.set_alpha(1)
		plt.tick_params(
	    axis='x',          # changes apply to the x-axis
	    which='both',      # both major and minor ticks are affected
	    bottom='off',      # ticks along the bottom edge are off
	    top='off',         # ticks along the top edge are off
	    labelbottom='off') # labels along the bottom edge are off
		plt.show()
Exemple #2
0
def main(argv):
    args = get_args(argv)
    fm.cp_file_structure_to_out_dir(args['input_directory'],
                                    args['output_directory'])
    subdir_names = fm.get_subdir_names(args['input_directory'])
    tusv.write_readme(args['output_directory'], args,
                      os.path.basename(__file__))

    CBs, CSs, Cs, Us, Ts, FUCs, objs, ls, rs = [], [], [], [], [], [], [], [], [
    ]  # scores for copy number of breakpoints, segments, usages and phylogeny
    for subdir_name in subdir_names:
        in_dir = args['input_directory'] + subdir_name
        out_dir = args['output_directory'] + subdir_name

        if not os.listdir(out_dir):  # empty directory
            pt.printnow('#\n' * 5 + '\nrunning ' + subdir_name + '\n\n' +
                        '#\n' * 5 + '\n')
            tusv.unmix(in_dir, out_dir, args['num_leaves'], args['c_max'],
                       args['lambda1'], args['lambda2'], args['restart_iters'],
                       args['cord_desc_iters'], args['processors'],
                       args['time_limit'], args['metadata_file'],
                       args['num_subsamples'], args['overide_lambdas'])
        else:
            pt.printnow('#\n' * 5 + '\n\nALREADY RAN ' + subdir_name + '\n\n' +
                        '#\n' * 5 + '\n')

        score_Cb, score_Cs, score_C, score_U, dist_T, score_FUC, obj_val, l, r = vd.get_scores(
            out_dir, in_dir)
        pt.printnow(' Cb: ' + str(score_Cb))
        pt.printnow(' Cs: ' + str(score_Cs))
        pt.printnow('  C: ' + str(score_C))
        pt.printnow('  U: ' + str(score_U))
        pt.printnow('  T: ' + str(dist_T))
        pt.printnow('FUC: ' + str(score_FUC))
        pt.printnow('obj: ' + str(obj_val))

        CBs.append(score_Cb)
        CSs.append(score_Cs)
        Cs.append(score_C)
        Us.append(score_U)
        Ts.append(dist_T)
        FUCs.append(score_FUC)
        objs.append(obj_val)
        ls.append(l)
        rs.append(r)

    report(args['input_directory'], args['output_directory'], CBs, CSs, Cs, Us,
           Ts, FUCs, objs, ls, rs, subdir_names)
Exemple #3
0
def main(argv):
    args = get_args(argv)

    in_dir, out_dir = args['input_directory'], args['output_directory']
    fm.cp_file_structure_to_out_dir(in_dir, out_dir)
    for subdir_name in sorted(fm.get_subdir_names(in_dir)):
        sub_in_dir = in_dir + subdir_name
        sub_out_dir = out_dir + subdir_name
        pt.printnow(''.join(['\n' for _ in range(0, 10)]))
        pt.printnow(' '.join(['=' for _ in range(0, 30)]))
        msg = 'Running: ' + subdir_name if not os.listdir(
            sub_out_dir) else 'ALREADY RAN: ' + subdir_name
        pt.printnow('\t' + msg)
        pt.printnow(' '.join(['=' for _ in range(0, 30)]))

        if not os.listdir(sub_out_dir):  # directory is empty
            tusv.unmix(sub_in_dir, sub_out_dir, args['num_leaves'],
                       args['c_max'], args['lambda1'], args['lambda2'],
                       args['restart_iters'], args['cord_desc_iters'],
                       args['processors'], args['time_limit'],
                       args['metadata_file'], args['num_subsamples'],
                       args['overide_lambdas'])