From 162d3cb3fda62b7b6dad1b6ab4714f57e49c5e15 Mon Sep 17 00:00:00 2001 From: Sara Sjunnebo Date: Wed, 15 Oct 2025 13:11:19 +0200 Subject: [PATCH 1/4] Bugfix: get_noindex_stats only returned last sample --- taca/element/Element_Runs.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/taca/element/Element_Runs.py b/taca/element/Element_Runs.py index 9e77d294..5cb0ce1a 100644 --- a/taca/element/Element_Runs.py +++ b/taca/element/Element_Runs.py @@ -1178,32 +1178,33 @@ def get_noindex_stats(self, sub_demux): # read sub_demux_manifest into a string with open(sub_demux_manifest) as f: manifest_csv = f.read() - sample_row = ( - manifest_csv.split("[SAMPLES]")[1].strip().split("\n")[-1] + sample_rows = ( + manifest_csv.split("[SAMPLES]")[1].strip().split("\n")[1:] ) # ugh... - sample_name = sample_row.split(",")[0] - lane = sample_row.split(",")[3] - # Extract NumPolonies from RunStats.json runstats_json_path = os.path.join( self.run_dir, f"Demultiplexing_{sub_demux}", "RunStats.json" ) - if os.path.exists(runstats_json_path): - with open(runstats_json_path) as json_file: - demux_info = json.load(json_file) - demuxed_lanes = demux_info.get("Lanes") - for demuxed_lane in demuxed_lanes: - if demuxed_lane.get("Lane") == int(lane): - polonies = demuxed_lane.get("NumPolonies") - break - return [ - { + samples = [] + for sample_row in sample_rows: + sample_name = sample_row.split(",")[0] + lane = sample_row.split(",")[3] + # Extract NumPolonies from RunStats.json + if os.path.exists(runstats_json_path): + with open(runstats_json_path) as json_file: + demux_info = json.load(json_file) + demuxed_lanes = demux_info.get("Lanes") + for demuxed_lane in demuxed_lanes: + if demuxed_lane.get("Lane") == int(lane): + polonies = demuxed_lane.get("NumPolonies") + sample_info = { "SampleName": sample_name, "I1": "", "I2": "", "Lane": lane, "NumPoloniesAssigned": polonies, } - ] + samples.append(sample_info) + return samples # Aggregate stats in UnassignedSequences.csv def aggregate_stats_unassigned( From ae7c523a65c4f533fe08c2f81d6c6612ee1bef54 Mon Sep 17 00:00:00 2001 From: Sara Sjunnebo Date: Wed, 15 Oct 2025 13:28:19 +0200 Subject: [PATCH 2/4] Versioning --- VERSIONLOG.md | 4 ++++ taca/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/VERSIONLOG.md b/VERSIONLOG.md index 02ad6acb..ed19b80b 100644 --- a/VERSIONLOG.md +++ b/VERSIONLOG.md @@ -1,5 +1,9 @@ # TACA Version Log +## 20251015.1 + +Bugfix: Get all available samples in get_noindex_stats + ## 20251010.2 Move Aviti Teton FlowcellPressureCheck directories into run directory before processing the run diff --git a/taca/__init__.py b/taca/__init__.py index a4cd4b1d..e1d281bc 100644 --- a/taca/__init__.py +++ b/taca/__init__.py @@ -1,3 +1,3 @@ """Main TACA module""" -__version__ = "1.6.10" +__version__ = "1.6.11" From f6d0280bc6998d22104d34d9cf435ecf061e25ba Mon Sep 17 00:00:00 2001 From: Sara Sjunnebo Date: Wed, 15 Oct 2025 13:36:10 +0200 Subject: [PATCH 3/4] Giving Anand a break --- taca/element/Element_Runs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/taca/element/Element_Runs.py b/taca/element/Element_Runs.py index 5cb0ce1a..cbe0c75d 100644 --- a/taca/element/Element_Runs.py +++ b/taca/element/Element_Runs.py @@ -1196,6 +1196,7 @@ def get_noindex_stats(self, sub_demux): for demuxed_lane in demuxed_lanes: if demuxed_lane.get("Lane") == int(lane): polonies = demuxed_lane.get("NumPolonies") + break sample_info = { "SampleName": sample_name, "I1": "", From b20aeae646c2a5aad5a4d583cd9d8f5360255f78 Mon Sep 17 00:00:00 2001 From: Sara Sjunnebo Date: Wed, 15 Oct 2025 13:55:42 +0200 Subject: [PATCH 4/4] Don't check if file exists for each sample --- taca/element/Element_Runs.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/taca/element/Element_Runs.py b/taca/element/Element_Runs.py index cbe0c75d..0ac1a5d0 100644 --- a/taca/element/Element_Runs.py +++ b/taca/element/Element_Runs.py @@ -1184,19 +1184,23 @@ def get_noindex_stats(self, sub_demux): runstats_json_path = os.path.join( self.run_dir, f"Demultiplexing_{sub_demux}", "RunStats.json" ) + if not os.path.exists(runstats_json_path): + logger.error( + f"No RunStats.json file found for sub-demultiplexing {sub_demux}. Unable to process NoIndex samples. Skipping." + ) + raise FileNotFoundError samples = [] for sample_row in sample_rows: sample_name = sample_row.split(",")[0] lane = sample_row.split(",")[3] # Extract NumPolonies from RunStats.json - if os.path.exists(runstats_json_path): - with open(runstats_json_path) as json_file: - demux_info = json.load(json_file) - demuxed_lanes = demux_info.get("Lanes") - for demuxed_lane in demuxed_lanes: - if demuxed_lane.get("Lane") == int(lane): - polonies = demuxed_lane.get("NumPolonies") - break + with open(runstats_json_path) as json_file: + demux_info = json.load(json_file) + demuxed_lanes = demux_info.get("Lanes") + for demuxed_lane in demuxed_lanes: + if demuxed_lane.get("Lane") == int(lane): + polonies = demuxed_lane.get("NumPolonies") + break sample_info = { "SampleName": sample_name, "I1": "",