File size: 3,106 Bytes
bebad14
8b16c9c
dffaf30
bebad14
ac66e0e
d966c0d
bebad14
809b460
bebad14
 
2f33dad
d966c0d
fd32c9f
8b16c9c
2f33dad
bebad14
 
d966c0d
bebad14
f624b87
bebad14
 
 
 
 
fd32c9f
 
1891093
fd32c9f
 
809b460
1891093
fd32c9f
 
f354223
bebad14
 
 
28cb117
bebad14
 
 
 
44470f9
28cb117
 
 
 
fd32c9f
 
 
 
 
28cb117
 
7e327ca
28cb117
 
 
 
 
6242bac
28cb117
4853a01
54bb0ac
 
 
6242bac
 
54bb0ac
b338b53
 
 
 
 
 
54bb0ac
4853a01
6242bac
4853a01
54bb0ac
6242bac
54bb0ac
 
 
6242bac
54bb0ac
 
6242bac
b338b53
 
 
 
 
 
 
 
28cb117
8b16c9c
28cb117
 
8b16c9c
bebad14
 
8b16c9c
dffaf30
bebad14
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import time
import json 
import gradio as gr
from gradio_molecule3d import Molecule3D
from inference_base import inference


def predict (input_seq_1, input_msa_1, input_protein_1, input_seq_2,input_msa_2,  input_protein_2):
    start_time = time.time()
    # Do inference here
    metrics = inference(input_protein_1, input_protein_2)

    # return an output pdb file with the protein and two chains A and B.  
    # also return a JSON with any metrics you want to report
    # metrics = {"mean_plddt": 80, "binding_affinity": 2}
    end_time = time.time()
    run_time = end_time - start_time
    return "output.pdb",json.dumps(metrics), run_time

with gr.Blocks() as app:

    gr.Markdown("# Template for inference")

    gr.Markdown("Title, description, and other information about the model")   
    with gr.Row():
        with gr.Column():
            input_seq_1 = gr.Textbox(lines=3, label="Input Protein 1 sequence (FASTA)")
            input_msa_1 = gr.File(label="Input MSA Protein 1 (A3M)")
            input_protein_1 = gr.File(label="Input Protein 2 monomer (PDB)")
        with gr.Column():
            input_seq_2 = gr.Textbox(lines=3, label="Input Protein 2 sequence (FASTA)")
            input_msa_2 = gr.File(label="Input MSA Protein 2 (A3M)")
            input_protein_2 = gr.File(label="Input Protein 2 structure (PDB)")
        
        
    
    # define any options here

    # for automated inference the default options are used
    # slider_option = gr.Slider(0,10, label="Slider Option")
    # checkbox_option = gr.Checkbox(label="Checkbox Option")
    # dropdown_option = gr.Dropdown(["Option 1", "Option 2", "Option 3"], label="Radio Option")

    btn = gr.Button("Run Inference")

    gr.Examples(
        [
            [
                "GSGSPLAQQIKNIHSFIHQAKAAGRMDEVRTLQENLHQLMHEYFQQSD",
                "3v1c_A.pdb",
                "GSGSPLAQQIKNIHSFIHQAKAAGRMDEVRTLQENLHQLMHEYFQQSD",
                "3v1c_B.pdb",
                
            ],
        ],
        [input_seq_1, input_protein_1, input_seq_2,  input_protein_2],
    )
    reps =    [
    {
      "model": 0,
      "style": "cartoon",
      "chain": "A",
      "color": "whiteCarbon",
    },
    {
      "model": 0,
      "style": "cartoon",
       "chain": "B",
      "color": "greenCarbon",
    },
    {
      "model": 0,
      "style": "cartoon",
       "chain": "C",
      "color": "blueCarbon",
    },
    {
      "model": 0,
      "chain": "A",
      "style": "stick",
      "sidechain": True,
      "color": "whiteCarbon",
    },
    {
      "model": 0,
      "chain": "B",
      "style": "stick",
      "sidechain": True,
      "color": "greenCarbon"
    },
    {
      "model": 0,
      "chain": "C",
      "style": "stick",
      "sidechain": True,
      "color": "blueCarbon"
    },      
  ]
    # outputs 
    
    out = Molecule3D(reps=reps)
    metrics = gr.JSON(label="Metrics")
    run_time = gr.Textbox(label="Runtime")

    btn.click(predict, inputs=[input_seq_1, input_msa_1, input_protein_1, input_seq_2, input_msa_2,  input_protein_2], outputs=[out, metrics, run_time])

app.launch()