Skip to content

Centralize workflow output configuration using nextflow.config #7005

@VasLem

Description

@VasLem

In my use-case, I have the following output block:

output {
    to_publish {
        mode 'copy'
        path { tp->
         def odir = tp[0]
         def files = tp[1..-1]
         def output_root = params.OUTPUT_ROOT.replaceFirst('/\\.\$', "/")
         odir = "${odir}".replace("${output_root}", "")
         println "Publishing ${files } to ${output_root}${odir}"
         odir }
    }
}

that is copied in more than 20 places, as it constitutes the generic way of handling publishable output, through the channel to_publish .
(sidenote, I have been using params.OUTPUT_ROOT, and then outputDir=params.OUTPUT_ROOT because using workflow.outputDir does not actually look into the override in the configuration, it still returns the default value, probably there is an issue with the parsing sequence)

There are discussions during the design of the new pattern here that include a bullet "Move publish options to config". However, I was not able to find any piece of documentation that supports this was implemented after all. I tried to include it in the config with the following way:

workflow {
    output {
      to_publish {
          mode = 'copy'
          path = { tp->
            def odir = tp[0]
            def files = tp[1..-1]
            def output_root = params.OUTPUT_ROOT.replaceFirst('/\\.\$', "/")
            odir = "${odir}".replace("${output_root}", "")
            println "Publishing ${files } to ${output_root}${odir}"
            odir 
          }
      }
  }
  }

but I am getting unrecognized config option 'workflow.output.to_publish.mode' from the Nextflow Language Server.

It might be worthwhile to include a footnote about its support, or lack thereof, in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions