Ejemplo n.º 1
0
def do_stats(path, smoothstr, expmean, ctrlmean, expstd, ctrlstd, expn, ctrln,
             df2):
    exp_genotype = 'OK371shib'
    ctrl_genotype = 'wshib'

    df2 = add_obj_id(df2)
    df2['t'] = df2['align'] - 10
    df2 = df2[df2['t'] <= 40]

    expdf = df2[df2['Genotype'] == exp_genotype]
    ctrldf = df2[df2['Genotype'] == ctrl_genotype]

    data = {
        'OK371>ShiTs': dict(df=expdf),
        'controls': dict(df=ctrldf),
    }
    names = ['OK371>ShiTs', 'controls']

    num_bins = 40
    fname_prefix = flymad_plot.get_plotpath(
        path, 'OK371_pvalues_%d_bins' % (num_bins, ))
    madplot.view_pairwise_stats_plotly(
        data,
        names,
        fname_prefix,
        align_colname='align',
        stat_colname='v',
        num_bins=num_bins,
    )
Ejemplo n.º 2
0
def do_stats(path,data,d1_arena,note):

    datasets = {}
    laser_powers = set()
    for gt in data:
        laser_powers_sorted = sorted(data[gt], cmp=flymad_analysis.cmp_laser, reverse=True)
        for order,laser in enumerate(laser_powers_sorted):
            laser_powers.add( laser )
            gtdf = data[gt][laser][gt]
            fake_gt_name = '%s-%s'%(gt,laser)
            datasets[fake_gt_name] = gtdf

    # do the stats
    stat_info = [
        ('trp_basic_control1', ['50660trp-350iru','50660-350iru']),
        ('trp_basic_control2', ['50660trp-350iru','wtrp-350iru']),
        ('trp_basic_pooled_controls', ['50660trp-350iru','my_pooled_controls-350iru']),

        ('chrimson_crosstalk_controls', ['50660chrim-350iru','50660-350iru']),
        ('chrimson_crosstalk_activation_low_1', ['50660chrim-350iru','50660chrim-028ru']),
        ('chrimson_crosstalk_activation_low_2', ['50660-350iru','50660chrim-028ru']),
        ('chrimson_activation_high', ['50660-350ru','50660chrim-028ru']),

        ('trp_crosstalk_activation_low', ['50660trp-183iru','50660trp-350ru']),
        ('trp_activation_high', ['50660trp-183iru','50660trp-434iru']),
        ]
    gt_names = {'50660':'Gal4-control',
                'wtrp':'UAS-control',
                'my_pooled_controls':'controls',
                '50660chrim':'MW>Chrim',
                '50660trp':'MW>TrpA1',
                }
    human_label_dict = {}
    for laser in laser_powers:
        laser_human = flymad_analysis.laser_desc(laser)
        assert laser_human != laser
        for gt in ['50660','50660chrim','50660trp','wtrp','my_pooled_controls']:
            gt_human = gt_names[gt]
            assert gt_human != gt
            key = '%s-%s'%(gt,laser)
            value = '%s %s'%(gt_human,laser_human)
            human_label_dict[key] = value

    pooldf = pd.concat([datasets['wtrp-350iru']['df'],datasets['50660-350iru']['df']])
    datasets['my_pooled_controls-350iru'] = dict(df=pooldf)

    num_bins = [40]
    for num_bin in num_bins:
        for experiment_name, exp_gts in stat_info:
            fname_prefix = flymad_plot.get_plotpath(path,'moonwalker_stats_%s_%d_bins'%(experiment_name,num_bin))
            madplot.view_pairwise_stats_plotly(datasets, exp_gts, fname_prefix,
                                               align_colname='t',
                                               stat_colname='Vfwd',
                                               layout_title='p-values',
                                               num_bins=num_bin,
                                               human_label_dict=human_label_dict,
                                               )
