<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Fraction upregulated screen
Import everything from the imports notebook. This reads in all of the expression data as well as the functions needed to analyse differential expression data.
Step1:  matched_meth is our matched methylation data.
Step2:  Read in matched Gene and miRNA expression data.
Step3:  Run a simple screen for DX genes
Here we take the matched data and run a basic screen
fc = 1 means that we have no foldchange buffer for a gene to be considered over or underexpressed in a patient 
If there are ties or missing data, I omit these from the test.  This can cause underpowered tests which have extreme test statistics but weak p-values.  For this reason I filter all gene/probes/markers with a sample size of less than 300 patients.
Step4:  Not only is ADH1B the most downregulated gene, but many of the other genes in the ADH familly have large effects as well. I go into this with a bit more depth in the alcohol_metabolism Notebook.
Step5:  MicroRNA Screen
Step6:  Methylation Screen
Step7:  Plot disributions of fraction upregulated statistic
We are going to want to reuse this plot so here I'm wrapping it in a function.
<ASSISTANT_TASK:>
Python Code:
import NotebookImport
from Imports import *
Explanation: Fraction upregulated screen
Import everything from the imports notebook. This reads in all of the expression data as well as the functions needed to analyse differential expression data.
End of explanation
matched_meth = pd.read_hdf(METH_STORE, 'matched_tn')
matched_meth = matched_meth.groupby(axis=1, level=[0,1]).first()
matched_meth.T.head(10).T.head()
matched_meth.shape[1] / 2
Explanation: matched_meth is our matched methylation data.
End of explanation
matched_rna = matched_tn
matched_mir = pd.read_hdf(MIRNA_STORE, 'matched_tn')
Explanation: Read in matched Gene and miRNA expression data.
End of explanation
dx_rna = binomial_test_screen(matched_rna, fc=1.)
dx_rna = dx_rna[dx_rna.num_dx > 300]
dx_rna.sort('p').head(10)
dx_rna.ix['FOXM1']
Explanation: Run a simple screen for DX genes
Here we take the matched data and run a basic screen
fc = 1 means that we have no foldchange buffer for a gene to be considered over or underexpressed in a patient 
If there are ties or missing data, I omit these from the test.  This can cause underpowered tests which have extreme test statistics but weak p-values.  For this reason I filter all gene/probes/markers with a sample size of less than 300 patients.
End of explanation
#Do not import
fig, ax = subplots(figsize=(7.75,2.5))
paired_bp_tn_split(matched_rna.ix['ADH1B'], codes, data_type='mRNA',
                   ax=ax)
fig.tight_layout()
dx_rna.ix[['ADH1A','ADH1B','ADH1C']]
dx_rna.p.rank().ix[['ADH1A','ADH1B','ADH1C']]
Explanation: Not only is ADH1B the most downregulated gene, but many of the other genes in the ADH familly have large effects as well. I go into this with a bit more depth in the alcohol_metabolism Notebook.
End of explanation
dx_mir = binomial_test_screen(matched_mir, fc=1.)
dx_mir = dx_mir[dx_mir.num_dx > 300]
dx_mir.sort('p').head()
#Do not import
fig, ax = subplots(figsize=(6.5,2.5))
paired_bp_tn_split(matched_mir.ix['hsa-mir-21'], codes, data_type='',
                   ax=ax)
fig.tight_layout()
#Do not import
paired_bp_tn_split(matched_mir.ix['hsa-mir-139'], codes, data_type='')
Explanation: MicroRNA Screen
End of explanation
dx_meth = binomial_test_screen(matched_meth, fc=1.)
dx_meth = dx_meth[dx_meth.num_dx > 300]
dx_meth.sort('p').head()
#Do not import
paired_bp_tn_split(matched_meth.ix['cg10216717'], codes, data_type='Beta')
Explanation: Methylation Screen
End of explanation
def fig_1e(ax):
    draw_dist(dx_meth.frac, ax=ax, lw=2.5)
    draw_dist(dx_rna.frac, ax=ax, lw=2.5, bins=200)
    draw_dist(dx_mir.frac, ax=ax, lw=2.5, bins=100)
    ax.set_yticks([])
    ax.set_xticks([0,.5,1])
    ax.set_ylabel('Density')
    ax.set_xlabel('Fraction')
    ax.legend(('Methylation','mRNA','miRNA'), frameon=False)
    prettify_ax(ax)
    return ax
#Do not import
fig, ax = subplots(1,1, figsize=(5,3))
fig_1e(ax);
Explanation: Plot disributions of fraction upregulated statistic
We are going to want to reuse this plot so here I'm wrapping it in a function.
End of explanation
<END_TASK>