nextflow-io / nextflow-io/nextflow

`splitText` does not keep header when `keepHeader` is true and `by` is 1

Open
#5,732 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lang/dataflow
Dominant language
Groovy
Stars
3.5k
Forks
811
Avg merge
2d 11h
Merged PRs (30d)
61

Description

Bug report

When you use splitText on a file with the keepHeader option, it does the opposite of what it's supposed to do.

Expected behavior and actual behavior

keepHeader: true removes the header, and keepHeader:false keeps the header.
The expected behaviour is that it's the other way around.

Steps to reproduce the problem
workflow {
    ch_in = Channel.fromPath('data/*tsv', checkIfExists: true)
    .map { it.splitText( keepHeader: false ).join('') }
    .view()
}

sample_A_1.tsv:

workflow {
    ch_in = Channel.fromPath('data/*tsv', checkIfExists: true)
    .map { it.splitText( keepHeader: false ).join('') }
    .view()
}
Program output
 $ nextflow run main.nf 

 N E X T F L O W   ~  version 24.10.4

Launching `main.nf` [sharp_gates] DSL2 - revision: 54c05059bf

Col1    Col2
sampleA1  tagA
sampleA1  tagB
sampleA1  tagC

Environment
  • Nextflow version: 24.10.4
  • Java version: openjdk 17.0.14-internal 2025-01-21
  • Operating system: Linux
  • Bash version: GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the splitText operator and reproduce the reported behavior using the main.nf workflow and TSV sample described in the issue, comparing keepHeader true and false when by is 1. Done means each setting preserves or removes the header according to its documented meaning, with the behavior verified against the reproduction output.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.