Skip to content

Commit

Permalink
fixing set_num regex
Browse files Browse the repository at this point in the history
  • Loading branch information
gesinaphillips committed Oct 23, 2024
1 parent 7c93ab5 commit 4dd234d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ingest_validation_tests/fastq_validator_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def get_prefix_read_type_and_set(filename: str) -> Optional[filename_pattern]:
"""
if not bool(fastq_utils.FASTQ_PATTERN.fullmatch(filename)):
return
# looking for fastq filenames matching pattern <prefix>_<lane>_[I1,I2,R1,R2,R3]_<set>
# looking for fastq filenames matching pattern <prefix>_<lane>_[I1,I2,R1,R2,R3]_<set_num>
pattern = re.compile(
r"(?P<prefix>.*(?:L\d+)(?=[_](?:(?P<read_type>(?:R|read)(?=[123]_)|I(?=[12]_)))))"
r"(?P<prefix>.*(?:L\d+)(?=[_](?:(?P<read_type>(?:R|read)(?=[123])|I(?=[12]))(?:\d?_)(?P<set_num>\d+))))"
)
groups = pattern.match(filename)
if groups and all(x in groups.groupdict().keys() for x in ["prefix", "read_type", "set"]):
if groups and all(x in groups.groupdict().keys() for x in ["prefix", "read_type", "set_num"]):
return filename_pattern(
groups.group("prefix"), groups.group("read_type"), groups.group("set")
groups.group("prefix"), groups.group("read_type"), groups.group("set_num")
)


Expand Down

0 comments on commit 4dd234d

Please sign in to comment.