@@ -277,8 +277,8 @@ def trigger_pandda_xchem(
277277
278278 # Find corresponding XChem visit directory and database
279279 xchem_dir = pathlib .Path (f"/dls/labxchem/data/{ proposal_string } " )
280- yaml_files = []
281- match_dirs = []
280+ yaml_files = [] # user settings
281+ match_dirs = [] # labxchem visit
282282
283283 for subdir in xchem_dir .iterdir ():
284284 user_yaml = subdir / ".user.yaml"
@@ -292,18 +292,14 @@ def trigger_pandda_xchem(
292292 acr = expt_yaml ["data" ]["acronym" ]
293293 directory = yaml_file .parents [0 ]
294294 if acr == acronym :
295- match = True
296295 match_dirs .append (directory )
297296 # match_yaml = expt_yaml
298297 self .log .info (f"Found user yaml for dtag { dtag } at { yaml_file } " )
299298
300- if not match_dirs :
301- match = False
302- elif len (match_dirs ) == 1 :
299+ # account for potentially multiple labxchem visits for a single target
300+ if len (match_dirs ) == 1 :
303301 match_dir = match_dirs [0 ]
304- elif (
305- len (match_dirs ) > 1
306- ): # account for potentially multiple labxchem visits for a single target
302+ elif len (match_dirs ) > 1 :
307303 for path in match_dirs :
308304 try :
309305 db_path = str (
@@ -328,7 +324,7 @@ def trigger_pandda_xchem(
328324 f"Exception whilst reading ligand information from { db_path } for dtag { dtag } , dcid { dcid } : { e } "
329325 )
330326
331- if not match :
327+ if "match_dir" not in locals () :
332328 self .log .info (
333329 f"No user yaml found in { xchem_dir } , proceeding with default settings..."
334330 )
@@ -357,15 +353,14 @@ def trigger_pandda_xchem(
357353
358354 if name == acronym :
359355 match_dir = subdir
360- match = True
361356 # match_yaml = expt_yaml
362357
363358 except Exception as e :
364359 self .log .info (f"Problem reading .sqlite database for { subdir } : { e } " )
365360
366- if not match :
361+ if "match_dir" not in locals () :
367362 self .log .debug (
368- f"Exiting PanDDA2/Pipedream trigger: No directory found for { acronym } ."
363+ f"Exiting PanDDA2/Pipedream trigger: No labxchem directory found for { acronym } ."
369364 )
370365 return {"success" : True }
371366 else :
0 commit comments