constructMaker / test.py
mosses's picture
Create new file
86701b9
raw
history blame contribute delete
No virus
2.32 kB
######## 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"/home/ubuntu/1TB_disk/constructos/gradio_projects/constructs_{name}.csv")
return table, f"/home/ubuntu/1TB_disk/constructos/gradio_projects/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(share=True)