Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ run-boltz: _prepare-passwd
$(DOCKER_COMMON) \
--gpus all \
--shm-size=8g \
-e LD_LIBRARY_PATH=/opt/localcolabfold/.pixi/envs/default/lib:/usr/local/lib \
-e LD_LIBRARY_PATH=/opt/localcolabfold/.pixi/envs/default/lib:/usr/local/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cu13/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cudnn/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cublas/lib \
guild:latest \
Comment on lines +83 to 84
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LD_LIBRARY_PATH is fully hardcoded here and duplicated across multiple targets, which can drift from the value baked into the image and is easy to forget to update in one place. Consider factoring this into a Makefile variable and/or appending to the container’s existing LD_LIBRARY_PATH instead of replacing it entirely.

Copilot uses AI. Check for mistakes.
python $(MASTER_SCRIPT) \
--project $(PROJECT) \
Expand Down Expand Up @@ -124,7 +124,7 @@ run-guild: _prepare-passwd
$(DOCKER_COMMON) \
--gpus all \
--shm-size=8g \
-e LD_LIBRARY_PATH=/opt/localcolabfold/.pixi/envs/default/lib:/usr/local/lib \
-e LD_LIBRARY_PATH=/opt/localcolabfold/.pixi/envs/default/lib:/usr/local/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cu13/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cuda_nvrtc/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cudnn/lib:/app/.venv/lib/python3.10/site-packages/nvidia/cublas/lib \
guild:latest \
Comment on lines +127 to 128
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LD_LIBRARY_PATH is duplicated here (and differs from the image’s ENV LD_LIBRARY_PATH), which increases the chance of future drift between targets/images. Consider reusing a single Makefile variable (shared with run-boltz) and/or appending to the existing container LD_LIBRARY_PATH rather than replacing it.

Copilot uses AI. Check for mistakes.
python $(MASTER_SCRIPT) \
--project $(PROJECT) \
Expand Down
63 changes: 59 additions & 4 deletions guild/bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
PROTEIN_CONF_ID,
PROTEIN_ID,
PROTEIN_PATH,
PROTEINS_FOLDER,
# Scores lists
RP_SCORES_COLUMNS,
# Dictionaries
Expand Down Expand Up @@ -554,23 +555,77 @@ def run_docking(self):
continue

os.makedirs(f"{current_batch_folder}/{BOLTZ_FOLDER}", exist_ok=True)

# Use single-chain PDB as template to avoid Boltz multi-chain parsing errors
boltz_template_file = (
f"{current_batch_folder}/{PROTEINS_FOLDER}/"
f"{unique_protein_configuration_id}_single_chain_clean.pdb"
)
if not os.path.exists(boltz_template_file):
# Fallback to original protein path if single-chain not available
boltz_template_file = current_protein_path

yaml_file = f"{current_batch_folder}/{BOLTZ_FOLDER}/{run_id}_boltz.yaml"
boltz_out_dir = f"{current_batch_folder}/{BOLTZ_FOLDER}"

generate_boltz_yaml(
protein_sequence=current_protein_sequence,
protein_chain=current_protein_chain,
ligand_sequences=[ligand_smiles],
ligand_ids=["L"],
output_file=f"{current_batch_folder}/{BOLTZ_FOLDER}/{run_id}_boltz.yaml",
template_file=current_protein_path,
output_file=yaml_file,
template_file=boltz_template_file,
pocket_contacts=pocket_contacts if pocket_contacts else None,
msa_file=msa_file,
)

deploy_boltz(
f"{current_batch_folder}/{BOLTZ_FOLDER}/{run_id}_boltz.yaml",
out_dir=f"{current_batch_folder}/{BOLTZ_FOLDER}",
yaml_file,
out_dir=boltz_out_dir,
use_gpu=self.use_gpu,
)

# Check if Boltz produced valid output (manifest with records).
# Template PDB parsing can fail silently in Boltz2, resulting
# in an empty manifest. If that happens, retry without the template.
manifest_path = (
f"{boltz_out_dir}/boltz_results_{run_id}_boltz/processed/manifest.json"
)
if os.path.exists(manifest_path):
import json as _json

with open(manifest_path) as _mf:
_manifest = _json.load(_mf)
Comment on lines +597 to +598
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manifest.json is loaded without any error handling; if the file is truncated/invalid (e.g., Boltz interrupted mid-write) this will raise JSONDecodeError and abort the entire batch. Consider wrapping the manifest load in try/except and treating parse errors like an empty manifest (log + retry without template, or skip with warning).

Suggested change
with open(manifest_path) as _mf:
_manifest = _json.load(_mf)
try:
with open(manifest_path) as _mf:
_manifest = _json.load(_mf)
except (_json.JSONDecodeError, OSError) as exc:
logger.warning(
f"Boltz2 produced unreadable manifest for {run_id}: {exc}. "
"Retrying without template..."
)
_manifest = {}

Copilot uses AI. Check for mistakes.
if not _manifest.get("records"):
logger.warning(
f"Boltz2 produced empty manifest for {run_id} "
"(likely template parsing failure). Retrying without template..."
)
Comment on lines +588 to +603
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Boltz empty-manifest retry path is complex and impacts run stability, but there are no unit tests exercising it. Since this repo already has BulkRun tests, consider adding a test that mocks deploy_boltz/generate_boltz_yaml and verifies a retry occurs when manifest.json has no records.

Copilot uses AI. Check for mistakes.
# Remove the failed output directory
import shutil

failed_dir = f"{boltz_out_dir}/boltz_results_{run_id}_boltz"
if os.path.isdir(failed_dir):
shutil.rmtree(failed_dir)

# Regenerate YAML without template
generate_boltz_yaml(
protein_sequence=current_protein_sequence,
protein_chain=current_protein_chain,
ligand_sequences=[ligand_smiles],
ligand_ids=["L"],
output_file=yaml_file,
template_file=None,
pocket_contacts=pocket_contacts if pocket_contacts else None,
msa_file=msa_file,
)

deploy_boltz(
yaml_file,
out_dir=boltz_out_dir,
use_gpu=self.use_gpu,
)

logger.info(
f"Boltz docking completed for {current_batch}: "
f"protein {unique_protein_configuration_id}, ligand {current_ligand_id}"
Expand Down
7 changes: 7 additions & 0 deletions scripts/run_guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ def parse_args() -> argparse.Namespace:
default="chembl_36",
help="ChEMBL version string.",
)
parser.add_argument(
"--no-decoys",
action="store_true",
default=False,
help="Disable decoy generation (useful when decoy file is not available).",
)
parser.add_argument(
"--clean",
action="store_true",
Expand Down Expand Up @@ -192,6 +198,7 @@ def main() -> None:
max_mol_wt=args.max_mol_wt,
chembl_version=args.chembl_version,
decoys=decoys_path,
use_decoys=not args.no_decoys,
use_known_binders=args.use_known_binders,
n_workers=1,
)
Expand Down
Loading