Hi,
I’m working on a Nextflow pipeline and I’m trying to figure out if it’s possible to dynamically set the publishDir
for outputs based on the input type. Specifically, I have a process that I use twice for both case and control as a tuple of values and paths, and I want the output to be published to different directories depending on one of the values in the tuple.
Here’s a simplified version of the process I’m working with:
#!/usr/bin/env nextflow
process tupled_data {
publishDir "/home/zeddafir/scripts/nextflow/test_next/case", mode: 'copy', overwrite: true
publishDir "/home/zeddafir/scripts/nextflow/test_next/control", mode: 'copy', overwrite: true
input:
tuple val(sampleName), path(samplePath), val(sampleType)
output:
path(path("${sampleName}.txt"))
script:
"""
echo "${sampleName} content" > ${sampleName}.txt
"""
}