From 51e0c96d2b542da9420f468bc39d81dbb2684885 Mon Sep 17 00:00:00 2001 From: Cas Simons Date: Thu, 17 Aug 2023 09:54:39 +1200 Subject: [PATCH] Warn if there are incomplete fastq pairs --- scripts/redcap_parsing_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/redcap_parsing_utils.py b/scripts/redcap_parsing_utils.py index d797606d7..0961f5c45 100644 --- a/scripts/redcap_parsing_utils.py +++ b/scripts/redcap_parsing_utils.py @@ -1,4 +1,5 @@ # pylint: disable=unused-variable +import sys from enum import Enum from collections import defaultdict from cloudpathlib import CloudPath @@ -271,6 +272,9 @@ def find_fastq_pairs( # Group by sample read_pairs_by_sample_id = defaultdict(list) for pair in read_pairs.values(): + if len(pair) != 2: + print(f"Warning: skipping incomplete pair: {[fq.path for fq in pair]}", file=sys.stderr) + continue read_pairs_by_sample_id[pair[0].sample_id].append(pair) return read_pairs_by_sample_id