A minimal example + query
Closed this issue · 2 comments
john-alexander commented
Was trying to reproduce this example and came across a few issues with it
- p1.out.output_ch2 | p2 | p3 # there is no p3 process in the example
- Does both head.txt and tail.txt get stored in output_ch2?
Needed to included gzip -f otherwise
Command error:
gzip: tail.txt: Too many levels of symbolic links
Also I only seem to get tail.txt.gz in output_folder
Here's my modified version
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
params.outdir = "output_folder"
// Create input channel. Each .txt path is one element.
input_ch = Channel.fromPath( "*.txt" )
workflow {
input_ch | p1
p1.out.output_ch2 | p2
}
process p1 {
// Run locally instead of HPC or Cloud
//executor 'local'
input:
path(x)
output:
path("head.txt")
/* p2.out will include all output paths
from p2, whereas emit gives this
specific channel a name */
path("tail.txt"), emit: output_ch2
"""
head $x > head.txt
tail $x > tail.txt
"""
}
process p2 {
//executor 'local'
// Copy paths out of the working directory
publishDir params.outdir, mode:'copy'
input:
path(y)
output:
path("*.gz")
"""
gzip $y
"""
}
chlazaris commented
Thank you, @john-alexander. I have now updated this. In order to save both .gzip
files to the output directory without changing the process p2
, I ended up saving the processes in modules, so that I call p2
twice in the workflow
definition. There are probably other solutions too but this is the one that came to mind.
chlazaris commented
Now, this issue has been resolved