These are chat archives for nextflow-io/nextflow

25th
Jan 2018
Simone Baffelli
@baffelli
Jan 25 2018 09:31
Good morning! Another stupid question: is it possible to manually create a list multiple output files to simulate the behavior of file(fileName:globPattern)?
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:39
is that file function or file process input declaration ?
Simone Baffelli
@baffelli
Jan 25 2018 09:41
file process output
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:42
of course
Simone Baffelli
@baffelli
Jan 25 2018 09:42
:+1:
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:42
output: file('your*_{pattern,here}')
Simone Baffelli
@baffelli
Jan 25 2018 09:42
well yes, to capture them
but what if I want to set them manually?
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:43
what does it mean ?
Simone Baffelli
@baffelli
Jan 25 2018 09:44
I have a set of inputs and I want to apply different type of processing to each of them but still keep them together as a list
but perhaps I can still capture them with a pattern
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:45
you should be able provide different patterns separating them with :
Simone Baffelli
@baffelli
Jan 25 2018 09:45
that is excellent
so I can provide "exactly matching" patterns
that only match a single filename?
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:46
we agree that's the syntax ?
output: file('foo.txt')
then you can write
output: file('foo.txt:bar.txt')
or
Simone Baffelli
@baffelli
Jan 25 2018 09:47
yes!!
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:47
output: file('{foo,bar}.txt')
or
Simone Baffelli
@baffelli
Jan 25 2018 09:47
exactly this
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:47
output: file('{foo,bar}.txt:foo.{csv,tsv}')
not sure about the last :)
Simone Baffelli
@baffelli
Jan 25 2018 09:48
NF is so intricate that not even its developer knows? :wink:
Paolo Di Tommaso
@pditommaso
Jan 25 2018 09:49
I have a very bad memory ;)
Maxime Borry
@maxibor
Jan 25 2018 11:07

Good morning everyone, and thanks for your involvement in Nextflow :)
I'm very new to nextflow, and I'm still trying to figure most things out.

Just now, I need to run a tool that takes paired end reads separately in the following form:

mytool --read1 forward.fq.gz --read2 reverse.fq.gz
If I understood correctly the nextflow/groovy syntax, when I create a channel with fromFilePairs, I would need to do:
mytool --read1 $reads[1][0] --read2 $reads[1][1]
Am I right ?
Paolo Di Tommaso
@pditommaso
Jan 25 2018 11:11
well, it depends
in most cases you can just to tool --reads $reads
if it's to get both read file names in the same command line options
otherwise you should do
mytool --read1 ${reads[0]} --read2 ${reads[1]}
reads is an array, hence use [n] to access the n-th name
Maxime Borry
@maxibor
Jan 25 2018 11:14
Thanks !
Paolo Di Tommaso
@pditommaso
Jan 25 2018 11:15
welcome
Maxime Borry
@maxibor
Jan 25 2018 11:15
However, I thought the first element of the array was the basename, and the second element, the reads locations.
Like in the doc [SRR493366, [/my/data/SRR493366_1.fastq, /my/data/SRR493366_2.fastq]]

I think I've figured it out...
I do

input:
    set val(name), file(reads) from raw_reads_trimming

So I guess it slices the array in name and reads at this step

Maxime Borry
@maxibor
Jan 25 2018 11:24
Thanks a lot @pditommaso !
Paolo Di Tommaso
@pditommaso
Jan 25 2018 11:25
yes, exactly
Maxime Borry
@maxibor
Jan 25 2018 16:19

Back at it, I'm now trying to apply a process only on some files, and therefore use the .filter: I'm trying to apply this process only on files having a given name, and not on others.
Here is what I'm doing:

myprocess {

    input:
    set val(name), file(reads) from my_reads
        .filter(name =~ /pattern/)

    output:
    file '*.txt' into tmp_out

    '''
    echo "hello world" > tmp.txt
    '''
}

However, it seems that I'm doing something wrong since I get an error ERROR ~ No such variable: name

Paolo Di Tommaso
@pditommaso
Jan 25 2018 16:20
the filter should be my_reads.filter{name =~ /pattern/}
the curly brackets are needed to define the filtering criteria
but in any case you won't be able to access the name in that way
you can do my_reads.filter{name, files -> name =~ /pattern/}
I think you need to digest the closure concept to understand the above syntax
Maxime Borry
@maxibor
Jan 25 2018 16:42
I'll try to digest the closures. Thanks !
Paolo Di Tommaso
@pditommaso
Jan 25 2018 16:43
:)
Félix C. Morency
@fmorency
Jan 25 2018 19:38
How is the CPU-Hours metric in the html report calculated?
Paolo Di Tommaso
@pditommaso
Jan 25 2018 19:45
sum(task realtime * num cpus)
Félix C. Morency
@fmorency
Jan 25 2018 19:50
:+1: