if fitter is not None: theta, L, LOO_predictions,_ = fitter.fit(series.ages, series.expression, loo=loo) print 'L = {}'.format(L) fig = plot_series(series, fitter.shape, theta, LOO_predictions) else: 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()
ax.set_ylabel('width by bootstrap', fontsize=cfg.fontsize) ax.set_title('change distribution of single fit vs. bootstrap', fontsize=cfg.fontsize) return fig pathway = '17full' # 'serotonin' gene_regions = [ ('HTR1E', 'VFC'), ('HTR1A', 'MFC'), ] n_bins = 50 n_samples = 10 disable_all_warnings() cfg.verbosity = 1 age_scaler = LogScaler() data = GeneData.load('both').restrict_pathway(pathway).scale_ages(age_scaler) shape = Sigmoid(priors='sigmoid_wide') fitter = Fitter(shape, sigma_prior='normal') fits = get_all_fits(data, fitter, allow_new_computation=False) dirname = 'bootstrap' fits = add_change_distributions(data, fitter, fits, n_bins=n_bins) fig = plot_bootstrap_onset_variance(data, fits) save_figure(fig, '{}/onset-variance-{}.png'.format(dirname, pathway), under_results=True,