plt.xlabel('R2 for {}'.format(fitter1.shape), fontsize=cfg.fontsize) plt.ylabel('R2 for {}'.format(fitter2.shape), fontsize=cfg.fontsize) return fig if __name__ == '__main__': disable_all_warnings() parser = get_common_parser() parser.add_argument('--shape2', required=True, help='The shape to compare against', choices=allowed_shape_names()) parser.add_argument('--scaling2', help='The scaling used when fitting shape2. Default: none', choices=allowed_scaler_names()) parser.add_argument('--sigma_prior2', help='Prior to use for 1/sigma when fitting shape2. Default: None', choices=get_allowed_priors(is_sigma=True)) parser.add_argument('--priors2', help='The priors used for theta when fitting shape2. Default: None', choices=get_allowed_priors()) parser.add_argument('--filename', help='Where to save the figure. Default: results/comparison.png') parser.add_argument('--show', help='Show figure and wait before exiting', action='store_true') parser.add_argument('--ndiffs', type=int, default=5, help='Number of top diffs to show. Default=5.') args = parser.parse_args() data1, fitter1 = process_common_inputs(args) data2 = get_data_from_args(args.dataset, args.pathway, args.from_age, args.scaling2, args.shuffle) fitter2 = get_fitter_from_args(args.shape2, args.priors2, args.sigma_prior2) fits1 = get_all_fits(data1,fitter1) fits2 = get_all_fits(data2,fitter2) print_diff_points(data1,fitter1,fits1, data2,fitter2,fits2, args.ndiffs) fig = plot_comparison_scatter(data1,fitter1,fits1, data2,fitter2,fits2) filename = args.filename if filename is None: ensure_dir(results_dir()) filename = join(results_dir(), 'shape_comparison.png') save_figure(fig, filename)
fig = plot_series(series) if filename is None: ensure_dir(results_dir()) filename = join(results_dir(), 'fits.png') print 'Saving figure to {}'.format(filename) save_figure(fig, filename) if b_show: plt.show(block=True) if __name__ == '__main__': disable_all_warnings() cfg.fontsize = 18 cfg.xtick_fontsize = 18 cfg.ytick_fontsize = 18 parser = get_common_parser(include_pathway=False) parser.add_argument('-g', '--genes', default='HTR1A HTR1E') parser.add_argument('-r', '--region', default='VFC') group = parser.add_mutually_exclusive_group() group.add_argument('--loo', help='Show LOO predictions', action='store_true') group.add_argument('--nofit', help='Only show the data points', action='store_true') parser.add_argument('--filename', help='Where to save the figure. Default: results/fit.png') parser.add_argument('--show', help='Show figure and wait before exiting', action='store_true') args = parser.parse_args() data, fitter = process_common_inputs(args) genes = args.genes.split() if args.nofit: fitter = None series = data.get_several_series(genes,args.region) fit_serveral_genes(series, fitter, args.loo, args.filename, args.show)
abort('--correlations_part cannot should not used with --html') if args.onset and not is_sigmoid: abort('--onset can only be used with sigmoid fits') if args.change_dist and not is_sigmoid: abort('--change_dist can only be used with sigmoid fits') if args.onset and args.html == NOT_USED: abort('--onset should only be used with --html') if args.text and args.shape != 'spline': abort('--text only supported for splines at the moment') if (args.exons_layout or args.exons_same_scale or args.exons_plots_from_series) and args.html == NOT_USED: abort('exons settings are relevant only when using --html') if (args.exons_same_scale or args.plots_scaling is not 'none') and args.exons_plots_from_series: abort('--exons_same_scale/--plots_scaling are relevant only when not using --exons_plots_from_series') k_of_n = parse_k_of_n(args.part) correlations_k_of_n = parse_k_of_n(args.correlations_part) data, fitter = process_common_inputs(args) fits = do_fits(data, fitter, k_of_n, args.correlations, correlations_k_of_n) has_change_distributions = is_sigmoid if has_change_distributions: print 'Computing change distributions...' add_change_distributions(data, fitter, fits) if args.change_dist: print 'Computing region pair timing measures...' compute_dprime_measures_for_all_pairs(data, fitter, fits) export_timing_info_for_all_fits(data, fitter, fits) if args.html != NOT_USED: if args.correlations: correlations = {r: rfits[-1].correlations for r,rfits in iterate_region_fits(data, fits)} else: correlations = None exons_layout = args.exons_layout and cfg.exon_level