Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented description of keepHeader in collectFile doesn't match what happens #5734

Open
mahesh-panchal opened this issue Jan 31, 2025 · 0 comments

Comments

@mahesh-panchal
Copy link
Contributor

Bug report

In the documentation, it describes the keepHeader option of collectFile as "Prepend the resulting file with the header fetched in the first collected file", but this is not what happens in practice.

Expected behavior and actual behavior

The expected behaviour should be: "Prepend the resulting file with the header fetched in the first collected file".

The actual behaviour is that it keeps the header of all input files, not just the first.

Steps to reproduce the problem

workflow {
    TASK(Channel.of(1..3))
    ch_metrics = TASK.out
        .collectFile( keepHeader: true, skip: 1 , sort: false )
        .view { it.text }
}

process TASK {
    input:
    val id

    script:
    """
    cat <<-EOF > sample${id}.tsv
    assembly\tnum. contigs\tN50
    $id\t3\t40
    EOF
    """

    output:
    path "*.tsv"
}

Program output

$ nextflow run main.nf

 N E X T F L O W   ~  version 24.10.4

Launching `main.nf` [loving_faggin] DSL2 - revision: f077c6d708

executor >  local (3)
[96/8d2d4d] TASK (1) [100%] 3 of 3 ✔
assembly        num. contigs    N50
3       3       40

assembly        num. contigs    N50
2       3       40

assembly        num. contigs    N50
1       3       40

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants