drjieliu commited on
Commit
cbc0c70
1 Parent(s): b97cd60

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +57 -0
app.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ import pyBigWig
4
+ from func_gradio import predict_func,make_plots
5
+
6
+ inputs = [
7
+ gr.Dropdown([str(i) for i in range(1, 23)], label='Chromosome', default='1'),
8
+ gr.Dropdown(['Micro-C', 'Hi-C (ChIA-PET)']
9
+ , label='Chromatin contact map', info='One type of contact map is predicted for each time'),
10
+ gr.Number(label='Region of interest (500kb for Micro-C and 1Mb for Hi-C)', info='From'),
11
+ gr.Number(info='To', show_label=False),
12
+ gr.File(label='Processed ATAC-seq file (in .pickle format)'),
13
+
14
+ ]
15
+
16
+ outputs = [
17
+ gr.Files(label='Download the results'),
18
+ ]
19
+
20
+ app1 = gr.Interface(
21
+ fn=predict_func,
22
+ inputs=inputs,
23
+ outputs=outputs,
24
+ title='A computational tool to use ATAC-seq to impute epigenome, transcriptome, and high-resolution chromatin contact maps',
25
+ description= '<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/drjieliu/EPCOT?duplicate=true">'
26
+ '<img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>'
27
+ '\n<a href="https://github.com/zzh24zzh/EPCOT_gradio" class="built-with svelte-1lyswbr" target="_blank" '
28
+ 'style="font-size: 15px; font-color: black; font-weight:bold" rel="noreferrer">View Documentation </a>',
29
+ # examples=[["11","Micro-C","10500000","11000000","./examples/atac_GM12878.pickle"],
30
+ # ["11","Hi-C (ChIA-PET)","7750000","8750000","./examples/atac_GM12878.pickle"]]
31
+ )
32
+
33
+
34
+ with open(os.path.abspath('data/epigenomes.txt'), 'r') as f:
35
+ epis=f.read().splitlines()
36
+ inputs1 = [
37
+ gr.File(label="Prediction file (in .npz format))"),
38
+ gr.Markdown(value='### Visualization options'),
39
+ gr.Dropdown(epis,label='Epigenome features',multiselect=True,max_choices=10,value=['CTCF','H3K4me3']),
40
+ gr.Radio(choices=['Signal p-values (archsinh)','Binding probability'], label='Type of epigenomic feature data'
41
+ , value='Signal p-values (archsinh)'),
42
+ gr.Slider(maximum=16,label='Range of values displayed on the plots',info="Choose between 0 and 16 (contact maps)",value=4),
43
+ gr.Slider(minimum=2,maximum=12,info="Choose between 2 and 12 (epigenomic feature signals)",value=4,show_label=False),
44
+ gr.Slider(minimum=2,maximum=12,info="Choose between 2 and 12 (CAGE-seq)",value=8,show_label=False),
45
+ ]
46
+ outputs1 = gr.Plot(label='Plots')
47
+ app2 = gr.Interface(
48
+ fn=make_plots,
49
+ inputs=inputs1,
50
+ outputs=outputs1,
51
+ live=True
52
+ )
53
+
54
+ demo = gr.TabbedInterface([app1, app2], ["Run model", "Visualize prediction results"],
55
+ theme=gr.themes.Soft())
56
+
57
+ demo.launch(debug=True)