From b7a723933ec32f0592840da04cd3882448ef9cd2 Mon Sep 17 00:00:00 2001 From: Charlie Date: Tue, 22 Jul 2025 11:33:36 -0400 Subject: [PATCH] Fix SH machine type naming --- seqBackupLib/illumina.py | 13 +++++-------- test/conftest.py | 14 ++++++++++++++ test/test_illumina.py | 1 + 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/seqBackupLib/illumina.py b/seqBackupLib/illumina.py index 450315c..b816262 100644 --- a/seqBackupLib/illumina.py +++ b/seqBackupLib/illumina.py @@ -10,6 +10,7 @@ "A": "Illumina-NovaSeq", "NB": "Illumina-MiniSeq", "LH": "Illumina-NovaSeqX", + "SH": "Illumina-MiSeq", } @@ -35,9 +36,10 @@ def _parse_folder(self) -> dict[str, str]: raise ValueError(f"Invalid date format in run name: {date}") instrument = parts[1] - if extract_instrument_code(instrument) not in MACHINE_TYPES: + instrument_code = extract_instrument_code(instrument) + if instrument_code not in MACHINE_TYPES: raise ValueError(f"Invalid instrument code in run name: {instrument}") - self.machine_type = MACHINE_TYPES[extract_instrument_code(instrument)] + self.machine_type = MACHINE_TYPES[instrument_code] run_number = parts[2] if not run_number.isdigit(): @@ -55,12 +57,7 @@ def _parse_folder(self) -> dict[str, str]: "flowcell_id": flowcell_id, } - if ( - self.machine_type == "Illumina-HiSeq" - or self.machine_type == "Illumina-NovaSeq" - or self.machine_type == "Illumina-MiniSeq" - or self.machine_type == "Illumina-NovaSeqX" - ): + if instrument_code in {"D", "A", "NB", "LH", "SH"}: vals1["flowcell_id"] = vals1["flowcell_id"][1:] return vals1 diff --git a/test/conftest.py b/test/conftest.py index 2918247..914e506 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -118,6 +118,20 @@ def nextseq_dir(tmp_path) -> Path: ) +@pytest.fixture +def sh_dir(tmp_path) -> Path: + return setup_illumina_dir( + tmp_path / "20250610_SH00024_0006_ASC2107697-SC3", + "Undetermined_S0_L001_R1_001.fastq.gz", + [ + "@SH00024:6:SC2107697-SC3:1:1101:18286:1000 1:N:0:ACGT+ACGT\n", + "ACGT\n", + "+\n", + "IIII\n", + ], + ) + + @pytest.fixture def full_miseq_dir(tmp_path) -> Path: # Lane 1 diff --git a/test/test_illumina.py b/test/test_illumina.py index 7dfa36a..0abe92a 100644 --- a/test/test_illumina.py +++ b/test/test_illumina.py @@ -12,6 +12,7 @@ "M": "miseq_dir", "NB": "miniseq_dir", "VH": "nextseq_dir", + "SH": "sh_dir", }