From d1d46e15a73fc8d0d6c5b607c0502080eb73ce55 Mon Sep 17 00:00:00 2001 From: Ryan Routsong Date: Fri, 2 Feb 2024 12:27:23 -0500 Subject: [PATCH] fix: sample sheet processing and run id searching fixes from bigsky testing --- scripts/files.py | 4 ++++ scripts/samplesheet.py | 17 ++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/files.py b/scripts/files.py index adb415c..4cc4127 100644 --- a/scripts/files.py +++ b/scripts/files.py @@ -155,6 +155,10 @@ def get_run_directories(runids, seq_dir=None, sheetname=None): host = get_current_server() seq_dirs = Path(seq_dir).absolute() if seq_dir else Path(DIRECTORY_CONFIGS[host]['seqroot']) seq_contents = [_child for _child in seq_dirs.iterdir()] + for firstchild in seq_dirs.iterdir(): + if firstchild.is_dir(): + for secondchild in firstchild.iterdir(): + seq_contents.append(secondchild) seq_contents_names = [child for child in map(lambda d: d.name, seq_contents)] run_paths, invalid_runs = [], [] diff --git a/scripts/samplesheet.py b/scripts/samplesheet.py index 32e549b..9fc30e5 100644 --- a/scripts/samplesheet.py +++ b/scripts/samplesheet.py @@ -65,13 +65,16 @@ def parse_sheet(self, sheet): def process_v1_reads_section(self, section): section = [x for x in section if set(x) != {','}] r1, r2 = None, None - for i, line in enumerate(section, start=1): - if line.split(',')[0].isnumeric() and i == 1: - r1 = int(line.split(',')[0]) - elif line.split(',')[0].isnumeric() and i == 2: - r2 = int(line.split(',')[0]) - else: - self.process_simple_section([line]) + for line in section: + this_line_name = line.split(',')[0] + this_line_val = line.split(',')[1] + if this_line_name.lower() in ('read01', 'read02') and this_line_val.isnumeric(): + if this_line_name.endswith('1') and int(this_line_val) > 0: + r1 = int(this_line_val) + elif this_line_name.endswith('2') and int(this_line_val) > 0: + r2 = int(this_line_val) + else: + self.process_simple_section([line]) if r1: setattr(self, 'Read01', r1) if r2: