CoolFace
Apppublic

jhofer4/Lab6_GC_content

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py41 linesDownload Raw Back to root
1 2import gradio as gr3 4def calculate_GC(DNA):5    n_G = DNA.count('G')6    n_C = DNA.count('C')7    n_A = DNA.count('A')8    n_T = DNA.count('T')9    GC_content = (n_G+n_C)/(n_G+n_C+n_A+n_T) * 10010 11    total_count = n_G+n_C+n_A+n_T12 13    return total_count,n_A, n_T, n_G, n_C, GC_content14 15 16 17 18## configure inputs/outputs19 20input_module = gr.inputs.Textbox(label = "Enter your DNA sequence in the box:")21 22set_out1 = gr.outputs.Textbox(label = "Total count, all bases:")23set_out2 = gr.outputs.Textbox(label = "Adenine (A) count:")24set_out3 = gr.outputs.Textbox(label = "Thymine (T) count:")25set_out4 = gr.outputs.Textbox(label = "Guanine (G) count:")26set_out5 = gr.outputs.Textbox(label = "Cytosine (C) count:")27set_out6 = gr.outputs.Textbox(label = "%G~C content:")28 29 30 31 32### configure gradio, detailed can be found at https://www.gradio.app/docs/#i_slider33interface = gr.Interface(fn=calculate_GC, 34                         inputs=input_module, 35                         outputs=[set_out1,set_out2,set_out3,set_out4,set_out5,set_out6],36                         title="CSCI1020 Demo 1: Web Application for Genomics %G~C Content Calculator", 37                         description= "Click examples below for a quick demo",38                         theme = 'huggingface',39                         layout = 'vertical'40                         )41interface.launch()