mosses commited on
Commit
a39d163
1 Parent(s): 5f184e6

initial commit

Browse files
Files changed (1) hide show
  1. construct.py +49 -0
construct.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ######## GRADIO INPUT ########
2
+
3
+ import gradio as gr
4
+ from ConstructBuilder.builder import build
5
+ from Bio import SeqIO
6
+ import pandas as pd
7
+ import uuid
8
+ import os
9
+
10
+ def LabFusion(name, file , uni_seq , orientation:str="NC", gfp:bool=False, sol_tag:list=[]):
11
+ dick = {}
12
+ if file:
13
+ sequences = SeqIO.to_dict(SeqIO.parse(file.name, "fasta"))
14
+
15
+ for key in sequences:
16
+ seq = sequences[key]
17
+ dick[key] = build(str(seq.seq), sol_tag, gfp, orientation)
18
+ else:
19
+ dick[name] = build(uni_seq, sol_tag, gfp, orientation)
20
+ table = pd.DataFrame.from_dict(dick)
21
+
22
+ table.to_csv(f"/home/ubuntu/1TB_disk/constructos/gradio_projects/constructs_{name}.csv")
23
+ return table, f"/home/ubuntu/1TB_disk/constructos/gradio_projects/constructs_{name}.csv"
24
+
25
+
26
+ int_align = gr.Interface(fn=LabFusion,
27
+ inputs=[
28
+ gr.Textbox(label="Project name"),
29
+ gr.File(label="Insert a Fasta file"),
30
+ gr.Textbox(label="Insert a unique amino acid sequence"),
31
+ gr.Dropdown(choices=["N","C", "N+C"], label="Protein Orientarion"),
32
+ gr.Checkbox(value=False, label="do you want GFP in your constructs?"),
33
+ gr.CheckboxGroup(choices=['MBP', 'SUMO', 'Fh8', 'GST',
34
+ 'NusA', 'Thioredoxin', 'FLAG',
35
+ 'S-tag', 'CBP', 'STREPII', 'BAP', 'NT11',
36
+ 'Tab2', 'Z-basic', 'ProteinA', 'IMPACT',
37
+ 'mysB', 'PolyR', 'c-myc', 'S', 'SBP-tag',
38
+ 'Strep-tag', 'Twin-Strep-tag', 'HAT',
39
+ 'BCCP', 'HaloTag','all'], label="Solubility Tags")],
40
+ outputs=[gr.DataFrame(label = " Constructs ") ,
41
+ gr.File(label="CSV output file")],
42
+ title="ConstructMaker",
43
+ live=True
44
+ )
45
+
46
+ inter = gr.TabbedInterface([int_align],
47
+ ["LabFusion"])
48
+
49
+ inter.launch(share=True)