Created
February 11, 2019 17:05
-
-
Save tobsecret/80426d7cf9bddfce4a10a1b479ff7f0a to your computer and use it in GitHub Desktop.
Creating a map from a channel of lists in NextFlow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example on how to create a map from a channel: | |
samples = Channel.from(['1', file('1')], ['1_1', file('1_1')], ['1_2', file('1_2')], ['1_2_1', file('1_2_1')]) | |
samples.reduce([:]) { map, i -> | |
map[i[0]]=i[1] | |
return map | |
}.println() | |
//prints: [1:/home/user/1, 1_1:/home/user/1_1, 1_2:/home/user/1_2, 1_2_1:/home/user/1_2_1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment