File size: 2,221 Bytes
a39d163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
06d9229
 
a39d163
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7162ecc
a39d163
 
 
 
 
7162ecc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
######## GRADIO INPUT ########

import gradio as gr
from ConstructBuilder.builder import build
from Bio import SeqIO
import pandas as pd
import uuid
import os

def LabFusion(name, file , uni_seq , orientation:str="NC", gfp:bool=False, sol_tag:list=[]):
    dick = {}
    if file:
        sequences = SeqIO.to_dict(SeqIO.parse(file.name, "fasta"))
        
        for key in sequences:
            seq = sequences[key]
            dick[key] = build(str(seq.seq), sol_tag, gfp, orientation) 
    else:
        dick[name] = build(uni_seq, sol_tag, gfp, orientation) 
    table = pd.DataFrame.from_dict(dick)
    
    table.to_csv(f"/tmp/constructs_{name}.csv")
    return table, f"/tmp/constructs_{name}.csv"


int_align = gr.Interface(fn=LabFusion,
                         inputs=[ 
                            gr.Textbox(label="Project name"),   
                            gr.File(label="Insert a Fasta file"),
                            gr.Textbox(label="Insert a unique amino acid sequence"),
                            gr.Dropdown(choices=["N","C", "N+C"], label="Protein Orientarion"),
                            gr.Checkbox(value=False, label="do you want GFP in your constructs?"),
                            gr.CheckboxGroup(choices=['MBP', 'SUMO', 'Fh8', 'GST',
                                                       'NusA', 'Thioredoxin', 'FLAG', 
                                                       'S-tag', 'CBP', 'STREPII', 'BAP', 'NT11',
                                                       'Tab2', 'Z-basic', 'ProteinA', 'IMPACT', 
                                                       'mysB', 'PolyR', 'c-myc', 'S', 'SBP-tag',
                                                       'Strep-tag', 'Twin-Strep-tag', 'HAT', 
                                                       'BCCP', 'HaloTag','all'], label="Solubility Tags")],
                            outputs=[gr.DataFrame(label = " Constructs ") ,
                                     gr.File(label="CSV output file")],
                            title="ConstructMaker",
                            #live=True
                        )

inter = gr.TabbedInterface([int_align],
                           ["LabFusion"])

inter.launch()