Ejemplo n.º 3
0
def do_stats(path, smoothstr, expmean, ctrlmean, expstd, ctrlstd, expn, ctrln, df2):
    exp_genotype = 'OK371shib'
    ctrl_genotype = 'wshib'

    df2 = add_obj_id(df2)
    df2['t'] = df2['align']-10
    df2 = df2[ df2['t'] <= 40 ]

    expdf = df2[df2['Genotype'] == exp_genotype]
    ctrldf = df2[df2['Genotype']== ctrl_genotype]

    data={
        'OK371>ShiTs':dict(df=expdf),
        'controls':dict(df=ctrldf),
        }
    names=['OK371>ShiTs','controls']

    num_bins=40
    fname_prefix = flymad_plot.get_plotpath(path,'OK371_pvalues_%d_bins'%(num_bins,))
    madplot.view_pairwise_stats_plotly( data, names, fname_prefix,
                                        align_colname='align',
                                        stat_colname='v',
                                        num_bins=num_bins,
                                        )
Ejemplo n.º 4
0
    arena = madplot.Arena('mm')

    note = "%s %s\n%r\nmedfilt %s" % (arena.unit, smoothstr, arena, medfilt)

    cache_fname = os.path.join(os.path.dirname(path), 'speed.madplot-cache')
    cache_args = ([os.path.basename(b) for b in bags], smoothstr, args.smooth,
                  medfilt, genotypes, args.min_experiment_duration)
    data = None
    if args.only_plot:
        data = madplot.load_bagfile_cache(cache_args, cache_fname)
    if data is None:
        data = prepare_data(bags, arena, smoothstr, args.smooth, medfilt,
                            genotypes, args.min_experiment_duration)
        madplot.save_bagfile_cache(data, cache_args, cache_fname)

    if args.stats:
        fname_prefix = flymad_plot.get_plotpath(path, 'csv_speed')
        madplot.view_pairwise_stats_plotly(
            data,
            genotypes,
            fname_prefix,
            align_colname='t',
            stat_colname='v',
        )

    plot_data(path, data, arena, note)

    if args.show:
        plt.show()
Ejemplo n.º 5
0
def do_stats(path, data, d1_arena, note):

    datasets = {}
    laser_powers = set()
    for gt in data:
        laser_powers_sorted = sorted(data[gt],
                                     cmp=flymad_analysis.cmp_laser,
                                     reverse=True)
        for order, laser in enumerate(laser_powers_sorted):
            laser_powers.add(laser)
            gtdf = data[gt][laser][gt]
            fake_gt_name = '%s-%s' % (gt, laser)
            datasets[fake_gt_name] = gtdf

    # do the stats
    stat_info = [
        ('trp_basic_control1', ['50660trp-350iru', '50660-350iru']),
        ('trp_basic_control2', ['50660trp-350iru', 'wtrp-350iru']),
        ('trp_basic_pooled_controls',
         ['50660trp-350iru', 'my_pooled_controls-350iru']),
        ('chrimson_crosstalk_controls', ['50660chrim-350iru', '50660-350iru']),
        ('chrimson_crosstalk_activation_low_1',
         ['50660chrim-350iru', '50660chrim-028ru']),
        ('chrimson_crosstalk_activation_low_2',
         ['50660-350iru', '50660chrim-028ru']),
        ('chrimson_activation_high', ['50660-350ru', '50660chrim-028ru']),
        ('trp_crosstalk_activation_low', ['50660trp-183iru',
                                          '50660trp-350ru']),
        ('trp_activation_high', ['50660trp-183iru', '50660trp-434iru']),
    ]
    gt_names = {
        '50660': 'Gal4-control',
        'wtrp': 'UAS-control',
        'my_pooled_controls': 'controls',
        '50660chrim': 'MW>Chrim',
        '50660trp': 'MW>TrpA1',
    }
    human_label_dict = {}
    for laser in laser_powers:
        laser_human = flymad_analysis.laser_desc(laser)
        assert laser_human != laser
        for gt in [
                '50660', '50660chrim', '50660trp', 'wtrp', 'my_pooled_controls'
        ]:
            gt_human = gt_names[gt]
            assert gt_human != gt
            key = '%s-%s' % (gt, laser)
            value = '%s %s' % (gt_human, laser_human)
            human_label_dict[key] = value

    pooldf = pd.concat(
        [datasets['wtrp-350iru']['df'], datasets['50660-350iru']['df']])
    datasets['my_pooled_controls-350iru'] = dict(df=pooldf)

    num_bins = [40]
    for num_bin in num_bins:
        for experiment_name, exp_gts in stat_info:
            fname_prefix = flymad_plot.get_plotpath(
                path,
                'moonwalker_stats_%s_%d_bins' % (experiment_name, num_bin))
            madplot.view_pairwise_stats_plotly(
                datasets,
                exp_gts,
                fname_prefix,
                align_colname='t',
                stat_colname='Vfwd',
                layout_title='p-values',
                num_bins=num_bin,
                human_label_dict=human_label_dict,
            )
