Onaedo/DNA_Mutation
0
1import gradio as gr2 3input1 = gr.components.Textbox(label = 'DNA Sequence:')4input2 = gr.components.Textbox(label = 'Motif')5output2 = gr.components.Textbox(label = 'Mutated Sequence')6 7dna2dna = {'A':'T', 'T':'A', 'C':'G', 'G':'C'}8def reverse_complement(dna):9 other = ''10 for base in dna:11 other = other + dna2dna[base]12 return other[ : :-1]13 14def mutate(dna, motif):15 j = dna.find(motif)16 if j == -1:17 return dna 18 k = dna.find(reverse_complement(motif), j+len(motif))19 if k == -1:20 return dna 21 return dna[:j] + dna[k+len(motif): ]22 23gr.Interface(fn=mutate,24 inputs = [input1, input2],25 outputs= [output2]26 ).launch()