Spaces:
Running
Running
Add py3Dmol
Browse files- app.py +30 -0
- requirements.txt +3 -1
app.py
CHANGED
@@ -3,6 +3,7 @@ from evodiff.pretrained import OA_DM_38M, D3PM_UNIFORM_38M, MSA_OA_DM_MAXSUB
|
|
3 |
from evodiff.generate import generate_oaardm, generate_d3pm
|
4 |
from evodiff.generate_msa import generate_query_oadm_msa_simple
|
5 |
import re
|
|
|
6 |
|
7 |
def a3m_file(file):
|
8 |
|
@@ -29,6 +30,35 @@ def make_cond_seq(seq_len, msa_file, model_type):
|
|
29 |
|
30 |
return generated_sequence
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
usg_app = gr.Interface(
|
33 |
fn=make_uncond_seq,
|
34 |
inputs=[
|
|
|
3 |
from evodiff.generate import generate_oaardm, generate_d3pm
|
4 |
from evodiff.generate_msa import generate_query_oadm_msa_simple
|
5 |
import re
|
6 |
+
import py3Dmol
|
7 |
|
8 |
def a3m_file(file):
|
9 |
|
|
|
30 |
|
31 |
return generated_sequence
|
32 |
|
33 |
+
def display_pdb(path_to_pdb):
|
34 |
+
'''
|
35 |
+
#function to display pdb in py3dmol
|
36 |
+
SOURCE: https://huggingface.co/spaces/merle/PROTEIN_GENERATOR/blob/main/app.py
|
37 |
+
'''
|
38 |
+
pdb = open(path_to_pdb, "r").read()
|
39 |
+
|
40 |
+
view = py3Dmol.view(width=500, height=500)
|
41 |
+
view.addModel(pdb, "pdb")
|
42 |
+
view.setStyle({'model': -1}, {"cartoon": {'colorscheme':{'prop':'b','gradient':'roygb','min':0,'max':1}}})#'linear', 'min': 0, 'max': 1, 'colors': ["#ff9ef0","#a903fc",]}}})
|
43 |
+
view.zoomTo()
|
44 |
+
output = view._make_html().replace("'", '"')
|
45 |
+
print(view._make_html())
|
46 |
+
x = f"""<!DOCTYPE html><html></center> {output} </center></html>""" # do not use ' in this input
|
47 |
+
|
48 |
+
return f"""<iframe height="500px" width="100%" name="result" allow="midi; geolocation; microphone; camera;
|
49 |
+
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
50 |
+
allow-scripts allow-same-origin allow-popups
|
51 |
+
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
52 |
+
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
53 |
+
|
54 |
+
'''
|
55 |
+
return f"""<iframe style="width: 100%; height:700px" name="result" allow="midi; geolocation; microphone; camera;
|
56 |
+
display-capture; encrypted-media;" sandbox="allow-modals allow-forms
|
57 |
+
allow-scripts allow-same-origin allow-popups
|
58 |
+
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
59 |
+
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
60 |
+
'''
|
61 |
+
|
62 |
usg_app = gr.Interface(
|
63 |
fn=make_uncond_seq,
|
64 |
inputs=[
|
requirements.txt
CHANGED
@@ -21,4 +21,6 @@ evodiff
|
|
21 |
torch==2.0.1
|
22 |
torchvision
|
23 |
torch_geometric
|
24 |
-
torch_scatter
|
|
|
|
|
|
21 |
torch==2.0.1
|
22 |
torchvision
|
23 |
torch_geometric
|
24 |
+
torch_scatter
|
25 |
+
py3Dmol
|
26 |
+
colabfold[alphafold-minus-jax]@git+https://github.com/sokrypton/ColabFold
|