Skip to content

Commit d2d38ee

Browse files
committed
Template update for nf-core/tools version 2.5.1
1 parent 3e91dcd commit d2d38ee

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

bin/check_samplesheet.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ def _validate_pair(self, row):
9898
"""Assert that read pairs have the same file extension. Report pair status."""
9999
if row[self._first_col] and row[self._second_col]:
100100
row[self._single_col] = False
101-
if Path(row[self._first_col]).suffixes[-2:] != Path(row[self._second_col]).suffixes[-2:]:
101+
first_col_suffix = Path(row[self._first_col]).suffixes[-2:]
102+
second_col_suffix = Path(row[self._second_col]).suffixes[-2:]
103+
if first_col_suffix != second_col_suffix:
102104
raise AssertionError("FASTQ pairs must have the same file extensions.")
103105
else:
104106
row[self._single_col] = True
@@ -157,7 +159,7 @@ def sniff_format(handle):
157159
handle.seek(0)
158160
sniffer = csv.Sniffer()
159161
if not sniffer.has_header(peek):
160-
logger.critical(f"The given sample sheet does not appear to contain a header.")
162+
logger.critical("The given sample sheet does not appear to contain a header.")
161163
sys.exit(1)
162164
dialect = sniffer.sniff(peek)
163165
return dialect
@@ -195,7 +197,8 @@ def check_samplesheet(file_in, file_out):
195197
reader = csv.DictReader(in_handle, dialect=sniff_format(in_handle))
196198
# Validate the existence of the expected header columns.
197199
if not required_columns.issubset(reader.fieldnames):
198-
logger.critical(f"The sample sheet **must** contain the column headers: {', '.join(required_columns)}.")
200+
req_cols = ", ".join(required_columns)
201+
logger.critical(f"The sample sheet **must** contain these column headers: {req_cols}.")
199202
sys.exit(1)
200203
# Validate each row.
201204
checker = RowChecker()

pyproject.toml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Config file for Python. Mostly used to configure linting of bin/check_samplesheet.py with Black.
2+
# Should be kept the same as nf-core/tools to avoid fighting with template synchronisation.
3+
[tool.black]
4+
line-length = 120
5+
target_version = ["py37", "py38", "py39", "py310"]
6+
7+
[tool.isort]
8+
profile = "black"
9+
known_first_party = ["nf_core"]
10+
multi_line_output = 3

0 commit comments

Comments
 (0)