Skip to content

Commit bdf16d8

Browse files
committed
Edit collate logging
1 parent 73599b7 commit bdf16d8

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

‎src/dlstbx/util/xchem_collate_helpers.py‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,20 +369,27 @@ def update_xchem_database(
369369
`updatable` is the CrystalName set this run is allowed to write, captured
370370
before any RefinementOutcome is set."""
371371

372-
# Build list of dicts for batch updating rows in SQLite
372+
# Build list of dicts for batch updating rows in SQLite.
373373
db_dicts = []
374+
outcomes = {
375+
"not updatable": [],
376+
"no ligand cif": [],
377+
"Pipedream model": [],
378+
"PanDDA model": [],
379+
"no model": [],
380+
}
374381
for dataset_dir in model_dir.iterdir():
375382
if not dataset_dir.is_dir():
376383
continue
377384
dtag = dataset_dir.name
378385
if dtag not in updatable:
379-
logger.info(f"{dtag} not in set of updatable CrystalNames")
386+
outcomes["not updatable"].append(dtag)
380387
continue
381388
compound_dir = dataset_dir / "compound"
382389
cif_files = list(compound_dir.glob("*.cif"))
383390

384391
if not cif_files:
385-
logger.info(f"No .cif file in {compound_dir}, skipping {dtag}")
392+
outcomes["no ligand cif"].append(dtag)
386393
continue
387394
if len(cif_files) > 1:
388395
logger.error(f"Multiple .cif files in {compound_dir}")
@@ -400,6 +407,7 @@ def update_xchem_database(
400407

401408
# Export
402409
if pipedream_model:
410+
outcomes["Pipedream model"].append(dtag)
403411
# Determine ligand confidence based on overall ligandcc value
404412
if rscc >= 0.8:
405413
RefinementLigandConfidence = "4 - High Confidence"
@@ -440,6 +448,7 @@ def update_xchem_database(
440448
)
441449

442450
elif pandda_model:
451+
outcomes["PanDDA model"].append(dtag)
443452
db_dicts.append(
444453
{
445454
"CrystalName": dtag,
@@ -455,7 +464,7 @@ def update_xchem_database(
455464
}
456465
)
457466
else:
458-
logger.info(f"No model selected for {dtag}")
467+
outcomes["no model"].append(dtag)
459468
db_dicts.append(
460469
{
461470
"CrystalName": dtag,
@@ -466,6 +475,11 @@ def update_xchem_database(
466475
}
467476
)
468477

478+
logger.info(
479+
"Model selection: "
480+
+ ", ".join(f"{len(dtags)} {label}" for label, dtags in outcomes.items())
481+
)
482+
469483
# Now update the database with the formed dicts
470484
try:
471485
update_data_source_bulk(db_dicts, db_copy)

‎src/dlstbx/wrapper/xchem_collate.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def run(self):
3131
)
3232

3333
params = self.recwrap.recipe_step["job_parameters"]
34-
pipedream = params.get("pipedream")
35-
overwrite = params.get("overwrite")
34+
pipedream = str(params.get("pipedream", "")).strip().lower() == "true"
35+
overwrite = str(params.get("overwrite", "")).strip().lower() == "true"
3636
xchem_visit_dir = Path(params.get("xchem_visit_directory"))
3737
processing_dir = xchem_visit_dir / "processing"
3838
analysis_dir = Path(params.get("analysis_directory"))
@@ -102,6 +102,12 @@ def run(self):
102102

103103
# -------------------------------------------------------
104104
# Perform Pipedream collate --> html output
105+
if pipedream and not pipedream_dir.is_dir():
106+
self.log.error(
107+
f"Pipedream collation requested but no {pipedream_dir}, skipping"
108+
)
109+
pipedream = False
110+
105111
if pipedream:
106112
try:
107113
write_pipedream_output(analysis_dir, logger=self.log)

0 commit comments

Comments
 (0)