Skip to content

Commit

Permalink
Fix method name parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
amorehead committed Dec 18, 2024
1 parent 341da74 commit f8bf3b7
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 30 deletions.
16 changes: 11 additions & 5 deletions notebooks/astex_method_interaction_analysis_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"metadata": {},
"outputs": [],
"source": [
"import copy\n",
"import os\n",
"import re\n",
"import shutil\n",
Expand Down Expand Up @@ -279,14 +280,19 @@
" }\n",
")\n",
"\n",
"for method in baseline_methods:\n",
"for method in copy.deepcopy(baseline_methods):\n",
" for repeat_index in range(1, max_num_repeats_per_method + 1):\n",
" method_title = method_mapping[method]\n",
"\n",
" if not os.path.exists(f\"{method}_{dataset}_interaction_dataframes_{repeat_index}.h5\"):\n",
" v1_baseline = method == \"diffdockv1\"\n",
" vina_binding_site_method = method.split(\"_\")[-1] if \"_\" in method else \"p2rank\"\n",
" v1_baseline = method == \"diffdockv1\"\n",
" vina_binding_site_method = method.split(\"_\")[-1] if \"_\" in method else \"p2rank\"\n",
"\n",
" vina_suffix = f\"_{vina_binding_site_method}\" if \"_\" in method else \"\"\n",
" method = method.split(\"_\")[0]\n",
"\n",
" if not os.path.exists(\n",
" f\"{method}{vina_suffix}_{dataset}_interaction_dataframes_{repeat_index}.h5\"\n",
" ):\n",
" with open_dict(cfg):\n",
" cfg.method = method\n",
" cfg.repeat_index = repeat_index\n",
Expand Down Expand Up @@ -358,7 +364,7 @@
"\n",
" # NOTE: we iteratively save the interaction dataframes to an HDF5 file\n",
" with pd.HDFStore(\n",
" f\"{method}_astex_diverse_interaction_dataframes_{repeat_index}.h5\"\n",
" f\"{method}{vina_suffix}_astex_diverse_interaction_dataframes_{repeat_index}.h5\"\n",
" ) as store:\n",
" for i, df in enumerate(astex_protein_ligand_interaction_dfs):\n",
" store.put(f\"df_{i}\", df)"
Expand Down
16 changes: 11 additions & 5 deletions notebooks/astex_method_interaction_analysis_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# #### Import packages

# %%
import copy
import os
import re
import shutil
Expand Down Expand Up @@ -209,14 +210,19 @@ def create_temp_pdb_with_only_molecule_type_residues(
}
)

for method in baseline_methods:
for method in copy.deepcopy(baseline_methods):
for repeat_index in range(1, max_num_repeats_per_method + 1):
method_title = method_mapping[method]

if not os.path.exists(f"{method}_{dataset}_interaction_dataframes_{repeat_index}.h5"):
v1_baseline = method == "diffdockv1"
vina_binding_site_method = method.split("_")[-1] if "_" in method else "p2rank"
v1_baseline = method == "diffdockv1"
vina_binding_site_method = method.split("_")[-1] if "_" in method else "p2rank"

vina_suffix = f"_{vina_binding_site_method}" if "_" in method else ""
method = method.split("_")[0]

