These are chat archives for nextflow-io/nextflow

8th
Feb 2018
Bioninbo
@Bioninbo
Feb 08 2018 09:20
Hello. Is it possible to publish the same files on multiple directories?
Paolo Di Tommaso
@pditommaso
Feb 08 2018 09:22
not at this time nextflow-io/nextflow#256
Bioninbo
@Bioninbo
Feb 08 2018 09:24
I see. Thanks!
Paolo Di Tommaso
@pditommaso
Feb 08 2018 09:25
welcome
Simone Baffelli
@baffelli
Feb 08 2018 10:59
Stupid question from a groovy layman: can I put all my functions in a separate groovy package and use them in my pipeline?
I cannot make it work somehow, I'm afraid I'm too deep in python-think
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:01
provide an example please
Simone Baffelli
@baffelli
Feb 08 2018 11:04

say I put this function in a file called utils.groovy

package tsutils
Collection dateAndPathFromPath(sun.nio.fs.UnixPath path)
{
    String id = getDateFromPath(path)
    [id, path]
}

In my pipeline I use

import tsutils.*
a = Channel.fromPath("/media/unique/2015_GPRI_Dom/raw/*.tar")
a.map{it->dateAndPathFromPath(it)}

I get the following error message:

ERROR ~ No signature of method: dateAndPathFromPath() is applicable for argument types: (sun.nio.fs.UnixPath) values: [/media/unique/2015_GPRI_Dom/raw/20150709_011432.tar]
Somehow the package is not imported or perhaps I just reason like a python user and that is not possible at all using groovy
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:05
you should put in a class and declare the method static eg
class Foo {

static Collection dateAndPathFromPath(sun.nio.fs.UnixPath path)
{
    String id = getDateFromPath(path)
    [id, path]
}

}
Simone Baffelli
@baffelli
Feb 08 2018 11:06
Ah, I see. Shall I use the classes name everytime I want to use that method?
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:06
tip: it's not a good idea to rely on undocumented classes such as sun.nio.fs.UnixPath
java 9 won't allow to use it anymore
yes Foo.dateAndPathFromPath
or you should import it
import static tsutils.Foo.*
Simone Baffelli
@baffelli
Feb 08 2018 11:08
ok, in that case I can use the methods without referring to their class?
Do you recommend java.file.Path instead?
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:08
yep
Do you recommend java.file.Path instead?
yes
Simone Baffelli
@baffelli
Feb 08 2018 11:09
Excellent, thanks for your help
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:09
:+1:
Simone Baffelli
@baffelli
Feb 08 2018 11:19
Another annoying question: where to put the class?
I've found some examples where the groovy classpath is changed by a script (https://github.com/cerebis/meta-sweeper/blob/master/bash_configure)
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:20
in the lib/ folder in the project root
Simone Baffelli
@baffelli
Feb 08 2018 11:20
ah ok, no need to do so
Simone Baffelli
@baffelli
Feb 08 2018 11:40
It works :sparkles:

But somehow I'm struggling with paths. Suppose that I define:

    static List dateAndPathFromPath(Path path)
    {
        String id = getDateFromPath(path)
        [id, path]
    }

Now when I call my pipeline I get

groovy.lang.MissingMethodException: No signature of method: _nf_script_23413ee1.dateAndPathFromPath() is applicable for argument types: (sun.nio.fs.UnixPath) values: [/media/unique/2015_GPRI_Dom/raw/20150709_011432.tar]
I believe that java.nio.file.Path is an interface, of which sun.nio.fs.UnixPath is an implementation
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:42
exactly like that
Simone Baffelli
@baffelli
Feb 08 2018 11:43
But then why does it complain?
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:44
bit weird
Simone Baffelli
@baffelli
Feb 08 2018 11:45
I think so too
Paolo Di Tommaso
@pditommaso
Feb 08 2018 11:45
it's not invoking your method
it's trying to invoke it as method on your script
try to put the full class qualified name
Simone Baffelli
@baffelli
Feb 08 2018 12:55
where?
ah before the method invokation?
Simone Baffelli
@baffelli
Feb 08 2018 13:12
it works if I use the qualified name
Paolo Di Tommaso
@pditommaso
Feb 08 2018 13:16
If so, your import it's wrong
Maxime Garcia
@MaxUlysse
Feb 08 2018 13:17
Hi @pditommaso
I manage to dissect different parts of our pipeline
But now that I have a couple of nextflow scripts, I obviously have processes scattered in different scripts
So I have this warning WARN: The config file defines settings for an unknown process:
Paolo Di Tommaso
@pditommaso
Feb 08 2018 13:20
seems something is missing in the message
Maxime Garcia
@MaxUlysse
Feb 08 2018 13:20
I think it's quite a convenient warning if you have only one main script
Paolo Di Tommaso
@pditommaso
Feb 08 2018 13:21
that's the complete message?
ah, that happens if the config contains setting for a process not defined in script
makes sense if you are testing only a piece
Maxime Garcia
@MaxUlysse
Feb 08 2018 13:25
There's the process name everytime
So I have like 12 of these message everytime :-D
And sometimes, I got suggestions for a process name
Paolo Di Tommaso
@pditommaso
Feb 08 2018 13:26
that's fine if you are bisecting your script
Maxime Garcia
@MaxUlysse
Feb 08 2018 13:28
I feel like I have a chainsaw, and I'm ripping code appart
strangely satisfying
Paolo Di Tommaso
@pditommaso
Feb 08 2018 13:28
:)
Maxime Garcia
@MaxUlysse
Feb 08 2018 13:29
But definitively needed, it's confusing to brand our cancer pipeline for germline usage
Simone Baffelli
@baffelli
Feb 08 2018 13:52
@pditommaso Probabily it is, I must understand why
But now I'm quite excited to test something else because I may have a nice solution for another problem that was bugging me