Skip to content

Commit 7415ef0

Browse files
committed
Do not overwrite PanDDA2 processed results
1 parent a7e56bd commit 7415ef0

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/dlstbx/services/trigger_xchem.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def trigger_pandda_xchem(
409409
)
410410
return {"success": True}
411411

412-
# If other dimple/PanDDA2 job is running, quit, dimple set to trigger even if it fails?
412+
# If other dimple/PanDDA2 job is running, quit, dimple set to trigger even if it fails
413413
min_start_time = datetime.now() - timedelta(hours=6)
414414

415415
query = (
@@ -699,18 +699,13 @@ def trigger_pandda_xchem(
699699
# 3. Create dataset directory structure
700700
analysis_dir = processed_dir / "analysis"
701701
pandda_dir = analysis_dir / "pandda2"
702+
pandda_pdir = pandda_dir / f"panddas/processed_datasets/{dtag}"
702703
model_dir = pandda_dir / "model_building"
703704
dataset_dir = model_dir / dtag
704705
compound_dir = dataset_dir / "compound"
705706

706707
self.log.info(f"Creating directory {dataset_dir}")
707-
try:
708-
compound_dir.mkdir(parents=True, exist_ok=False)
709-
except FileExistsError:
710-
self.log.info(
711-
f"Exiting PanDDA2/Pipedream trigger: directory already exists for {dtag}"
712-
)
713-
return {"success": True}
708+
compound_dir.mkdir(parents=True, exist_ok=False)
714709

715710
dataset_list = sorted([p.parts[-1] for p in model_dir.iterdir() if p.is_dir()])
716711
dataset_count = sum(1 for p in model_dir.iterdir() if p.is_dir())
@@ -754,6 +749,12 @@ def trigger_pandda_xchem(
754749
"smiles": str(CompoundSMILES),
755750
}
756751

752+
if pandda_pdir.exists():
753+
self.log.info(
754+
f"Exiting PanDDA2/Pipedream trigger: {pandda_pdir} already exists"
755+
)
756+
return {"success": True}
757+
757758
if dataset_count < comparator_threshold:
758759
self.log.info(
759760
f"{dataset_count} < comparator dataset threshold of {comparator_threshold}, skipping PanDDA2 for now..."

0 commit comments

Comments
 (0)