How to create a dict from the list using nextflow to map groupkey

41 views Asked by At

I have a list in nextflow chr_frequency.toList().view()

[[chr1, 70], [chr2, 50], [chr3, 45]] 

and wnat to convert into a map like:

[ "chr1": 70, "chr2": 50, "chr2": 45 ] 

I need this format to map with groupKey

test.out.map { chr, bcf -> tuple( groupKey(chr, chr_frequency[chr]), bcf.flatten() ) }.groupTuple( by: 0 ).view()

I have tried:

chr_frequency
    .flatten()
    .view()
chr21
3
chr22
3
    .toSpreadMap()

"Missing process or function toSpreadMap()"

try2

chr_frequency
    .collate(2).collectEntries().view()  

Missing process or function collectEntries()

using ubuntu 22.04 - openjdk version "11.0.22" 2024-01-16

0

There are 0 answers