These are chat archives for nextflow-io/nextflow

24th
May 2018
Luca Cozzuto
@lucacozzuto
May 24 2018 12:32
Hi all, when you concat a empty channel (create with Channel.create() ) to an existing one what do you expect?
My script is simply waiting forever...
Paolo Di Tommaso
@pditommaso
May 24 2018 12:35
empty channel != Channel.create()
in the same way null != undefined
Luca Cozzuto
@lucacozzuto
May 24 2018 12:35
aha
so Channel.empty?
Paolo Di Tommaso
@pditommaso
May 24 2018 12:36
in principle you won't need any of them
Luca Cozzuto
@lucacozzuto
May 24 2018 12:37
I hate principles :)
Paolo Di Tommaso
@pditommaso
May 24 2018 12:37
you hate also practice :)
Luca Cozzuto
@lucacozzuto
May 24 2018 12:38
the idea is to have empty channels for collecting files used in a downstream process
some of the channels can or cannot be generated depending on some parameters
Paolo Di Tommaso
@pditommaso
May 24 2018 12:40
umm, I guess you put the proc inside an if therefore the channel is never invoked => it hang
use when instead of an if
Luca Cozzuto
@lucacozzuto
May 24 2018 12:41
can I use when to call or not a input channel?
i.e.
I have one condition where I run 2 processes -> 2 output channels
and another that trigger one process -> only 1 output channel
at the end I would like to collect every output in a final process
Paolo Di Tommaso
@pditommaso
May 24 2018 12:46
process foo {
  output: file 'x' into foo_ch
   when:
   condition
}

process bar {
  output: file 'x' into bar_ch
  when:
  !condition 
}

foo_ch.mix(bar_ch).println()
Luca Cozzuto
@lucacozzuto
May 24 2018 12:47
I'll try
Vladimir Kiselev
@wikiselev
May 24 2018 14:00
@pditommaso I remember at some point you showed how to put processes in script files, but I can’t find it now! (looks like gitter does not have any search function). Could you please let me know if it is available somewhere? Or could you repeat please? My plan is to modularize our pipelines using git submodules.
Venkat Malladi
@vsmalladi
May 24 2018 14:01
yep
Vladimir Kiselev
@wikiselev
May 24 2018 14:01
Oh yes, probably it was also your @vsmalladi ? I can’t find anything here...
working on the submodule part as well as docker
but this uses scripts
Vladimir Kiselev
@wikiselev
May 24 2018 14:04
ok, makes sense with third-party scripts, thanks! But @pditommaso also showed how to wrap processes in a script file
Venkat Malladi
@vsmalladi
May 24 2018 14:04
oh that would be nice to do
Vladimir Kiselev
@wikiselev
May 24 2018 14:11
Cool, thanks! Didn’t you also show at some point how it is possible to put the whole process description in a script?
not just the process script
Paolo Di Tommaso
@pditommaso
May 24 2018 14:12
nope that's not possible
Vladimir Kiselev
@wikiselev
May 24 2018 14:16
Hmm, I definitely remember ;-)
Paolo Di Tommaso
@pditommaso
May 24 2018 14:17
ummm, I don't! :)
Venkat Malladi
@vsmalladi
May 24 2018 14:17
that would be nice
But the best workaround is scripts
Vladimir Kiselev
@wikiselev
May 24 2018 14:18
it had some groovy scripting involved, or maybe a groove module/file
well, if not, then we def use templates
Paolo Di Tommaso
@pditommaso
May 24 2018 14:19
may you are referring
process foo {
  input:
  file x from z 
  script:
  JavaOrGroovyClass.customHelper('your',x)
}
Vladimir Kiselev
@wikiselev
May 24 2018 14:20
Yep, how does this work?
oh, so you still define inputs in the main.nf...
Paolo Di Tommaso
@pditommaso
May 24 2018 14:21
yes (and outputs)
Vladimir Kiselev
@wikiselev
May 24 2018 14:22
Yep, I see, ok, maybe my memory is not working well today ;-) thanks a lot, we’ll go with templates then
Paolo Di Tommaso
@pditommaso
May 24 2018 14:22
:ok_hand:
Luca Cozzuto
@lucacozzuto
May 24 2018 14:35
Hi Paolo is this correct?
channel1 = channel2.flatten().collate(3)
I obtain that channel1 = channel2
Luca Cozzuto
@lucacozzuto
May 24 2018 14:42
I also tried
channel1 = Channel.from(channel2.flatten().collate(3))
senthil10
@senthil10
May 24 2018 16:48

Hello @pditommaso Is there any neat way to assign the value emitted from a channel (which only emits one value) directly to a variable

So the (maybe ugly) hack I have right now is

def someValue = null
myChannel.subscribe { someValue = it }

but I am looking for something like (if possible)

def someValue = myChannel.someMagic()
Paolo Di Tommaso
@pditommaso
May 24 2018 17:11
@senthil10 def someValue = myChannel.getVal(), but remember that this is blocking
@lucacozzuto syntax is correct, but I have no crystal ball to understand what you are doing :smile:
Ashley S Doane
@DoaneAS
May 24 2018 18:29
hi all, is using conda in script e.g. source activate <env> working- do I need to update to a development version to use? thanks
or like this:
process foo {
 conda 'some/path/env.yml'
    '''
    bwa || true
    STAR || true
    '''
}
Paolo Di Tommaso
@pditommaso
May 24 2018 18:40
yes, you need the latest snapshot eg
NXF_VER=0.30.0-SNAPSHOT nextflow run .. etc
Ashley S Doane
@DoaneAS
May 24 2018 18:56
great thanks much @pditommaso
Paolo Di Tommaso
@pditommaso
May 24 2018 18:58
nice, let me know if it works fine.