Example #1
0
    
    fig = plt.figure()
    plt.scatter(scores1, scores2, alpha=0.5)
    plt.plot([-1, 1], [-1, 1],'k--')
    plt.xlim(-1,1)
    plt.ylim(-1,1)
    ttl1 = r'Comparison of scores using {} vs. {}'.format(fitter1.shape,fitter2.shape)
    ttl2 = r'{}, {}'.format(data1.name, data1.pathway)
    plt.title('\n'.join([ttl1, ttl2]), fontsize=cfg.fontsize)
    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)
Example #2
0
        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)
Example #3
0
    if b_show:
        plt.show(block=True)

def do_gene_fits(data, gene, fitter, filename, b_show):
    fig = plot_gene(data,gene)
    if filename is None:
        ensure_dir(results_dir())
        filename = join(results_dir(), 'fit.png')
    print 'Saving figure to {}'.format(filename)
    save_figure(fig, filename)
    if b_show:
        plt.show(block=True)

if __name__ == '__main__':
    disable_all_warnings()   
    parser = get_common_parser(include_pathway=False)
    parser.add_argument('-g', '--gene', default='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)
    if args.nofit:
        fitter = None
    if args.region == 'all':
        do_gene_fits(data, args.gene, fitter,args.filename,args.show)
    else:
        series = data.get_one_series(args.gene,args.region)