Skip to content

Instantly share code, notes, and snippets.

@tobsecret
Created February 11, 2019 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobsecret/80426d7cf9bddfce4a10a1b479ff7f0a to your computer and use it in GitHub Desktop.
Save tobsecret/80426d7cf9bddfce4a10a1b479ff7f0a to your computer and use it in GitHub Desktop.
Creating a map from a channel of lists in NextFlow
// 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