From 986b0b3f5114f39d9611a60e921e0cc1e5ebe9e3 Mon Sep 17 00:00:00 2001 From: Eu Pin Tien Date: Tue, 22 Sep 2026 11:58:19 +0100 Subject: [PATCH 1/3] Loosen restrictions on file name matching logic for cryo-SIM workflow --- src/murfey/client/analyser.py | 21 ++++----------------- src/murfey/client/contexts/sim.py | 12 ++---------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/murfey/client/analyser.py b/src/murfey/client/analyser.py index 5046fd9dd..54aa2d800 100644 --- a/src/murfey/client/analyser.py +++ b/src/murfey/client/analyser.py @@ -219,23 +219,10 @@ def _find_context(self, file_path: Path) -> bool: # SIM workflow checks # ----------------------------------------------------------------------------- if ( - # CryoSIM raw data files have no extension, and end with specific suffixes - not file_path.suffix - and file_path.stem.endswith( - ( - # Bright field - "_BF", - # Fluorescent - "_BR", - "_BFR", - "_GR", - "_GFR", - "_BR_FL", - "_BFR_FL", - "_GR_FL", - "_GFR_FL", - ) - ) + # CryoSIM raw data files have no extension + # Bright field files end with "_BF" + # Processing will be triggered on fluorescent files ending with "_FL" + not file_path.suffix and file_path.stem.endswith(("_BF", "_FL")) ): if (context := _get_context("SIMContext")) is None: return False diff --git a/src/murfey/client/contexts/sim.py b/src/murfey/client/contexts/sim.py index cacbd035d..bc416be52 100644 --- a/src/murfey/client/contexts/sim.py +++ b/src/murfey/client/contexts/sim.py @@ -32,16 +32,8 @@ def post_transfer( return None # Look for raw data files - # These have no extensions, and end with one of the listed suffixes - if not transferred_file.suffix and transferred_file.stem.endswith( - ( - # Only SIM raw data files ending with '_FL' should be processed - "_BR_FL", - "_BFR_FL", - "_GR_FL", - "_GFR_FL", - ) - ): + # These have no extensions, and end with "_FL" + if not transferred_file.suffix and transferred_file.stem.endswith("_FL"): source = _get_source(transferred_file, environment) if source is None: logger.warning(f"No source found for file {transferred_file}") From e9b42ad3df0b02b97960e42e99e42b2f2f2e2455 Mon Sep 17 00:00:00 2001 From: Eu Pin Tien Date: Tue, 22 Sep 2026 12:10:05 +0100 Subject: [PATCH 2/3] Moved OTF file searching logic out into a cached function --- src/murfey/server/api/workflow_sim.py | 50 ++++++++++++++++----------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/src/murfey/server/api/workflow_sim.py b/src/murfey/server/api/workflow_sim.py index 4008de2dc..980d544b9 100644 --- a/src/murfey/server/api/workflow_sim.py +++ b/src/murfey/server/api/workflow_sim.py @@ -1,6 +1,7 @@ import json import logging import re +from functools import lru_cache from pathlib import Path from typing import Any @@ -24,6 +25,34 @@ ) +COLOR_LOOKUP = { + 452: "blue", + 525: "green", + 605: "red", + 655: "far_red", +} + + +@lru_cache(maxsize=1) +def get_otf_files(otf_dir: Path): + """ + Look for OTF files in the specified directory and match them to their wavelengths + """ + otf_files: dict[str, Path] = {} + pattern = r"(? Date: Tue, 22 Sep 2026 12:12:04 +0100 Subject: [PATCH 3/3] Updated test --- tests/client/test_analyser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/client/test_analyser.py b/tests/client/test_analyser.py index 0694c0569..5644ca863 100644 --- a/tests/client/test_analyser.py +++ b/tests/client/test_analyser.py @@ -40,10 +40,10 @@ # Bright field "visit/raw/CtrlApr_G2/20260703_132856_CtrlApr_G2_F3A_BF", # Fluorescent - "visit/raw/SR002_G1/20260707_112417_SR002G1_F1F_BR", - "visit/raw/SR002_G1/20260707_112417_SR002G1_F1F_BFR", - "visit/raw/44drug_G2/20260703_114348_44drug_G2_E2DR_GR", - "visit/raw/44drug_G2/20260703_113142_44drug_G2_E2DR_GFR", + "visit/raw/SR002_G1/20260707_112417_SR002G1_F1F_B_FL", + "visit/raw/SR002_G1/20260707_112417_SR002G1_F1F_G_FL", + "visit/raw/44drug_G2/20260703_114348_44drug_G2_E2DR_R_FL", + "visit/raw/44drug_G2/20260703_113142_44drug_G2_E2DR_FR_FL", "visit/raw/SR002_G1/20260707_112417_SR002G1_F1F_BR_FL", "visit/raw/SR002_G1/20260707_112417_SR002G1_F1F_BFR_FL", "visit/raw/44drug_G2/20260703_114348_44drug_G2_E2DR_GR_FL",