nextflow-io/nextflow

splitCsv handles commas incorrectly when cells contain commas within quoted strings

开放

#4,874 创建于 2024年4月2日

 (4 条评论) (0 个反应) (0 位负责人)Groovy (784 个派生)batch import
good first issuetriage/investigate

仓库指标

星标
 (3,382 个星标)
PR 合并指标
 (平均合并 16天 9小时) (30 天内合并 54 个 PR)

描述

Bug report

I have a csv with cells that contain paired-end fastq globs formatted for use as inputs to fromFilePairs(). This means the globs contain commas (i.e. "data{1,2}.fq.gz"). When using commas as the csv separator, the editor (libreoffice) wraps the fastq strings in quotation marks. When loading this file with splitCsv(), the commas enclosed within the quotes used by libreoffice are treated as cell delimiters rather than as part of the cell contents.

Expected behavior and actual behavior

Given a demo.csv file with the following plaintext contents:

path,ref
"file{1,2}.fq.gz",hg38

I expect that running the following program:

workflow { channel.fromPath("demo.csv") | splitCsv(header: true) | view }

Will produce the output:

[path:file{1,2}.fq.gz", ref:hg38]

It actually outputs:

[path:"file{1, ref:2}.fq.gz"]

Changing the file format to tsv and calling splitCsv with sep: '\t' solves the problem, but I'd like to be able to support csvs as well.

Environment

  • Nextflow version: 23.10.1 build 5891
  • Java version: openjdk 20.0.2-internal 2023-07-18
  • Operating system: Linux
  • Bash version: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

贡献者指南