Skip to content

Commit

Permalink
Merge pull request #1788 from fabianegli/black-default-compliant
Browse files Browse the repository at this point in the history
be compliant with black defaults in the pipeline template
  • Loading branch information
mirpedrol authored Sep 1, 2022
2 parents b48be11 + 9d30b2b commit ee6b104
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nf_core/pipeline-template/bin/check_samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def _validate_pair(self, row):
"""Assert that read pairs have the same file extension. Report pair status."""
if row[self._first_col] and row[self._second_col]:
row[self._single_col] = False
if Path(row[self._first_col]).suffixes[-2:] != Path(row[self._second_col]).suffixes[-2:]:
first_col_suffix = Path(row[self._first_col]).suffixes[-2:]
second_col_suffix = Path(row[self._second_col]).suffixes[-2:]
if first_col_suffix != second_col_suffix:
raise AssertionError("FASTQ pairs must have the same file extensions.")
else:
row[self._single_col] = True
Expand Down Expand Up @@ -157,7 +159,7 @@ def sniff_format(handle):
handle.seek(0)
sniffer = csv.Sniffer()
if not sniffer.has_header(peek):
logger.critical(f"The given sample sheet does not appear to contain a header.")
logger.critical("The given sample sheet does not appear to contain a header.")
sys.exit(1)
dialect = sniffer.sniff(peek)
return dialect
Expand Down Expand Up @@ -195,7 +197,8 @@ def check_samplesheet(file_in, file_out):
reader = csv.DictReader(in_handle, dialect=sniff_format(in_handle))
# Validate the existence of the expected header columns.
if not required_columns.issubset(reader.fieldnames):
logger.critical(f"The sample sheet **must** contain the column headers: {', '.join(required_columns)}.")
req_cols = ", ".join(required_columns)
logger.critical(f"The sample sheet **must** contain these column headers: {req_cols}.")
sys.exit(1)
# Validate each row.
checker = RowChecker()
Expand Down

0 comments on commit ee6b104

Please sign in to comment.