Beispiel #1
0
def get_common_parser(include_pathway=True):
    parser = MyParser(fromfile_prefix_chars='@')
    group = parser.add_mutually_exclusive_group()
    group.add_argument("-v",
                       "--verbose",
                       action="count",
                       default=0,
                       help="increase output verbosity")
    group.add_argument("-q",
                       "--quiet",
                       action="count",
                       default=0,
                       help="decrease output verbosity")
    parser.add_argument('--dataset',
                        default='both',
                        help='Default: both',
                        choices=known_datasets)
    if include_pathway:
        parser.add_argument('--pathway',
                            default='serotonin',
                            help='Default: serotonin'
                            )  #, choices=['all'] + cfg.pathways.keys())
    parser.add_argument(
        '--from_age',
        help=
        'Use only data points with larger ages than this. Default: all ages',
        choices=dct_ages.keys())
    parser.add_argument('--scaling',
                        help='What scaling to use for ages. Default: log',
                        default='log',
                        choices=allowed_scaler_names())
    parser.add_argument('--shuffle',
                        help='Shuffle the y-values of the data',
                        action='store_true')
    parser.add_argument('-s',
                        '--shape',
                        help='The shape to use for fitting. Default: sigslope',
                        default='sigslope',
                        choices=allowed_shape_names())
    parser.add_argument(
        '--sigma_prior',
        help='Prior to use for 1/sigma when fitting. Default: normal',
        default='normal',
        choices=get_allowed_priors(is_sigma=True))
    parser.add_argument(
        '--priors',
        help='Priors to use for theta when fitting. Default: sigslope80',
        default='sigslope80',
        choices=get_allowed_priors())
    return parser
Beispiel #2
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)

    print_diff_points(data1,fitter1,fits1, data2,fitter2,fits2, args.ndiffs)
Beispiel #3
0
def get_common_parser(include_pathway=True):
    parser = MyParser(fromfile_prefix_chars='@')
    group = parser.add_mutually_exclusive_group()
    group.add_argument("-v", "--verbose", action="count", default=0, help="increase output verbosity")    
    group.add_argument("-q", "--quiet", action="count", default=0, help="decrease output verbosity")    
    parser.add_argument('--dataset', default='both', help='Default: both', choices=known_datasets)  
    if include_pathway:
        parser.add_argument('--pathway', default='serotonin', help='Default: serotonin') #, choices=['all'] + cfg.pathways.keys())
    parser.add_argument('--from_age', help='Use only data points with larger ages than this. Default: all ages', choices=dct_ages.keys())
    parser.add_argument('--scaling', help='What scaling to use for ages. Default: none', default='none', choices=allowed_scaler_names())
    parser.add_argument('--shuffle', help='Shuffle the y-values of the data', action='store_true')
    parser.add_argument('-s', '--shape', help='The shape to use for fitting. Default: sigslope', default='sigslope', choices=allowed_shape_names())
    parser.add_argument('--sigma_prior', help='Prior to use for 1/sigma when fitting. Default: None', choices=get_allowed_priors(is_sigma=True))
    parser.add_argument('--priors', help='Priors to use for theta when fitting. Default: None', choices=get_allowed_priors())
    return parser