Skip to content

Commit

Permalink
style: clarify error message
Browse files Browse the repository at this point in the history
  • Loading branch information
boasvdp committed Feb 9, 2024
1 parent 48ae0d2 commit f169596
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions juno_library/juno_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def __enlist_fastq_samples(self, dir: Path) -> None:
pattern = re.compile(
r"(.*?)(?:_S\d+_|_)(?:L\d{3}_)?(?:p)?R?(1|2)(?:_.*|\..*)?\.f(ast)?q(\.gz)?"
)
observed_combinations = []
observed_combinations = {}
errors = []
for file_ in dir.iterdir():
if validate_file_has_min_lines(file_, self.min_num_lines):
Expand All @@ -414,11 +414,13 @@ def __enlist_fastq_samples(self, dir: Path) -> None:
if (sample_name, read_group) in observed_combinations:
errors.append(
KeyError(
f"Multiple fastq files found for sample {sample_name} with read group {read_group}. This pipeline expects only one fastq file per sample and read group."
f"Multiple fastq files ({observed_combinations[sample, read_group]} and {str(file_.resolve())}) matching the same sample {sample_name} and read group {read_group}. This pipeline expects only one fastq file per sample and read group."
)
)
else:
observed_combinations.append((sample_name, read_group))
observed_combinations[(sample_name, read_group)] = str(
file_.resolve()
)
sample = self.sample_dict.setdefault(match.group(1), {})
sample[f"R{read_group}"] = str(file_.resolve())
if len(errors) == 0:
Expand Down

0 comments on commit f169596

Please sign in to comment.