-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcollectFile.nf
More file actions
executable file
·36 lines (26 loc) · 844 Bytes
/
collectFile.nf
File metadata and controls
executable file
·36 lines (26 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env nextflow
// Collect the full path names of all files in a channel and store these in a metafile,
// supply the metafile as input to a process.
// This is useful for merging processes where the number of input files may run
// to hundreds or thousands.
// See also collectFile-tuple.nf for more extensive comments,
// and collect-into-file.nf.
process star {
output: file('*.txt') into ch_input
script: 'for i in {00..09}; do echo "some F $i content" > f$i.txt; done'
}
ch_input
.collectFile { file -> file.collect{ it.toString() }.join('\n') + '\n' }
.view()
.set{ ch_merge }
process merge {
publishDir "$baseDir/results", mode: 'copy'
input: file metafile from ch_merge
output: file('*.txt')
script:
"""
cat $metafile | while read f; do
cat \$f
done > ttt.txt
"""
}