if not os.path.exists(
f"{method}{vina_suffix}_{dataset}_interaction_dataframes_{repeat_index}.h5"
):
with open_dict(cfg):
cfg.method = method
cfg.repeat_index = repeat_index
Expand Down Expand Up @@ -288,7 +294,7 @@ def create_temp_pdb_with_only_molecule_type_residues(

# NOTE: we iteratively save the interaction dataframes to an HDF5 file
with pd.HDFStore(
f"{method}_astex_diverse_interaction_dataframes_{repeat_index}.h5"
f"{method}{vina_suffix}_astex_diverse_interaction_dataframes_{repeat_index}.h5"
) as store:
for i, df in enumerate(astex_protein_ligand_interaction_dfs):
store.put(f"df_{i}", df)
Expand Down
16 changes: 11 additions & 5 deletions notebooks/dockgen_method_interaction_analysis_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"metadata": {},
"outputs": [],
"source": [
"import copy\n",
"import os\n",
"import re\n",
"import shutil\n",
Expand Down Expand Up @@ -292,14 +293,19 @@
" }\n",
")\n",
"\n",
"for method in baseline_methods:\n",
"for method in copy.deepcopy(baseline_methods):\n",
" for repeat_index in range(1, max_num_repeats_per_method + 1):\n",
" method_title = method_mapping[method]\n",
"\n",
" if not os.path.exists(f\"{method}_{dataset}_interaction_dataframes_{repeat_index}.h5\"):\n",
" v1_baseline = method == \"diffdockv1\"\n",
" vina_binding_site_method = method.split(\"_\")[-1] if \"_\" in method else \"p2rank\"\n",
" v1_baseline = method == \"diffdockv1\"\n",
" vina_binding_site_method = method.split(\"_\")[-1] if \"_\" in method else \"p2rank\"\n",
"\n",
" vina_suffix = f\"_{vina_binding_site_method}\" if \"_\" in method else \"\"\n",
" method = method.split(\"_\")[0]\n",
"\n",
" if not os.path.exists(\n",
" f\"{method}{vina_suffix}_{dataset}_interaction_dataframes_{repeat_index}.h5\"\n",
" ):\n",
" with open_dict(cfg):\n",
" cfg.method = method\n",
" cfg.repeat_index = repeat_index\n",
Expand Down Expand Up @@ -371,7 +377,7 @@
"\n",
" # NOTE: we iteratively save the interaction dataframes to an HDF5 file\n",
" with pd.HDFStore(\n",
" f\"{method}_dockgen_interaction_dataframes_{repeat_index}.h5\"\n",
" f\"{method}{vina_suffix}_dockgen_interaction_dataframes_{repeat_index}.h5\"\n",
" ) as store:\n",
" for i, df in enumerate(dockgen_protein_ligand_interaction_dfs):\n",
" store.put(f\"df_{i}\", df)"
Expand Down
16 changes: 11 additions & 5 deletions notebooks/dockgen_method_interaction_analysis_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# #### Import packages

# %%
import copy
import os
import re
import shutil
Expand Down Expand Up @@ -222,14 +223,19 @@ def create_temp_pdb_with_only_molecule_type_residues(
}
)

for method in baseline_methods:
for method in copy.deepcopy(baseline_methods):
for repeat_index in range(1, max_num_repeats_per_method + 1):
method_title = method_mapping[method]

if not os.path.exists(f"{method}_{dataset}_interaction_dataframes_{repeat_index}.h5"):
v1_baseline = method == "diffdockv1"
vina_binding_site_method = method.split("_")[-1] if "_" in method else "p2rank"
v1_baseline = method == "diffdockv1"
vina_binding_site_method = method.split("_")[-1] if "_" in method else "p2rank"

vina_suffix = f"_{vina_binding_site_method}" if "_" in method else ""
method = method.split("_")[0]

if not os.path.exists(
f"{method}{vina_suffix}_{dataset}_interaction_dataframes_{repeat_index}.h5"
):
with open_dict(cfg):
cfg.method = method
cfg.repeat_index = repeat_index
Expand Down Expand Up @@ -301,7 +307,7 @@ def create_temp_pdb_with_only_molecule_type_residues(

# NOTE: we iteratively save the interaction dataframes to an HDF5 file
with pd.HDFStore(
f"{method}_dockgen_interaction_dataframes_{repeat_index}.h5"
f"{method}{vina_suffix}_dockgen_interaction_dataframes_{repeat_index}.h5"
) as store:
for i, df in enumerate(dockgen_protein_ligand_interaction_dfs):
store.put(f"df_{i}", df)
Expand Down
16 changes: 11 additions & 5 deletions notebooks/posebusters_method_interaction_analysis_plotting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"metadata": {},
"outputs": [],
"source": [
"import copy\n",
"import os\n",
"import re\n",
"import shutil\n",
Expand Down Expand Up @@ -289,14 +290,19 @@
" }\n",
")\n",
"\n",
"for method in baseline_methods:\n",
"for method in copy.deepcopy(baseline_methods):\n",
" for repeat_index in range(1, max_num_repeats_per_method + 1):\n",
" method_title = method_mapping[method]\n",
"\n",
" if not os.path.exists(f\"{method}_{dataset}_interaction_dataframes_{repeat_index}.h5\"):\n",
" v1_baseline = method == \"diffdockv1\"\n",
" vina_binding_site_method = method.split(\"_\")[-1] if \"_\" in method else \"p2rank\"\n",
" v1_baseline = method == \"diffdockv1\"\n",
" vina_binding_site_method = method.split(\"_\")[-1] if \"_\" in method else \"p2rank\"\n",
"\n",
" vina_suffix = f\"_{vina_binding_site_method}\" if \"_\" in method else \"\"\n",
" method = method.split(\"_\")[0]\n",
"\n",
" if not os.path.exists(\n",
" f\"{method}{vina_suffix}_{dataset}_interaction_dataframes_{repeat_index}.h5\"\n",
" ):\n",
" with open_dict(cfg):\n",
" cfg.method = method\n",
" cfg.repeat_index = repeat_index\n",
Expand Down Expand Up @@ -370,7 +376,7 @@
"\n",
" # NOTE: we iteratively save the interaction dataframes to an HDF5 file\n",
" with pd.HDFStore(\n",
" f\"{method}_posebusters_benchmark_interaction_dataframes_{repeat_index}.h5\"\n",
" f\"{method}{vina_suffix}_posebusters_benchmark_interaction_dataframes_{repeat_index}.h5\"\n",
" ) as store:\n",
" for i, df in enumerate(posebusters_protein_ligand_interaction_dfs):\n",
" store.put(f\"df_{i}\", df)"
Expand Down
16 changes: 11 additions & 5 deletions notebooks/posebusters_method_interaction_analysis_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# #### Import packages

# %%
import copy
import os
import re
import shutil
Expand Down Expand Up @@ -219,14 +220,19 @@ def create_temp_pdb_with_only_molecule_type_residues(
}
)

for method in baseline_methods:
for method in copy.deepcopy(baseline_methods):
for repeat_index in range(1, max_num_repeats_per_method + 1):
method_title = method_mapping[method]

if not os.path.exists(f"{method}_{dataset}_interaction_dataframes_{repeat_index}.h5"):
v1_baseline = method == "diffdockv1"
vina_binding_site_method = method.split("_")[-1] if "_" in method else "p2rank"
v1_baseline = method == "diffdockv1"
vina_binding_site_method = method.split("_")[-1] if "_" in method else "p2rank"

vina_suffix = f"_{vina_binding_site_method}" if "_" in method else ""
method = method.split("_")[0]

if not os.path.exists(
f"{method}{vina_suffix}_{dataset}_interaction_dataframes_{repeat_index}.h5"
):
with open_dict(cfg):
cfg.method = method
cfg.repeat_index = repeat_index
Expand Down Expand Up @@ -300,7 +306,7 @@ def create_temp_pdb_with_only_molecule_type_residues(

# NOTE: we iteratively save the interaction dataframes to an HDF5 file
with pd.HDFStore(
f"{method}_posebusters_benchmark_interaction_dataframes_{repeat_index}.h5"
f"{method}{vina_suffix}_posebusters_benchmark_interaction_dataframes_{repeat_index}.h5"
) as store:
for i, df in enumerate(posebusters_protein_ligand_interaction_dfs):
store.put(f"df_{i}", df)
Expand Down

0 comments on commit f8bf3b7

Please sign in to comment.