Spaces:
Running
on
L4
Running
on
L4
simonduerr
commited on
Commit
•
69b80eb
1
Parent(s):
ea823ae
Update app.py
Browse files
app.py
CHANGED
@@ -54,6 +54,7 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
54 |
output = {
|
55 |
"sequences": []
|
56 |
}
|
|
|
57 |
for chain in inputs["chains"]:
|
58 |
entity_type = chain["class"].lower()
|
59 |
sequence_data = {
|
@@ -66,6 +67,7 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
66 |
if entity_type == "protein":
|
67 |
sequences_for_msa.append(chain["sequence"])
|
68 |
sequence_data[entity_type]["msa"] = f"{jobname}/msa.a3m"
|
|
|
69 |
if entity_type == "ligand":
|
70 |
if "sdf" in chain.keys():
|
71 |
raise gr.Error("Sorry no SDF support yet")
|
@@ -73,6 +75,8 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
73 |
sequence_data[entity_type]["ccd"] = chain["name"]
|
74 |
if "smiles" in chain.keys():
|
75 |
sequence_data[entity_type]["smiles"] = chain["smiles"]
|
|
|
|
|
76 |
|
77 |
if len(inputs["covMods"])>0:
|
78 |
raise gr.Error("Sorry, covMods not supported yet. Coming soon. ")
|
@@ -97,16 +101,16 @@ def predict(jobname, inputs, recycling_steps, sampling_steps, diffusion_samples)
|
|
97 |
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")
|
98 |
print(os.listdir(jobname))
|
99 |
print(os.listdir(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/"))
|
100 |
-
return f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/{jobname}_model_0.pdb"
|
101 |
|
102 |
with gr.Blocks() as blocks:
|
103 |
gr.Markdown("# Boltz-1")
|
104 |
gr.Markdown("""Open GUI for running [Boltz-1 model](https://github.com/jwohlwend/boltz/) <br>
|
105 |
Key components:
|
106 |
-
- MMSeqs2 Webserver Mirdita et al.
|
107 |
-
- Boltz-1 Model Wohlwend et al.
|
108 |
-
- Gradio Custom Components Molecule3D/Cofolding Input
|
109 |
-
- 3dmol.js Rego & Koes
|
110 |
|
111 |
Note: This is an alpha: Some things like covalent modifications or using sdf files don't work yet. You can a Docker image of this on your local infrastructure easily using:
|
112 |
`docker run -it -p 7860:7860 --platform=linux/amd64 --gpus all registry.hf.space/simonduerr-boltz-1:latest python app.py`
|
|
|
54 |
output = {
|
55 |
"sequences": []
|
56 |
}
|
57 |
+
representations = []
|
58 |
for chain in inputs["chains"]:
|
59 |
entity_type = chain["class"].lower()
|
60 |
sequence_data = {
|
|
|
67 |
if entity_type == "protein":
|
68 |
sequences_for_msa.append(chain["sequence"])
|
69 |
sequence_data[entity_type]["msa"] = f"{jobname}/msa.a3m"
|
70 |
+
representations.append({"model":0, "chain":chain["chain"], "style":"cartoon"})
|
71 |
if entity_type == "ligand":
|
72 |
if "sdf" in chain.keys():
|
73 |
raise gr.Error("Sorry no SDF support yet")
|
|
|
75 |
sequence_data[entity_type]["ccd"] = chain["name"]
|
76 |
if "smiles" in chain.keys():
|
77 |
sequence_data[entity_type]["smiles"] = chain["smiles"]
|
78 |
+
|
79 |
+
representations.append({"model":0, "chain":chain["chain"], "style":"stick", "color":"greenCarbon"})
|
80 |
|
81 |
if len(inputs["covMods"])>0:
|
82 |
raise gr.Error("Sorry, covMods not supported yet. Coming soon. ")
|
|
|
101 |
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")
|
102 |
print(os.listdir(jobname))
|
103 |
print(os.listdir(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/"))
|
104 |
+
return Molecule3D(f"{jobname}/boltz_results_{jobname}/predictions/{jobname}/{jobname}_model_0.pdb", label="Output", reps=representations)
|
105 |
|
106 |
with gr.Blocks() as blocks:
|
107 |
gr.Markdown("# Boltz-1")
|
108 |
gr.Markdown("""Open GUI for running [Boltz-1 model](https://github.com/jwohlwend/boltz/) <br>
|
109 |
Key components:
|
110 |
+
- MMSeqs2 Webserver [Mirdita et al.](https://www.nature.com/articles/s41592-022-01488-1)
|
111 |
+
- Boltz-1 Model [Wohlwend et al.](https://github.com/jwohlwend/boltz/)
|
112 |
+
- Gradio Custom Components [Molecule3D](https://huggingface.co/spaces/simonduerr/gradio_molecule3d)/[Cofolding Input](https://huggingface.co/spaces/simonduerr/gradio_cofoldinginput) by myself
|
113 |
+
- [3dmol.js Rego & Koes](https://academic.oup.com/bioinformatics/article/31/8/1322/213186)
|
114 |
|
115 |
Note: This is an alpha: Some things like covalent modifications or using sdf files don't work yet. You can a Docker image of this on your local infrastructure easily using:
|
116 |
`docker run -it -p 7860:7860 --platform=linux/amd64 --gpus all registry.hf.space/simonduerr-boltz-1:latest python app.py`
|