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}") 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"(?