Spaces:
Running
on
L4
Running
on
L4
simonduerr
commited on
Commit
•
971a03f
1
Parent(s):
4064992
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ import re
|
|
10 |
import urllib.request
|
11 |
import yaml
|
12 |
|
13 |
-
from msa import run_mmseqs2
|
14 |
|
15 |
CCD_URL = "https://huggingface.co/boltz-community/boltz-1/resolve/main/ccd.pkl"
|
16 |
MODEL_URL = "https://huggingface.co/boltz-community/boltz-1/resolve/main/boltz1.ckpt"
|
@@ -52,7 +52,7 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
52 |
# ], "covMods":[]
|
53 |
# }
|
54 |
"""
|
55 |
-
sequences_for_msa = []
|
56 |
output = {
|
57 |
"sequences": []
|
58 |
}
|
@@ -67,8 +67,9 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
67 |
if entity_type in ["protein", "dna", "rna"]:
|
68 |
sequence_data[entity_type]["sequence"] = chain["sequence"]
|
69 |
if entity_type == "protein":
|
70 |
-
sequences_for_msa.append(chain["sequence"])
|
71 |
-
|
|
|
72 |
representations.append({"model":0, "chain":chain["chain"], "style":"cartoon"})
|
73 |
if entity_type == "ligand":
|
74 |
if "sdf" in chain.keys():
|
@@ -76,7 +77,7 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
76 |
raise gr.Error("Sorry no SDF support yet")
|
77 |
if "name" in chain.keys():
|
78 |
sequence_data[entity_type]["ccd"] = chain["name"]
|
79 |
-
|
80 |
sequence_data[entity_type]["smiles"] = chain["smiles"]
|
81 |
|
82 |
representations.append({"model":0, "chain":chain["chain"], "style":"stick", "color":"greenCarbon"})
|
@@ -93,15 +94,15 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
93 |
yaml.dump(output, file, sort_keys=False, default_flow_style=False)
|
94 |
|
95 |
os.system(f"cat {yaml_file_path}")
|
96 |
-
a3m_lines_mmseqs2 = run_mmseqs2(
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
with open(f"{jobname}/msa.a3m", "w+") as fp:
|
102 |
-
|
103 |
-
|
104 |
-
os.system(f"boltz predict {jobname}/{jobname}.yaml --out_dir {jobname} --recycling_steps {recycling_steps} --sampling_steps {sampling_steps} --diffusion_samples {diffusion_samples} --override --output_format pdb")
|
105 |
print(os.listdir(jobname))
|
106 |
print(os.listdir(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/"))
|
107 |
return Molecule3D(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/{jobname}_model_0.pdb", label="Output", reps=representations)
|
|
|
10 |
import urllib.request
|
11 |
import yaml
|
12 |
|
13 |
+
#from msa import run_mmseqs2
|
14 |
|
15 |
CCD_URL = "https://huggingface.co/boltz-community/boltz-1/resolve/main/ccd.pkl"
|
16 |
MODEL_URL = "https://huggingface.co/boltz-community/boltz-1/resolve/main/boltz1.ckpt"
|
|
|
52 |
# ], "covMods":[]
|
53 |
# }
|
54 |
"""
|
55 |
+
#sequences_for_msa = []
|
56 |
output = {
|
57 |
"sequences": []
|
58 |
}
|
|
|
67 |
if entity_type in ["protein", "dna", "rna"]:
|
68 |
sequence_data[entity_type]["sequence"] = chain["sequence"]
|
69 |
if entity_type == "protein":
|
70 |
+
#sequences_for_msa.append(chain["sequence"])
|
71 |
+
if chain["msa"] == False:
|
72 |
+
sequence_data[entity_type]["msa"] = f"empty"
|
73 |
representations.append({"model":0, "chain":chain["chain"], "style":"cartoon"})
|
74 |
if entity_type == "ligand":
|
75 |
if "sdf" in chain.keys():
|
|
|
77 |
raise gr.Error("Sorry no SDF support yet")
|
78 |
if "name" in chain.keys():
|
79 |
sequence_data[entity_type]["ccd"] = chain["name"]
|
80 |
+
elif "smiles" in chain.keys():
|
81 |
sequence_data[entity_type]["smiles"] = chain["smiles"]
|
82 |
|
83 |
representations.append({"model":0, "chain":chain["chain"], "style":"stick", "color":"greenCarbon"})
|
|
|
94 |
yaml.dump(output, file, sort_keys=False, default_flow_style=False)
|
95 |
|
96 |
os.system(f"cat {yaml_file_path}")
|
97 |
+
#a3m_lines_mmseqs2 = run_mmseqs2(
|
98 |
+
# sequences_for_msa,
|
99 |
+
# f"./{jobname}",
|
100 |
+
# use_templates=False,
|
101 |
+
# )
|
102 |
+
#with open(f"{jobname}/msa.a3m", "w+") as fp:
|
103 |
+
# fp.writelines(a3m_lines_mmseqs2)
|
104 |
+
|
105 |
+
os.system(f"boltz predict {jobname}/{jobname}.yaml --use_msa_server --out_dir {jobname} --recycling_steps {recycling_steps} --sampling_steps {sampling_steps} --diffusion_samples {diffusion_samples} --override --output_format pdb")
|
106 |
print(os.listdir(jobname))
|
107 |
print(os.listdir(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/"))
|
108 |
return Molecule3D(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/{jobname}_model_0.pdb", label="Output", reps=representations)
|