From 52cc211522947fe55ed7b05570060b79800686df Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 18 Dec 2025 11:30:25 +0000 Subject: [PATCH] Fix lane color indexing bug in imaging scatter plot The previous code would silently drop data for lanes >= 8 because the Dark2 color palette only has 8 colors (indices 0-7) and lanes are 1-indexed. This fix uses modulo arithmetic to cycle through colors for any number of lanes, preventing data loss. Fixes #4 --- multiqc_sav/modules/sav/sav.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/multiqc_sav/modules/sav/sav.py b/multiqc_sav/modules/sav/sav.py index 101d46d..9ef24b5 100644 --- a/multiqc_sav/modules/sav/sav.py +++ b/multiqc_sav/modules/sav/sav.py @@ -670,8 +670,10 @@ def _parse_imaging_table(data: pd.DataFrame) -> dict: if occ != prev_occ or pf != prev_pf: prev_occ = occ prev_pf = pf - if lane_int is not None and isinstance(lane_int, int) and lane_int < len(colors): - occ_pf[f"Lane {lane_int}"].append({"x": occ, "y": pf, "color": colors[lane_int]}) + if lane_int is not None and isinstance(lane_int, int): + # Use modulo to cycle through colors for any number of lanes + color_idx = (lane_int - 1) % len(colors) + occ_pf[f"Lane {lane_int}"].append({"x": occ, "y": pf, "color": colors[color_idx]}) else: occ_pf = {}