Skip to content

Commit

Permalink
Merge pull request #95 from umccr/dev
Browse files Browse the repository at this point in the history
Push fix for #93 to pypi
  • Loading branch information
alexiswl authored May 8, 2024
2 parents 4d43d87 + 5dd9297 commit 4073a05
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/v2_samplesheet_maker/classes/samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from tempfile import NamedTemporaryFile

# Relative modules
from ..globals import HEADER_REGEX_MATCH
from ..utils.logger import get_logger
from ..utils import pascal_case_to_snake_case
from .super_sections import Section, KVSection, DataFrameSection
Expand Down Expand Up @@ -343,10 +344,10 @@ def read_from_samplesheet_csv(cls, samplesheet_csv: Path) -> "SampleSheet":
continue

# Check if header
if line.startswith("[") and line.endswith("]"):
if HEADER_REGEX_MATCH.match(line):
if section_name is not None:
samplesheet_dict[section_name] = section_lines
section_name = line.lstrip("[").rstrip("]")
section_name = HEADER_REGEX_MATCH.match(line).group(1)
section_lines = []
else:
section_lines.append(line)
Expand Down Expand Up @@ -410,6 +411,5 @@ def read_from_samplesheet_csv(cls, samplesheet_csv: Path) -> "SampleSheet":
cloud_settings["analysis_urns"] = cloud_analysis_urns
samplesheet_dict_sanitised["cloud_settings"] = cloud_settings


# Return the samplesheet object
return cls(samplesheet_dict_sanitised)
6 changes: 6 additions & 0 deletions src/v2_samplesheet_maker/globals.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
#!/usr/bin/env python

import re

# https://regex101.com/r/oRfry0/1
HEADER_REGEX_MATCH = re.compile(
r"\[([a-zA-Z_]+)](?:,*)?"
)

0 comments on commit 4073a05

Please sign in to comment.