process A {
...
output:
path("*linkedfrag"), emit: lf
path("*hapblock"), emit: hb
publishDir ???
...
}
Is there a way to publish lf to ${params.outdir}/lf/ and hb to ${params.outdir}/hb/ ? I dont want to emit lf as "lf/*linkedfrag" etc
One way would be to actually specify more than one publishDir directive. This approach provides increased flexibility by giving you the option to specify a different set of rules for each directive. To publish your output files to different target directories, you could just use the pattern
parameter to select the files to publish from the overall set of output files:
process A {
publishDir "${params.outdir}/lf", pattern: "*linkedfrag"
publishDir "${params.outdir}/hb", pattern: "*hapblock"
...
}
Another way would be to use the saveAs
parameter to set the required path. This example uses a ternary operator, but you could also use an if/else-if/else block1:
process A {
publishDir (
path: params.outdir,
saveAs: { fn ->
fn.endsWith('linkedfrag') ? "lf/${fn}" :
fn.endsWith('hapblock') ? "hb/${fn}" :
fn
}
)
...
}