add nextflow d30e48d
This commit is contained in:
13
nextflow/docs/snippets/grouptuple-groupkey.nf
Normal file
13
nextflow/docs/snippets/grouptuple-groupkey.nf
Normal file
@@ -0,0 +1,13 @@
|
||||
channel.of(
|
||||
['chr1', ['/path/to/region1_chr1.vcf', '/path/to/region2_chr1.vcf']],
|
||||
['chr2', ['/path/to/region1_chr2.vcf', '/path/to/region2_chr2.vcf', '/path/to/region3_chr2.vcf']],
|
||||
)
|
||||
.flatMap { chr, vcfs ->
|
||||
vcfs.collect { vcf ->
|
||||
tuple(groupKey(chr, vcfs.size()), vcf) // preserve group size with key
|
||||
}
|
||||
}
|
||||
.view { v -> "scattered: ${v}" }
|
||||
.groupTuple()
|
||||
.map { key, vcfs -> tuple(key.getGroupTarget(), vcfs) } // unwrap group key
|
||||
.view { v -> "gathered: ${v}" }
|
||||
Reference in New Issue
Block a user