These are chat archives for nextflow-io/nextflow

10th
Nov 2017
Tim Diels
@timdiels
Nov 10 2017 10:10
When a file input receives null, it creates an empty file and uses that instead?
Paolo Di Tommaso
@pditommaso
Nov 10 2017 10:12
yep
Tim Diels
@timdiels
Nov 10 2017 10:17
Any way I can check in Groovy whether it was derived from null, or simply keep null instead?
Paolo Di Tommaso
@pditommaso
Nov 10 2017 10:19
how do you want to use a null file?
Tim Diels
@timdiels
Nov 10 2017 10:21
If there's a file, I add --interpo $interpro to the script args, else I omit it
But in this case an empty file will work because the file has header, so it won't error on it
So I'll stick to this empty file approach. Nice solution
Shawn Rynearson
@srynobio
Nov 10 2017 16:46
Quick question: Is it possible to use publishDir to move different files to different directories from the same process?
Paolo Di Tommaso
@pditommaso
Nov 10 2017 16:52
Yes, look at the savAs option
You must define a closure returning the absolute path for the file you want to publish
Shawn Rynearson
@srynobio
Nov 10 2017 16:53
know of any possible examples?
Shawn Rynearson
@srynobio
Nov 10 2017 17:04

Correct me if I'm wrong, but it seems like saveAs is used to defined "how" you want your file to be save

saveAs: { filename -> filename.replaceFirst(/_pass/, '') }

I was thinking something more like:

process test {

    publishDir directory1 , mode: 'move' //-> result_of_runing_a
    publishDir directory2, mode: 'move' //-> file a

    input:
    set file(a) from channel_a

    output:
    file(result_of_runing_a)
    file(a)

    """
    """
}
Paolo Di Tommaso
@pditommaso
Nov 10 2017 17:05
multiple publishDir are not allowed
ahh, I see
you want to copy the same file twice in different paths
you can't with publishDir
you can still do that with an operator eg
Shawn Rynearson
@srynobio
Nov 10 2017 17:08
I want to take the file from input and post-process move it to it's final location, in addition to moving the result of using the file to another location.
Paolo Di Tommaso
@pditommaso
Nov 10 2017 17:08
process foo {
   output:
    file(result_of_runing_a) into some_ch
   """ 
   some_command
   """
}

some_ch.subscribe { file -> file.copyTo('/path/a'); file.copyTo('/path/b') }
makes sense ?
Shawn Rynearson
@srynobio
Nov 10 2017 17:10
It does. I thought I might be able to handle it via channels, I just wanted to check if it could be done within a process.
thanks!
Paolo Di Tommaso
@pditommaso
Nov 10 2017 17:11
I think at some point we will implement the support for multiple publishDir