These are chat archives for nextflow-io/nextflow

23rd
Feb 2018
Maxime Borry
@maxibor
Feb 23 2018 10:41
Here is what ended up working for me @caspargross :
process trimming {
        tag "$name"
        cpus = 8

        input:
            set val(name), file(read1), file(read2) from raw_reads
        output:
            set val(name), file(out1), file(out2) into trimmed_reads

        script:
            out1 = name+".trimmed.1.fastq"
            out2 = name+".trimmed.2.fastq"
            """
            trimmer --basename $name --file1 $read1 --file2 $read2 --output1 $out1 --output2 $out2 --threads ${task.cpus}
            """
    }
Paolo Di Tommaso
@pditommaso
Feb 23 2018 10:44
equals in directives are not necessary
cpus 8 instead of cpus = 8
Bioninbo
@Bioninbo
Feb 23 2018 11:16
Hello,
Can we use multiple containers per process? For instance sometimes I need to load different R libraries, or I want to combine samtools with bedtools in a single process. So far I have created a container with all tools that I need in these situations. However it would be more convenient to combine pre-made containers with a single function. Is it possible?
Maxime Garcia
@MaxUlysse
Feb 23 2018 11:23
you can have multicontainers for the pipeline, but not for the process
If you need samtools and bedtools, better make a container with both
We had a similar issue with Sarek
It was far too complicated to have a container for the whole pipeline
so I made a container for each process
And then I though a little more, and end up merging some containers together
Bioninbo
@Bioninbo
Feb 23 2018 11:31
I see. I'm doing the same, but I just wanted to check if it was the only way. Thanks @pditommaso @MaxUlysse
Bioninbo
@Bioninbo
Feb 23 2018 14:32
Hi again. Is it possible to use a variable with the includeConfig command ? For instance when I do includeConfig "$PWD/config/control.config" I get the error Unknown config attribute and includeConfig '$PWD/config/control.config' doesn't interpret the variable
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:33
in principle yes, but you won't need to use $PWD
Maxime Garcia
@MaxUlysse
Feb 23 2018 14:33
:+1:
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:33
relative paths are resolved against the location of the parent config file
Bioninbo
@Bioninbo
Feb 23 2018 14:36
Not sure I understand here. How should I do to use a variable with includeConfig?
In my case, I am calling the script from another directory and would like to use a config file from that directory (in addition to config files from the script directory)
Maxime Garcia
@MaxUlysse
Feb 23 2018 14:37
your relative path is calculated from the nextflow.config file where your script is
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:39
however in principle the var should work, it seems a but
Maxime Garcia
@MaxUlysse
Feb 23 2018 14:39
yes, that's strange
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:39
please open an issue including a reproducible test case
Bioninbo
@Bioninbo
Feb 23 2018 14:39
It needs double quotes to be interpreted, however only single quotes are accepted it seems
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:40
sigle quote it's a raw string, hence the variable is not interpreted
Bioninbo
@Bioninbo
Feb 23 2018 14:41
my bad, double quotes works with variables, but not with $PWD
Maxime Garcia
@MaxUlysse
Feb 23 2018 14:43
have you tried ${PWD}?
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:44
I guess it's the same
Maxime Garcia
@MaxUlysse
Feb 23 2018 14:44
that's my guess too
But wait, you want to use ENV variables
shouldn't you escape them?
\$PWD maybe?
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:45
nope, env variable should be directly accessible from the config file
Bioninbo
@Bioninbo
Feb 23 2018 14:45
yes I tried none of these works
Maxime Garcia
@MaxUlysse
Feb 23 2018 14:45
ok
Bioninbo
@Bioninbo
Feb 23 2018 14:52
I solved it this way: String workingDir = System.getProperty("user.dir"); includeConfig "${workingDir}/config/control.config"
Paolo Di Tommaso
@pditommaso
Feb 23 2018 14:56
btw includeConfig "$PWD/config/control.config" just works
Bioninbo
@Bioninbo
Feb 23 2018 14:58
Ah yes right. Sorry for bothering you then, I did something wrong somehow
Thanks for the help @pditommaso and @MaxUlysse
Paolo Di Tommaso
@pditommaso
Feb 23 2018 15:01
:+1:
Maxime Garcia
@MaxUlysse
Feb 23 2018 15:06
:bird:
There is no rubber duck emoticon here...
Bioninbo
@Bioninbo
Feb 23 2018 15:09
:baby_chick:
Maxime Garcia
@MaxUlysse
Feb 23 2018 15:09
good catch
Caspar
@caspargross
Feb 23 2018 16:15

How is it possible to do simple calculations with bash the script part of a process?

params.a = 3
params.b = 4

process multiply {

    """
    echo $(( ${params.a} * ${params.b} )) > file.txt
    """
}

this script does not work...

Paolo Di Tommaso
@pditommaso
Feb 23 2018 16:15
let's start from the gitter formatting
triple ` then new-line :)
good
you need to escape the bash $

    """
    echo \$(( ${params.a} * ${params.b} )) > file.txt
    """
no wait
 """
    echo \$(( ${params.a * params.b} )) > file.txt
 """
Luca Cozzuto
@lucacozzuto
Feb 23 2018 16:17
I recommend this
echo "${params.a} * ${params.b}" | bc -l
Caspar
@caspargross
Feb 23 2018 16:17
ah ok I see, thank you!
Paolo Di Tommaso
@pditommaso
Feb 23 2018 16:17
:+1:
Bioninbo
@Bioninbo
Feb 23 2018 16:42
On a regular server I should use the local executor I guess?
Phil Ewels
@ewels
Feb 23 2018 16:48
Yup
Bioninbo
@Bioninbo
Feb 23 2018 16:49
I see thanks