These are chat archives for nextflow-io/nextflow

17th
May 2017
Simone Baffelli
@baffelli
May 17 2017 12:09
Hello. Another stupid question: is it possible to emit an HashMap instead of a normal set from a process? Something like
output:
set "name_1":file(something), "name_2":file(something_else) into some_channel
Of course, I could construct it by running a map operator on the channel, but it would be convenient to do so directly at output definition time.
Paolo Di Tommaso
@pditommaso
May 17 2017 12:18
yep
you can do something like
Simone Baffelli
@baffelli
May 17 2017 12:19
in the script?
Paolo Di Tommaso
@pditommaso
May 17 2017 12:19
process bravo {
  output: 
  val map into map_ch 
  script: 
  map = [foo:1, bar: 2]
   '''
   etc 
   ''' 
}
Simone Baffelli
@baffelli
May 17 2017 12:20
:+1: excellent
that's what I thought
:worried: I'm afraid to change it, because all of my cached results will need to be rerun
Paolo Di Tommaso
@pditommaso
May 17 2017 12:25
In what meaning?
Something you have already run?
Simone Baffelli
@baffelli
May 17 2017 12:26
Yes
Paolo Di Tommaso
@pditommaso
May 17 2017 12:26
Shit happens ;)
Simone Baffelli
@baffelli
May 17 2017 12:27
I will find another way, because I realize I was trying to group output channels in the mapping.
Probabily easier to change some other part of my code
Bili Dong
@qobilidop
May 17 2017 20:11

I have a question about sorting files. So I have a process which output files to a channel with different names, for example plot001.png, plot002.png etc. Then in a following process I use those files as input. I’d like to name the files in order so I do

input:
    file ‘plot_*.png' from plot_ch.toSortedList()

But it turns out in the sorting the full path of the file is taken into account so that work/01/dafac1181e4ce560328191077a08b5/plot002.png comes before 26/60a057e1487cface037ab86680b6b5/plot001.png. So what is the appropriate way to sort files based on their file name?

Paolo Di Tommaso
@pditommaso
May 17 2017 20:14
you can provide your custom sorting rule

input:
    file plot from plot_ch.toSortedList { it.name }
Bili Dong
@qobilidop
May 17 2017 20:14
ah, that’s what I need! thanks!
Paolo Di Tommaso
@pditommaso
May 17 2017 20:15
don't specify ‘plot_*.png' otherwise they will be renamed using that pattern
Bili Dong
@qobilidop
May 17 2017 20:15
I should read the doc more carefully
Paolo Di Tommaso
@pditommaso
May 17 2017 20:15
I agree :)