Ejemplo n.º 6
0
    medfilt = args.median_filter
    smoothstr = '%s' % {True:'smooth',False:'nosmooth'}[args.smooth]

    arena = madplot.Arena('mm')

    note = "%s %s\n%r\nmedfilt %s" % (arena.unit, smoothstr, arena, medfilt)

    cache_fname = os.path.join(os.path.dirname(path),'speed.madplot-cache')
    cache_args = ([os.path.basename(b) for b in bags], smoothstr, args.smooth, medfilt, genotypes, args.min_experiment_duration)
    data = None
    if args.only_plot:
        data = madplot.load_bagfile_cache(cache_args, cache_fname)
    if data is None:
        data = prepare_data(bags, arena, smoothstr, args.smooth, medfilt, genotypes, args.min_experiment_duration)
        madplot.save_bagfile_cache(data, cache_args, cache_fname)

    if args.stats:
        fname_prefix = flymad_plot.get_plotpath(path,'csv_speed')
        madplot.view_pairwise_stats_plotly(data, genotypes,
                                           fname_prefix,
                                           align_colname='t',
                                           stat_colname='v',
                                           )

    plot_data(path, data, arena, note)

    if args.show:
        plt.show()

Ejemplo n.º 7
0
    calibration_file = os.path.join(args.calibration_dir, CALIBRATION_FILE)
    arena = madplot.Arena(
                'mm',
                **flymad_analysis.get_arena_conf(calibration_file=calibration_file))

    note = "%s %s\n%r\nmedfilt %s" % (arena.unit, smoothstr, arena, medfilt)

    cache_fname = os.path.join(path,'speed.madplot-cache')
    cache_args = (path, arena, smoothstr, args.smooth, medfilt, GENOTYPES)
    data = None
    if args.only_plot:
        data = madplot.load_bagfile_cache(cache_args, cache_fname)
    if data is None:
        data = prepare_data(path, arena, smoothstr, args.smooth, medfilt, GENOTYPES)
        madplot.save_bagfile_cache(data, cache_args, cache_fname)

    fname_prefix = flymad_plot.get_plotpath(path,'csv_speed')
    madplot.view_pairwise_stats_plotly(data, [EXP_GENOTYPE,
                                             CTRL_GENOTYPE,
                                             EXP2_GENOTYPE],
                                       fname_prefix,
                                       align_colname='t',
                                       stat_colname='v',
                                       )
    plot_data(path, data, arena, note)

    if args.show:
        plt.show()

Ejemplo n.º 8
0
    calibration_file = os.path.join(args.calibration_dir, CALIBRATION_FILE)
    arena = madplot.Arena(
        'mm',
        **flymad_analysis.get_arena_conf(calibration_file=calibration_file))

    note = "%s %s\n%r\nmedfilt %s" % (arena.unit, smoothstr, arena, medfilt)

    cache_fname = os.path.join(path, 'speed.madplot-cache')
    cache_args = (path, arena, smoothstr, args.smooth, medfilt, GENOTYPES)
    data = None
    if args.only_plot:
        data = madplot.load_bagfile_cache(cache_args, cache_fname)
    if data is None:
        data = prepare_data(path, arena, smoothstr, args.smooth, medfilt,
                            GENOTYPES)
        madplot.save_bagfile_cache(data, cache_args, cache_fname)

    fname_prefix = flymad_plot.get_plotpath(path, 'csv_speed')
    madplot.view_pairwise_stats_plotly(
        data,
        [EXP_GENOTYPE, CTRL_GENOTYPE, EXP2_GENOTYPE],
        fname_prefix,
        align_colname='t',
        stat_colname='v',
    )
    plot_data(path, data, arena, note)

    if args.show:
        plt.show()