Skip to content

fix(nextflow-development): quote samplesheet fields with csv.writer - #1305

Closed
CryptGodSon wants to merge 1 commit into
anthropics:mainfrom
CryptGodSon:fix/samplesheet-csv-quoting
Closed

CryptGodSon wants to merge 1 commit into
anthropics:mainfrom
CryptGodSon:fix/samplesheet-csv-quoting

Conversation

@CryptGodSon

Copy link
Copy Markdown

Summary

_write_samplesheet in generate_samplesheet.py built rows with ','.join, so a FASTQ/BAM path containing a comma (e.g. reads,run/sample_R1_001.fastq.gz) was split across several columns. The script reported success, but the resulting file had more data fields than header fields and failed the script's own --validate check.

Changes

  • Write the header and rows with csv.writer, which quotes fields containing commas or quotes.
  • Keep \n line endings (lineterminator='\n', newline=''), so output for ordinary paths is byte-for-byte unchanged.
  • Move import csv to module level (it was previously imported locally in validate_existing_samplesheet).

Fixes #1296

_write_samplesheet joined values with ','.join, so a FASTQ/BAM path
containing a comma (e.g. "reads,run/sample_R1_001.fastq.gz") was split
across several columns. The script reported success, but the file had
more data fields than header fields and failed its own --validate.

Write rows with csv.writer instead, keeping '\n' line endings so output
for ordinary paths is unchanged.

Fixes anthropics#1296
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

generate_samplesheet.py emits malformed CSV when FASTQ paths contain commas

1 participant