Skip to content

Fix malformed CSV in generate_samplesheet.py when paths contain commas - #1378

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

08raviyadav wants to merge 1 commit into
anthropics:mainfrom
08raviyadav:fix/samplesheet-csv-quoting-1296

Conversation

@08raviyadav

Copy link
Copy Markdown

Summary

Fixes #1296: generate_samplesheet.py reported success but wrote a malformed samplesheet whenever a FASTQ path contained a comma (for example, reads stored in a reads,run/ directory).

Cause

_write_samplesheet() assembled rows with ','.join(values), so a comma inside any value became a field separator. With a comma in the input directory, the 4-column rnaseq header was followed by a 6-field data row, and the tool's own --validate then rejected the file it had just written (missing FASTQ paths, invalid strandedness).

Change

bio-research/skills/nextflow-development/scripts/generate_samplesheet.py only:

  • Write the samplesheet with csv.writer (minimal quoting, \n line terminator to keep the existing file format). Values containing commas are now quoted as single fields; values without special characters are written exactly as before.

Verification

Reproduced the issue steps locally, before and after the change:

  • Before: generation exits 0, header parses as 4 fields, data row parses as 6 fields, --validate fails (exit 1).
  • After: header and data row both parse as 4 fields with the comma paths quoted, and --validate passes ("Samplesheet is valid for rnaseq").
  • Regression check: a comma-free input directory produces byte-identical output to the old writer.

@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.

@github-actions github-actions Bot closed this Oct 22, 2026
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