These are chat archives for nextflow-io/nextflow

22nd
Mar 2019
Rad Suchecki
@rsuchecki
Mar 22 00:07
@micans yes that looks even neater! My (perhaps wrong) assumption was that the 'd' record was the last one to be skipped and not the first one to include @lebernstein
Laurence E. Bernstein
@lebernstein
Mar 22 00:54
@rsuchecki @micans Yes. The goal was to grab everything after the marker. Thanks for all the suggestions. I knew you guys would have some slick methods.
Paolo Di Tommaso
@pditommaso
Mar 22 06:51
@olgabot the simplest way it to specify it as param eg. Channel.fromSRA(<query term>, apiKey: 'secret'). I was not aware of .ncbi can you please provide more details
micans
@micans
Mar 22 11:59

@rsuchecki @lebernstein ah yes then Rad's solution is the one. A tweaked version of mine that is equivalent would be

a.filter{ found || (it == 'd' && (found = true) && false ) }

but there is not much difference anymore then.

Paolo Di Tommaso
@pditommaso
Mar 22 12:36
what's this a boolean puzzle ;)
IMO
(found = true) && false ) => found = true && false => true && false => false
micans
@micans
Mar 22 13:48
@pditommaso yes that's right, but next time it will be true ..
Luca Cozzuto
@lucacozzuto
Mar 22 16:50
hi all! A trivial (I hope) question... :) I have a number of files collected with .collect() I would like to pass them to a program that needs to call them as --par FILE1 --par FILE2 --par FILE3 etc...
how can I do that?
process myprocess {
    input:
    file(file_list) from myfiles.collect()

    script:
    """
    echo ${file_list}
    """
}
process myprocess {
    input:
    file(file_list) from myfiles.collect()

    script:
    my params = file_list.DOSOMEMAGICS()
    """
    echo ${params}
    """
}
micans
@micans
Mar 22 18:17
@lucacozzuto my params = file_list.collect{ "--par $it" }.join(' ')
micans
@micans
Mar 22 18:23
Interestingly groovy collect is what other languages usually call something like map or apply. Still can't get my head around it being called collect.
Tobias "Tobi" Schraink
@tobsecret
Mar 22 18:41
Yeah, collect is a bit unintuitive. I always think of it as just converting a channel into a list but then it can simultaneously also use map. You could technically also first collect and then map.
file_list.collect().map{ "--par $it" }.join(' ') more wordy for sure but should also work