| import gradio as gr |
| import os |
| import pyBigWig |
| from func_gradio import predict_func,make_plots |
|
|
| inputs = [ |
| gr.Radio(['Micro-C', 'Hi-C (ChIA-PET)'] |
| , label='Chromatin contact map type', info='One type of contact map is predicted for each time'), |
| gr.Dropdown([str(i) for i in range(1, 23)], label='Chromosome', default='1'), |
| gr.Number(label='Region of interest (500kb for Micro-C and 1Mb for Hi-C)', info='From'), |
| gr.Number(info='To', show_label=False), |
| gr.File(label='Processed ATAC-seq file (in .pickle format)'), |
|
|
| ] |
|
|
| outputs = [ |
| gr.Files(label='Download the results (upload the file in the "Visualize prediction results" interface for visualization)'), |
| ] |
|
|
| app1 = gr.Interface( |
| fn=predict_func, |
| inputs=inputs, |
| outputs=outputs, |
| title='A computational tool to use ATAC-seq to impute epigenome, transcriptome, and high-resolution chromatin contact maps', |
| 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">' |
| '<img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>' |
| '\n<a href="https://github.com/zzh24zzh/EPCOT_gradio" class="built-with svelte-1lyswbr" target="_blank" ' |
| 'style="font-size: 15px; font-color: black; font-weight:bold" rel="noreferrer">View Documentation </a>', |
| ) |
|
|
|
|
| with open(os.path.abspath('data/epigenomes.txt'), 'r') as f: |
| epis=f.read().splitlines() |
| inputs1 = [ |
| gr.File(label="Prediction file (in .npz format))"), |
| gr.Markdown(value='### Visualization options'), |
| gr.Dropdown(epis,label='Epigenome features',multiselect=True,max_choices=10,value=['CTCF','H3K4me3']), |
| gr.Radio(choices=['Signal p-values (archsinh)','Binding probability'], label='Type of epigenomic feature data' |
| , value='Signal p-values (archsinh)'), |
| gr.Slider(maximum=16,label='Range of values displayed on the plots',info="Choose between 0 and 16 (contact maps)",value=4), |
| gr.Slider(minimum=2,maximum=12,info="Choose between 2 and 12 (epigenomic feature signals)",value=4,show_label=False), |
| gr.Slider(minimum=2,maximum=12,info="Choose between 2 and 12 (CAGE-seq)",value=8,show_label=False), |
| ] |
| outputs1 = gr.Plot(label='Plots') |
| app2 = gr.Interface( |
| fn=make_plots, |
| inputs=inputs1, |
| outputs=outputs1, |
| live=True |
| ) |
|
|
| demo = gr.TabbedInterface([app1, app2], ["Run model", "Visualize prediction results"], |
| theme=gr.themes.Soft()) |
|
|
| demo.queue(concurrency_count=1,max_size=20).launch() |
|
|