In [1]:
    
cd ..
    
    
In [2]:
    
import NotebookImport
from metaPCNA import *
    
    
    
    
    
In [4]:
    
switch_plot('FOXM1')
    
    
    
GABRD is the top hit for tumor-associated, proliferation independent genes.
In [5]:
    
f_win.order().tail()
    
    Out[5]:
In [6]:
    
switch_plot('GABRD')
    
    
    
In [7]:
    
gabra = [g for g in rna_df.index if g.startswith('GABRA')]
    
In [8]:
    
gab_s = rna_df.ix[gabra].sum()
    
In [9]:
    
cc = codes[codes.isin(ti(codes.value_counts() > 50))]
    
In [10]:
    
series_scatter(rna_df.ix['GABRD'][:,'11'].groupby(cc).mean(), 
                gab_s[:,'11'].groupby(cc).mean())
    
    
In [11]:
    
series_scatter(rna_df.ix['GABRD'][:,'01'].groupby(cc).mean(), 
                gab_s[:,'01'].groupby(cc).mean())
    
    
In [12]:
    
gabr = [g for g in rna_df.index if g.startswith('GABR')]
f = dx_rna.ix[gabr].dropna()
f.join(f_win).sort(f_win.name)
    
    Out[12]:
In [13]:
    
paired_boxplot_tumor_normal(matched_rna.ix[gabr].clip(-9,10).T, 
                            order=list(f.frac.order().index))
prettify_ax(plt.gca())
    
    
In [14]:
    
paired_boxplot_tumor_normal(matched_rna.ix[gabr, ti(codes.str.startswith('KIRC'))].clip(-9,10).T, 
                            order=list(f.frac.order().index), sig=False)
prettify_ax(plt.gca())
    
    
In [15]:
    
o = ['GABRA1','GABRA2', 'GABRA3', 'GABRA4', 'GABRA5',
     'GABRB1', 'GABRB2', 'GABRB3',
     'GABRR1', 'GABRR2', 'GABRR3',
     'GABRD','GABRE','GABRP','GABRQ']
    
In [16]:
    
fig = plt.figure(figsize=(15, 7.5))
ax1 = plt.subplot2grid((5, 7), (0, 0), colspan=2, rowspan=3)
ax2 = plt.subplot2grid((5, 7), (0, 2), colspan=5, rowspan=3)
ax3 = plt.subplot2grid((5, 7), (3, 0), colspan=7, rowspan=2)
ax = ax1
cc = pd.Series(matched_tn.columns.get_level_values(1), 
               matched_tn.columns).map({'01': colors[0],
                                        '11': colors[1]})
series_scatter(meta_pcna_all, matched_tn.ix['GABRD'], zorder=1,
               ax=ax, ann=None, s=20, edgecolor='grey', linewidths=1,
               alpha=.6, color=cc)
line_args = {'lw':5, 'solid_capstyle':'round'}
l1, l2 = process_line_args(line_args)
x,y = meta_pcna_all[:,'01'], matched_tn.ix['GABRD'][:,'01']
reg = linear_regression(x,y)
line_me(reg['slope'], reg['intercept'], start=x.min(), end=x.max(),
            ax=ax, **l1)
x,y = meta_pcna_all[:,'11'], matched_tn.ix['GABRD'][:,'11']
reg = linear_regression(x,y)
line_me(reg['slope'], reg['intercept'], start=x.min(), end=x.max(),
            ax=ax, **l1)
ax1.legend(['Tumor','Normal'], loc='upper left', scatterpoints=1, markerscale=1.5,
          fancybox=True)
ax1.set_xlabel('Proliferation Score')
prettify_ax(ax1)
paired_bp_tn_split(matched_rna.ix['GABRD'], codes, ax=ax2)
ax2.set_ylabel('')
ax1.set_ylabel('GABRD mRNA Expression')
paired_boxplot_tumor_normal(matched_rna.ix[gabr, ti(codes.str.startswith('KIRC'))].clip(-9,10).T, 
                            order=o, sig=False, ax=ax3)
prettify_ax(ax3)
ax3.get_legend().set_visible(False)
ax3.set_ylabel('mRNA Expression')
fig.tight_layout()
fig.savefig(FIGDIR + 'GABA_F4.pdf')
    
    
In [17]:
    
fig = plt.figure(figsize=(15, 7.5))
ax1 = plt.subplot2grid((5, 7), (0, 0), colspan=2, rowspan=3)
ax2 = plt.subplot2grid((5, 7), (0, 2), colspan=5, rowspan=3)
ax3 = plt.subplot2grid((5, 7), (3, 0), colspan=7, rowspan=2)
series_scatter(meta_pcna_all[:,'01'], matched_tn.ix['GABRD'][:,'01'], ax=ax1,
               ann=None, s=20, edgecolor='grey', linewidths=1, 
               alpha=.8, color=colors[0])
series_scatter(meta_pcna_all[:,'11'], matched_tn.ix['GABRD'][:,'11'], 
               ax=ax1, ann=None, s=20, edgecolor='grey', linewidths=1,
               alpha=.8, color=colors[1])
ax1.legend(['Tumor','Normal'], loc='upper left', scatterpoints=1, markerscale=1.5,
          fancybox=True)
ax1.set_xlabel('Proliferation Score')
prettify_ax(ax1)
paired_bp_tn_split(matched_rna.ix['GABRD'], codes, ax=ax2)
ax2.set_ylabel('')
ax1.set_ylabel('GABRD mRNA Expression')
paired_boxplot_tumor_normal(matched_rna.ix[gabr, ti(codes.str.startswith('KIRC'))].clip(-9,10).T, 
                            order=o, sig=False, ax=ax3)
prettify_ax(ax3)
ax3.get_legend().set_visible(False)
ax3.set_ylabel('mRNA Expression')
fig.tight_layout()
fig.savefig(FIGDIR + 'GABA_F4.pdf')
    
    
In [18]:
    
cc = codes.ix[matched_tn.columns.get_level_values(0)].value_counts()
cc
    
    Out[18]:
In [21]:
    
fig, axs = subplots(7,1, figsize=(12,15), sharex=True)
letters = list(map(chr, range(97, 123)))
for i,c in enumerate(ti(cc > 99)):
    paired_boxplot_tumor_normal(matched_rna.ix[gabr, ti(codes == c)].clip(-9,10).T, 
                                order=o, sig=False, ax=axs[i])
    axs[i].set_ylabel(c + '\nmRNA expression')
for ax in axs:
    prettify_ax(ax)
    ax.get_legend().set_visible(False)
    prettify_ax(ax)
fig.tight_layout()
fig.savefig(FIGDIR + 'S5_Fig.pdf')
    
    
In [ ]: