Exemplo n.º 1
0
         kla_only_no_p65 = sum((gr_group['gr_dex_tag_count'] <= min_tags) &
                                  (gr_group['gr_kla_dex_tag_count'] > min_tags) &
                                  (gr_group['p65_kla_tag_count'] + gr_group['p65_kla_dex_tag_count'] <= min_tags)
                          )
         counts = [tethered, direct_comp_gr, indirect_comp_gr, 
                        direct_comp_p65, cobound,
                        direct_novel, indirect_novel,
                        in_dex_no_p65, kla_only_no_p65]
     else: counts = [0]*9
     
     stats = stats + counts
     all_stats.append(dict(zip(labels, stats))), index.append(group.name)
 
 grouped.apply(count_enhancers)
 # There must be a better way to do this group-apply, but I can't make it turn back into a DF...
 enhancer_counts = DataFrame(all_stats, index=index)
 
 spaced_labels = ['\n'.join(map(' '.join,
                        [l.split()[i:i+2] for i in xrange(0,len(l.split()),2)] )) 
                        for l in labels]
 erna_title = 'Enhancers per Gene by enhancer subtype {0}'.format(name)
 ax = yzer.boxplot([enhancer_counts[col] for col in labels], spaced_labels, 
                  title=erna_title, 
                  xlabel='Subset', 
                  ylabel='Count', 
                  show_outliers=False, show_plot=False, wide=True
                  )
 yzer.ylim(ax, -1, 2)
 pyplot.setp(ax.get_xticklabels(), fontsize=10)
 yzer.save_plot(yzer.get_filename(img_dirpath, erna_title + '.png'))
 yzer.show_plot()
Exemplo n.º 2
0
                counts,
                labels,
                title='Enhancer-like Subsets {0} with GR\nby Putative Mechanism'
                .format(name.title()),
                small_legend=True,
                save_dir=img_dirpath,
                show_plot=True)

        enh_change = [d['dex_over_kla_1_lfc'] for d in [data, dataset] + sets]
        change_labels = ['All Enhancer-like', 'All {0}'.format(name)] + labels
        change_labels = [
            '\n'.join(
                map(' '.join,
                    [l.split()[i:i + 2]
                     for i in xrange(0, len(l.split()), 2)]))
            for l in change_labels
        ]
        erna_title = 'eRNA Change by enhancer subtype {0}- KLA+Dex versus KLA'.format(
            name)
        ax = yzer.boxplot(enh_change,
                          change_labels,
                          title=erna_title,
                          xlabel='Subset',
                          ylabel='log2(KLA+Dex GRO-seq/KLA GRO-seq)',
                          show_outliers=False,
                          show_plot=False,
                          wide=True)
        yzer.ylim(ax, -4, 2)
        pyplot.setp(ax.get_xticklabels(), fontsize=10)
        yzer.save_plot(yzer.get_filename(img_dirpath, erna_title + '.png'))
        yzer.show_plot()
Exemplo n.º 3
0
                ctl_y,
                'o-',
                color='black',
                label='Control (n=8)',
                linewidth=8)
    pyplot.plot(low_x,
                low_y,
                'o-',
                color='blue',
                label='Low Dose TDB (107 ug, n=4)',
                linewidth=6)
    pyplot.plot(med_x,
                med_y,
                'o--',
                color='green',
                label='Medium Dose TDB (214 ug, n=4)',
                linewidth=6)
    pyplot.plot(high_x,
                high_y,
                'o--',
                color='red',
                label='High Dose TDB (321 ug, n=4)',
                linewidth=4)

    pyplot.legend(loc='lower left')
    pyplot.xticks(x_vals, x_labels)
    yzer.ylim(ax, 0, 100)
    yzer.xlim(ax, 0, max(x_vals))
    yzer.save_plot_with_dir(img_dirpath, None, title)
    yzer.show_plot()