Spaces:
Sleeping
Sleeping
inference_eval
Browse files- Dockerfile +29 -10
- inference_app.py +284 -33
- input_ligand_test.sdf +76 -0
- input_protein_test.cif +0 -0
- requirements.txt +2 -0
- test_docking_pose.sdf +0 -85
- test_out.pdb +0 -0
Dockerfile
CHANGED
|
@@ -1,20 +1,39 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
RUN useradd -m -u 1000 user
|
| 4 |
WORKDIR /usr/src/app
|
| 5 |
-
COPY --link --chown=1000 ./ /usr/src/app
|
| 6 |
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
-
|
| 12 |
|
| 13 |
-
#
|
| 14 |
-
|
|
|
|
| 15 |
|
| 16 |
-
#do not modify below
|
| 17 |
EXPOSE 7860
|
| 18 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
CMD ["python", "inference_app.py"]
|
|
|
|
| 1 |
+
ARG BASE_IMAGE=mambaorg/micromamba
|
| 2 |
+
ARG BASE_TAG=1.5-jammy
|
| 3 |
+
ARG MAMBA_PYTHON_VERSION=3.10
|
| 4 |
+
|
| 5 |
+
FROM --platform=linux/amd64 ${BASE_IMAGE}:${BASE_TAG}
|
| 6 |
+
|
| 7 |
+
ARG MAMBA_PYTHON_VERSION
|
| 8 |
+
ENV DEBIAN_FRONTEND=noninteractive
|
| 9 |
|
|
|
|
| 10 |
WORKDIR /usr/src/app
|
|
|
|
| 11 |
|
| 12 |
+
# Install conda env
|
| 13 |
+
RUN micromamba install -y -n base -c conda-forge \
|
| 14 |
+
pyopenssl=23.2.0 \
|
| 15 |
+
python=${MAMBA_PYTHON_VERSION} \
|
| 16 |
+
requests=2.25.1 \
|
| 17 |
+
aivant::openstructure \
|
| 18 |
+
vina \
|
| 19 |
+
&& micromamba clean --all --yes
|
| 20 |
|
| 21 |
+
ARG MAMBA_DOCKERFILE_ACTIVATE=1 # (otherwise python will not be found)
|
| 22 |
+
ENV BASH_ENV=/usr/local/bin/_activate_current_env.sh
|
| 23 |
+
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/conda/lib
|
| 24 |
|
| 25 |
+
# install dependencies
|
| 26 |
+
ADD requirements.txt .
|
| 27 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 28 |
|
|
|
|
| 29 |
EXPOSE 7860
|
| 30 |
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 31 |
|
| 32 |
+
ADD . .
|
| 33 |
+
|
| 34 |
+
# Prepare user
|
| 35 |
+
USER $MAMBA_USER
|
| 36 |
+
|
| 37 |
+
ENTRYPOINT ["/usr/local/bin/_entrypoint.sh"]
|
| 38 |
+
|
| 39 |
CMD ["python", "inference_app.py"]
|
inference_app.py
CHANGED
|
@@ -1,38 +1,152 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
import time
|
|
|
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
from gradio_molecule3d import Molecule3D
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
start_time = time.time()
|
| 13 |
-
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
end_time = time.time()
|
| 16 |
run_time = end_time - start_time
|
| 17 |
-
return [
|
| 18 |
|
| 19 |
-
with gr.Blocks() as app:
|
| 20 |
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
with gr.Row():
|
| 25 |
input_sequence = gr.Textbox(lines=3, label="Input Protein sequence (FASTA)")
|
| 26 |
input_ligand = gr.Textbox(lines=3, label="Input ligand SMILES")
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
input_protein = gr.File(label="Input protein monomer")
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
# define any options here
|
| 33 |
|
|
|
|
| 34 |
# for automated inference the default options are used
|
| 35 |
-
|
| 36 |
# checkbox_option = gr.Checkbox(label="Checkbox Option")
|
| 37 |
# dropdown_option = gr.Dropdown(["Option 1", "Option 2", "Option 3"], label="Radio Option")
|
| 38 |
|
|
@@ -41,30 +155,167 @@ with gr.Blocks() as app:
|
|
| 41 |
gr.Examples(
|
| 42 |
[
|
| 43 |
[
|
| 44 |
-
"
|
| 45 |
-
"
|
| 46 |
-
|
|
|
|
| 47 |
],
|
| 48 |
],
|
| 49 |
-
[input_sequence, input_ligand, input_protein],
|
| 50 |
)
|
| 51 |
-
reps =
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
{
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
out = Molecule3D(reps=reps)
|
| 66 |
run_time = gr.Textbox(label="Runtime")
|
| 67 |
|
| 68 |
-
btn.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
app.launch()
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
from pathlib import Path
|
| 3 |
import time
|
| 4 |
+
from biotite.application.autodock import VinaApp
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
|
| 8 |
from gradio_molecule3d import Molecule3D
|
| 9 |
+
from gradio_molecule2d import molecule2d
|
| 10 |
+
import numpy as np
|
| 11 |
+
from rdkit import Chem
|
| 12 |
+
from rdkit.Chem import AllChem
|
| 13 |
+
import pandas as pd
|
| 14 |
+
from biotite.structure import centroid, from_template
|
| 15 |
+
from biotite.structure.io import load_structure
|
| 16 |
+
from biotite.structure.io.mol import MOLFile, SDFile
|
| 17 |
+
|
| 18 |
+
from plinder.eval.docking.write_scores import evaluate
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
EVAL_METRICS = ["system_id", "LDDT-PLI", "LDDT-LP", "BISY-RMSD"]
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
def vina(
|
| 25 |
+
ligand, receptor, pocket_center, output_folder: Path, size=10, max_num_poses=5
|
| 26 |
+
):
|
| 27 |
+
app = VinaApp(
|
| 28 |
+
ligand,
|
| 29 |
+
receptor,
|
| 30 |
+
center=pocket_center,
|
| 31 |
+
size=[size, size, size],
|
| 32 |
+
)
|
| 33 |
+
app.set_max_number_of_models(max_num_poses)
|
| 34 |
+
app.start()
|
| 35 |
+
app.join()
|
| 36 |
+
docked_ligand = from_template(ligand, app.get_ligand_coord())
|
| 37 |
+
docked_ligand = docked_ligand[..., ~np.isnan(docked_ligand.coord[0]).any(axis=-1)]
|
| 38 |
+
output_files = []
|
| 39 |
+
for i in range(max_num_poses):
|
| 40 |
+
sdf_file = MOLFile()
|
| 41 |
+
sdf_file.set_structure(docked_ligand[i])
|
| 42 |
+
sdf_file.write(output_folder / f"docked_ligand_{i}.sdf")
|
| 43 |
+
output_files.append(sdf_file)
|
| 44 |
+
return output_files
|
| 45 |
|
| 46 |
|
| 47 |
+
def predict(
|
| 48 |
+
input_sequence: str,
|
| 49 |
+
input_ligand: str,
|
| 50 |
+
input_msa: gr.File | None = None,
|
| 51 |
+
input_protein: gr.File | None = None,
|
| 52 |
+
max_num_poses: int = 1,
|
| 53 |
+
):
|
| 54 |
+
"""
|
| 55 |
+
Main prediction function that calls ligsite and smina
|
| 56 |
|
| 57 |
+
Parameters
|
| 58 |
+
----------
|
| 59 |
+
input_sequence: str
|
| 60 |
+
monomer sequence
|
| 61 |
+
input_ligand: str
|
| 62 |
+
ligand as SMILES string
|
| 63 |
+
input_msa: gradio.File | None
|
| 64 |
+
Gradio file object to MSA a3m file
|
| 65 |
+
input_protein: gradio.File | None
|
| 66 |
+
Gradio file object to monomer protein structure as CIF file
|
| 67 |
+
max_num_poses: int
|
| 68 |
+
Number of poses to generate
|
| 69 |
|
| 70 |
+
Returns
|
| 71 |
+
-------
|
| 72 |
+
output_structures: tuple
|
| 73 |
+
(output_protein, output_ligand_sdf)
|
| 74 |
+
run_time: float
|
| 75 |
+
run time of the program
|
| 76 |
+
"""
|
| 77 |
start_time = time.time()
|
| 78 |
+
|
| 79 |
+
if input_protein is None:
|
| 80 |
+
raise gr.Error("need input_protein")
|
| 81 |
+
ligand_file = "ligand.sdf"
|
| 82 |
+
conformer = Chem.AddHs(Chem.MolFromSmiles(input_ligand))
|
| 83 |
+
AllChem.EmbedMolecule(conformer)
|
| 84 |
+
AllChem.MMFFOptimizeMolecule(conformer)
|
| 85 |
+
Chem.SDWriter(ligand_file).write(conformer)
|
| 86 |
+
ligand = SDFile.read(ligand_file).record.get_structure()
|
| 87 |
+
receptor = load_structure(input_protein, include_bonds=True)
|
| 88 |
+
docking_poses = vina(
|
| 89 |
+
ligand,
|
| 90 |
+
receptor,
|
| 91 |
+
centroid(receptor),
|
| 92 |
+
Path(input_protein).parent,
|
| 93 |
+
max_num_poses=max_num_poses,
|
| 94 |
+
)
|
| 95 |
end_time = time.time()
|
| 96 |
run_time = end_time - start_time
|
| 97 |
+
return [input_protein.name, docking_poses[0]], run_time
|
| 98 |
|
|
|
|
| 99 |
|
| 100 |
+
def get_metrics(
|
| 101 |
+
system_id: str,
|
| 102 |
+
receptor_file: Path,
|
| 103 |
+
ligand_file: Path,
|
| 104 |
+
) -> tuple[pd.DataFrame, float]:
|
| 105 |
+
start_time = time.time()
|
| 106 |
+
metrics = pd.DataFrame(
|
| 107 |
+
[
|
| 108 |
+
evaluate(
|
| 109 |
+
model_system_id=system_id,
|
| 110 |
+
reference_system_id=system_id,
|
| 111 |
+
receptor_file=receptor_file,
|
| 112 |
+
ligand_files=[ligand_file],
|
| 113 |
+
flexible=False,
|
| 114 |
+
posebusters=False,
|
| 115 |
+
posebusters_full=False,
|
| 116 |
+
)
|
| 117 |
+
]
|
| 118 |
+
)
|
| 119 |
+
metrics = metrics[
|
| 120 |
+
["system_id", "lddt_pli_ave", "lddt_lp_ave", "bisy_rmsd_ave"]
|
| 121 |
+
].copy()
|
| 122 |
+
metrics.rename(
|
| 123 |
+
columns={
|
| 124 |
+
"lddt_pli_ave": "LDDT-PLI",
|
| 125 |
+
"lddt_lp_ave": "LDDT-LP",
|
| 126 |
+
"bisy_rmsd_ave": "BISY-RMSD",
|
| 127 |
+
},
|
| 128 |
+
inplace=True,
|
| 129 |
+
)
|
| 130 |
+
end_time = time.time()
|
| 131 |
+
run_time = end_time - start_time
|
| 132 |
+
return metrics, run_time
|
| 133 |
+
|
| 134 |
|
| 135 |
+
with gr.Blocks() as app:
|
| 136 |
+
gr.Markdown("# Vina")
|
| 137 |
+
|
| 138 |
+
gr.Markdown(
|
| 139 |
+
"Example model using Vina to dock the ligand with the pocket center defined by the centroid of the input protein."
|
| 140 |
+
)
|
| 141 |
with gr.Row():
|
| 142 |
input_sequence = gr.Textbox(lines=3, label="Input Protein sequence (FASTA)")
|
| 143 |
input_ligand = gr.Textbox(lines=3, label="Input ligand SMILES")
|
| 144 |
+
input_msa = gr.File(label="Input MSA (a3m)")
|
| 145 |
+
input_protein = gr.File(label="Input protein monomer (CIF)")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 146 |
|
| 147 |
+
# define any options here
|
| 148 |
# for automated inference the default options are used
|
| 149 |
+
max_num_poses = gr.Slider(1, 10, value=1, label="Max number of poses to generate")
|
| 150 |
# checkbox_option = gr.Checkbox(label="Checkbox Option")
|
| 151 |
# dropdown_option = gr.Dropdown(["Option 1", "Option 2", "Option 3"], label="Radio Option")
|
| 152 |
|
|
|
|
| 155 |
gr.Examples(
|
| 156 |
[
|
| 157 |
[
|
| 158 |
+
"QECTKFKVSSCRECIESGPGCTWCQKLNFTGPGDPDSIRCDTRPQLLMRGCAADDIMDPTSLAETQEDHNGGQKQLSPQKVTLYLRPGQAAAFNVTFRRAKGYPIDLYYLMDLSYSMLDDLRNVKKLGGDLLRALNEITESGRIGFGSFVDKTVLPFVNTHPDKLRNPCPNKEKECQPPFAFRHVLKLTDNSNQFQTEVGKQLISGNLDAPEGGLDAMMQVAACPEEIGWRKVTRLLVFATDDGFHFAGDGKLGAILTPNDGRCHLEDNLYKRSNEFDYPSVGQLAHKLAENNIQPIFAVTSRMVKTYEKLTEIIPKSAVGELSEDSSNVVQLIKNAYNKLSSRVFLDHNALPDTLKVTYDSFCSNGVTHRNQPRGDCDGVQINVPITFQVKVTATECIQEQSFVIRALGFTDIVTVQVLPQCECRCRDQSRDRSLCHGKGFLECGICRCDTGYIGKNCECQTQGRSSQELEGSCRKDNNSIICSGLGDCVCGQCLCHTSDVPGKLIYGQYCECDTINCERYNGQVCGGPGRGLCFCGKCRCHPGFEGSACQCERTTEGCLNPRRVECSGRGRCRCNVCECHSGYQLPLCQECPGCPSPCGKYISCAECLKFEKGPFGKNCSAACPGLQLSNNPVKGRTCKERDSEGCWVAYTLEQQDGMDRYLIYVDESRECCGGPAALQTLFQG",
|
| 159 |
+
"CC(=O)N[C@H]1[C@H](O[C@H]2[C@H](O)[C@@H](NC(C)=O)CO[C@@H]2CO)O[C@H](CO)[C@@H](O)[C@@H]1O",
|
| 160 |
+
None,
|
| 161 |
+
"input_test.cif",
|
| 162 |
],
|
| 163 |
],
|
| 164 |
+
[input_sequence, input_ligand, input_msa, input_protein],
|
| 165 |
)
|
| 166 |
+
reps = [
|
| 167 |
+
{
|
| 168 |
+
"model": 0,
|
| 169 |
+
"style": "cartoon",
|
| 170 |
+
"color": "whiteCarbon",
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"model": 0,
|
| 174 |
+
"resname": "UNK",
|
| 175 |
+
"style": "stick",
|
| 176 |
+
"color": "greenCarbon",
|
| 177 |
+
},
|
| 178 |
{
|
| 179 |
+
"model": 0,
|
| 180 |
+
"resname": "LIG",
|
| 181 |
+
"style": "stick",
|
| 182 |
+
"color": "greenCarbon",
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
"model": 1,
|
| 186 |
+
"style": "stick",
|
| 187 |
+
"color": "greenCarbon",
|
| 188 |
+
},
|
| 189 |
+
]
|
| 190 |
+
smiles = molecule2d(input_ligand)
|
| 191 |
out = Molecule3D(reps=reps)
|
| 192 |
run_time = gr.Textbox(label="Runtime")
|
| 193 |
|
| 194 |
+
btn.click(
|
| 195 |
+
predict,
|
| 196 |
+
inputs=[input_sequence, input_ligand, input_msa, input_protein, max_num_poses],
|
| 197 |
+
outputs=[out, run_time],
|
| 198 |
+
)
|
| 199 |
+
|
| 200 |
+
app.launch()
|
| 201 |
+
|
| 202 |
+
with gr.Blocks() as app:
|
| 203 |
+
with gr.Tab("🧬 Vina"):
|
| 204 |
+
gr.Markdown(
|
| 205 |
+
"Example model using Vina to dock the ligand with the pocket center defined by the centroid of the input protein."
|
| 206 |
+
)
|
| 207 |
+
with gr.Row():
|
| 208 |
+
input_sequence = gr.Textbox(lines=3, label="Input Protein sequence (FASTA)")
|
| 209 |
+
input_ligand = gr.Textbox(lines=3, label="Input ligand SMILES")
|
| 210 |
+
input_msa = gr.File(label="Input MSA (a3m)")
|
| 211 |
+
input_protein = gr.File(label="Input protein monomer (CIF)")
|
| 212 |
+
max_num_poses = gr.Slider(
|
| 213 |
+
1, 10, value=1, label="Max number of poses to generate"
|
| 214 |
+
)
|
| 215 |
+
btn = gr.Button("Run Inference")
|
| 216 |
+
gr.Examples(
|
| 217 |
+
[
|
| 218 |
+
[
|
| 219 |
+
"QECTKFKVSSCRECIESGPGCTWCQKLNFTGPGDPDSIRCDTRPQLLMRGCAADDIMDPTSLAETQEDHNGGQKQLSPQKVTLYLRPGQAAAFNVTFRRAKGYPIDLYYLMDLSYSMLDDLRNVKKLGGDLLRALNEITESGRIGFGSFVDKTVLPFVNTHPDKLRNPCPNKEKECQPPFAFRHVLKLTDNSNQFQTEVGKQLISGNLDAPEGGLDAMMQVAACPEEIGWRKVTRLLVFATDDGFHFAGDGKLGAILTPNDGRCHLEDNLYKRSNEFDYPSVGQLAHKLAENNIQPIFAVTSRMVKTYEKLTEIIPKSAVGELSEDSSNVVQLIKNAYNKLSSRVFLDHNALPDTLKVTYDSFCSNGVTHRNQPRGDCDGVQINVPITFQVKVTATECIQEQSFVIRALGFTDIVTVQVLPQCECRCRDQSRDRSLCHGKGFLECGICRCDTGYIGKNCECQTQGRSSQELEGSCRKDNNSIICSGLGDCVCGQCLCHTSDVPGKLIYGQYCECDTINCERYNGQVCGGPGRGLCFCGKCRCHPGFEGSACQCERTTEGCLNPRRVECSGRGRCRCNVCECHSGYQLPLCQECPGCPSPCGKYISCAECLKFEKGPFGKNCSAACPGLQLSNNPVKGRTCKERDSEGCWVAYTLEQQDGMDRYLIYVDESRECCGGPAALQTLFQG",
|
| 220 |
+
"CC(=O)N[C@H]1[C@H](O[C@H]2[C@H](O)[C@@H](NC(C)=O)CO[C@@H]2CO)O[C@H](CO)[C@@H](O)[C@@H]1O",
|
| 221 |
+
None,
|
| 222 |
+
"input_test.cif",
|
| 223 |
+
],
|
| 224 |
+
],
|
| 225 |
+
[input_sequence, input_ligand, input_msa, input_protein],
|
| 226 |
+
)
|
| 227 |
+
reps = [
|
| 228 |
+
{
|
| 229 |
+
"model": 0,
|
| 230 |
+
"style": "cartoon",
|
| 231 |
+
"color": "whiteCarbon",
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
"model": 0,
|
| 235 |
+
"resname": "UNK",
|
| 236 |
+
"style": "stick",
|
| 237 |
+
"color": "greenCarbon",
|
| 238 |
+
},
|
| 239 |
+
{
|
| 240 |
+
"model": 0,
|
| 241 |
+
"resname": "LIG",
|
| 242 |
+
"style": "stick",
|
| 243 |
+
"color": "greenCarbon",
|
| 244 |
+
},
|
| 245 |
+
{
|
| 246 |
+
"model": 1,
|
| 247 |
+
"style": "stick",
|
| 248 |
+
"color": "greenCarbon",
|
| 249 |
+
},
|
| 250 |
+
]
|
| 251 |
+
smiles = molecule2d(input_ligand)
|
| 252 |
+
out = Molecule3D(reps=reps)
|
| 253 |
+
run_time = gr.Textbox(label="Runtime")
|
| 254 |
+
|
| 255 |
+
btn.click(
|
| 256 |
+
predict,
|
| 257 |
+
inputs=[
|
| 258 |
+
input_sequence,
|
| 259 |
+
input_ligand,
|
| 260 |
+
input_msa,
|
| 261 |
+
input_protein,
|
| 262 |
+
max_num_poses,
|
| 263 |
+
],
|
| 264 |
+
outputs=[out, run_time],
|
| 265 |
+
)
|
| 266 |
+
with gr.Tab("⚖️ PLINDER evaluation template"):
|
| 267 |
+
with gr.Row():
|
| 268 |
+
with gr.Column():
|
| 269 |
+
input_system_id = gr.Textbox(label="PLINDER system ID")
|
| 270 |
+
input_receptor_file = gr.File(label="Receptor file (CIF)")
|
| 271 |
+
input_ligand_file = gr.File(label="Ligand file (SDF)")
|
| 272 |
+
|
| 273 |
+
eval_btn = gr.Button("Run Evaluation")
|
| 274 |
+
gr.Examples(
|
| 275 |
+
[
|
| 276 |
+
[
|
| 277 |
+
"4neh__1__1.B__1.H",
|
| 278 |
+
"input_protein_test.cif",
|
| 279 |
+
"input_ligand_test.sdf",
|
| 280 |
+
],
|
| 281 |
+
],
|
| 282 |
+
[input_system_id, input_receptor_file, input_ligand_file],
|
| 283 |
+
)
|
| 284 |
+
reps = [
|
| 285 |
+
{
|
| 286 |
+
"model": 0,
|
| 287 |
+
"style": "cartoon",
|
| 288 |
+
"color": "whiteCarbon",
|
| 289 |
+
},
|
| 290 |
+
{
|
| 291 |
+
"model": 0,
|
| 292 |
+
"resname": "UNK",
|
| 293 |
+
"style": "stick",
|
| 294 |
+
"color": "greenCarbon",
|
| 295 |
+
},
|
| 296 |
+
{
|
| 297 |
+
"model": 0,
|
| 298 |
+
"resname": "LIG",
|
| 299 |
+
"style": "stick",
|
| 300 |
+
"color": "greenCarbon",
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"model": 1,
|
| 304 |
+
"style": "stick",
|
| 305 |
+
"color": "greenCarbon",
|
| 306 |
+
},
|
| 307 |
+
]
|
| 308 |
+
|
| 309 |
+
# pred_native = Molecule3D(reps=reps, config={"backgroundColor": "black"})
|
| 310 |
+
eval_run_time = gr.Textbox(label="Evaluation runtime")
|
| 311 |
+
metric_table = gr.DataFrame(
|
| 312 |
+
pd.DataFrame([], columns=EVAL_METRICS), label="Evaluation metrics"
|
| 313 |
+
)
|
| 314 |
+
|
| 315 |
+
eval_btn.click(
|
| 316 |
+
evaluate,
|
| 317 |
+
inputs=[input_system_id, input_receptor_file, input_ligand_file],
|
| 318 |
+
outputs=[metric_table, eval_run_time],
|
| 319 |
+
)
|
| 320 |
|
| 321 |
app.launch()
|
input_ligand_test.sdf
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
35 36 0 0 0 0 0 0 0 1 V2000
|
| 5 |
+
-90.5920 50.9670 16.1800 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 6 |
+
-89.6380 50.4350 17.2150 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 7 |
+
-88.4570 50.2310 16.9640 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 8 |
+
-90.2160 50.2100 18.4400 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 9 |
+
-89.4740 50.1610 19.7290 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 10 |
+
-90.3860 50.7570 20.8330 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 11 |
+
-90.7120 52.0920 20.4450 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 12 |
+
-91.8650 52.6560 21.0970 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 13 |
+
-91.5010 53.8240 22.0290 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 14 |
+
-90.8100 53.3420 23.1970 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 15 |
+
-92.7380 54.6080 22.5210 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 16 |
+
-92.4070 56.0380 22.6160 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 17 |
+
-93.2740 56.9190 23.2260 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 18 |
+
-93.4830 56.6660 24.6950 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 19 |
+
-93.8230 57.8400 22.6340 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 20 |
+
-93.9600 54.3810 21.6250 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 21 |
+
-93.5500 54.3160 20.2620 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 22 |
+
-92.8010 53.1300 19.9560 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 23 |
+
-93.7640 52.0180 19.4950 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 24 |
+
-93.1180 51.0190 18.7110 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 25 |
+
-89.7000 50.7930 22.0760 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 26 |
+
-89.5010 49.4740 22.5760 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 27 |
+
-88.9070 49.5870 23.9880 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 28 |
+
-87.5240 49.2420 24.0130 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 29 |
+
-88.5810 48.6720 21.6460 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 30 |
+
-88.5650 47.2950 22.0610 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 31 |
+
-89.0090 48.7460 20.1620 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 32 |
+
-87.8630 48.3210 19.4000 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 33 |
+
-91.1580 50.5990 18.5310 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 34 |
+
-91.1430 53.8690 23.9480 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 35 |
+
-91.8120 56.4160 21.8870 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 36 |
+
-93.4990 51.0950 17.8170 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 37 |
+
-87.4660 48.2780 23.8900 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 38 |
+
-87.7020 47.1520 22.5000 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 39 |
+
-87.1460 48.9740 19.5550 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 40 |
+
1 2 1 0 0 0 0
|
| 41 |
+
2 3 2 0 0 0 0
|
| 42 |
+
2 4 1 0 0 0 0
|
| 43 |
+
4 5 1 0 0 0 0
|
| 44 |
+
5 6 1 0 0 0 0
|
| 45 |
+
6 7 1 0 0 0 0
|
| 46 |
+
7 8 1 0 0 0 0
|
| 47 |
+
8 9 1 0 0 0 0
|
| 48 |
+
9 10 1 0 0 0 0
|
| 49 |
+
9 11 1 0 0 0 0
|
| 50 |
+
11 12 1 0 0 0 0
|
| 51 |
+
12 13 1 0 0 0 0
|
| 52 |
+
13 14 1 0 0 0 0
|
| 53 |
+
13 15 2 0 0 0 0
|
| 54 |
+
11 16 1 0 0 0 0
|
| 55 |
+
16 17 1 0 0 0 0
|
| 56 |
+
17 18 1 0 0 0 0
|
| 57 |
+
18 19 1 0 0 0 0
|
| 58 |
+
19 20 1 0 0 0 0
|
| 59 |
+
6 21 1 0 0 0 0
|
| 60 |
+
21 22 1 0 0 0 0
|
| 61 |
+
22 23 1 0 0 0 0
|
| 62 |
+
23 24 1 0 0 0 0
|
| 63 |
+
22 25 1 0 0 0 0
|
| 64 |
+
25 26 1 0 0 0 0
|
| 65 |
+
25 27 1 0 0 0 0
|
| 66 |
+
27 28 1 0 0 0 0
|
| 67 |
+
5 27 1 0 0 0 0
|
| 68 |
+
8 18 1 0 0 0 0
|
| 69 |
+
4 29 1 0 0 0 0
|
| 70 |
+
10 30 1 0 0 0 0
|
| 71 |
+
12 31 1 0 0 0 0
|
| 72 |
+
20 32 1 0 0 0 0
|
| 73 |
+
24 33 1 0 0 0 0
|
| 74 |
+
26 34 1 0 0 0 0
|
| 75 |
+
28 35 1 0 0 0 0
|
| 76 |
+
M END
|
input_protein_test.cif
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
requirements.txt
CHANGED
|
@@ -1,2 +1,4 @@
|
|
| 1 |
gradio
|
| 2 |
gradio_molecule3d
|
|
|
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
gradio_molecule3d
|
| 3 |
+
gradio_molecule2d
|
| 4 |
+
plinder @ git+https://github.com/plinder-org/plinder.git@eval_refactor_cherrypick
|
test_docking_pose.sdf
DELETED
|
@@ -1,85 +0,0 @@
|
|
| 1 |
-
|
| 2 |
-
OpenBabel09192409083D
|
| 3 |
-
|
| 4 |
-
36 40 0 0 0 0 0 0 0 0999 V2000
|
| 5 |
-
108.2560 -14.3390 -8.2420 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 6 |
-
108.0640 -15.5020 -7.5120 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 7 |
-
106.8180 -15.9740 -7.8870 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 8 |
-
106.2330 -14.9610 -8.6810 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 9 |
-
107.0800 -13.9290 -8.7970 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 10 |
-
106.3370 -17.3000 -7.4520 C 0 0 0 0 0 2 0 0 0 0 0 0
|
| 11 |
-
106.9630 -17.6470 -6.0950 C 0 0 0 0 0 2 0 0 0 0 0 0
|
| 12 |
-
108.4110 -17.3630 -6.0010 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 13 |
-
108.9200 -16.1410 -6.5320 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 14 |
-
109.9720 -15.6370 -6.1530 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 15 |
-
111.7640 -12.1520 -9.2230 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 16 |
-
111.5380 -12.5620 -7.9090 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 17 |
-
110.3870 -13.2820 -7.5640 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 18 |
-
109.4320 -13.5860 -8.5360 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 19 |
-
109.6780 -13.1990 -9.8650 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 20 |
-
110.8310 -12.4790 -10.2040 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 21 |
-
114.0540 -11.8750 -8.6550 C 0 0 0 0 0 1 0 0 0 0 0 0
|
| 22 |
-
112.9260 -11.4570 -9.4150 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 23 |
-
109.2010 -18.1590 -5.0960 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 24 |
-
110.5900 -18.2460 -5.2280 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 25 |
-
111.3670 -19.0330 -4.3580 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 26 |
-
110.7870 -19.7750 -3.3220 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 27 |
-
109.3970 -19.6900 -3.1960 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 28 |
-
108.6200 -18.9030 -4.0650 C 0 0 0 0 0 3 0 0 0 0 0 0
|
| 29 |
-
111.5850 -20.5710 -2.4330 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 30 |
-
112.5740 -21.5070 -2.9690 C 0 0 0 0 0 2 0 0 0 0 0 0
|
| 31 |
-
113.9390 -21.2760 -2.3370 C 0 0 0 0 0 2 0 0 0 0 0 0
|
| 32 |
-
113.8510 -21.1820 -0.8130 C 0 0 0 0 0 2 0 0 0 0 0 0
|
| 33 |
-
112.4390 -21.4180 -0.2930 C 0 0 0 0 0 2 0 0 0 0 0 0
|
| 34 |
-
111.4390 -20.5420 -1.0320 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 35 |
-
110.6190 -19.8910 -0.3890 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 36 |
-
104.8990 -14.9150 -9.2940 C 0 0 0 0 0 0 0 0 0 0 0 0
|
| 37 |
-
104.3150 -15.8830 -9.7700 O 0 0 0 0 0 0 0 0 0 0 0 0
|
| 38 |
-
104.3240 -13.6710 -9.3560 N 0 0 0 0 0 0 0 0 0 0 0 0
|
| 39 |
-
104.9260 -12.8600 -9.3540 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 40 |
-
103.5080 -13.6300 -9.9540 H 0 0 0 0 0 0 0 0 0 0 0 0
|
| 41 |
-
1 2 1 0 0 0 0
|
| 42 |
-
2 9 1 0 0 0 0
|
| 43 |
-
3 2 2 0 0 0 0
|
| 44 |
-
3 6 1 0 0 0 0
|
| 45 |
-
4 3 1 0 0 0 0
|
| 46 |
-
5 4 2 0 0 0 0
|
| 47 |
-
5 1 1 0 0 0 0
|
| 48 |
-
6 7 1 0 0 0 0
|
| 49 |
-
7 8 1 0 0 0 0
|
| 50 |
-
8 19 1 0 0 0 0
|
| 51 |
-
9 10 2 0 0 0 0
|
| 52 |
-
9 8 1 0 0 0 0
|
| 53 |
-
11 12 1 0 0 0 0
|
| 54 |
-
12 13 2 0 0 0 0
|
| 55 |
-
14 1 1 0 0 0 0
|
| 56 |
-
14 13 1 0 0 0 0
|
| 57 |
-
15 14 2 0 0 0 0
|
| 58 |
-
16 15 1 0 0 0 0
|
| 59 |
-
16 11 2 0 0 0 0
|
| 60 |
-
18 11 1 0 0 0 0
|
| 61 |
-
18 17 1 0 0 0 0
|
| 62 |
-
19 24 1 0 0 0 0
|
| 63 |
-
20 19 2 0 0 0 0
|
| 64 |
-
20 21 1 0 0 0 0
|
| 65 |
-
21 22 2 0 0 0 0
|
| 66 |
-
22 23 1 0 0 0 0
|
| 67 |
-
22 25 1 0 0 0 0
|
| 68 |
-
24 23 2 0 0 0 0
|
| 69 |
-
25 30 1 0 0 0 0
|
| 70 |
-
26 25 1 0 0 0 0
|
| 71 |
-
26 27 1 0 0 0 0
|
| 72 |
-
27 28 1 0 0 0 0
|
| 73 |
-
28 29 1 0 0 0 0
|
| 74 |
-
30 31 2 0 0 0 0
|
| 75 |
-
30 29 1 0 0 0 0
|
| 76 |
-
32 4 1 0 0 0 0
|
| 77 |
-
33 32 2 0 0 0 0
|
| 78 |
-
34 35 1 0 0 0 0
|
| 79 |
-
34 32 1 0 0 0 0
|
| 80 |
-
36 34 1 0 0 0 0
|
| 81 |
-
M END
|
| 82 |
-
> <minimizedAffinity>
|
| 83 |
-
41.9578323
|
| 84 |
-
|
| 85 |
-
$$$$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_out.pdb
DELETED
|
The diff for this file is too large to render.
See raw diff
|
|
|