These are chat archives for nextflow-io/nextflow

19th
Apr 2017
Tim Diels
@timdiels
Apr 19 2017 10:29
How do you, given a channel containing [[1, Path('fileA')], [0, Path('fileB')], ...], inject files as input to a process such that they are named species0.fa, species1.fa, ... where the number corresponds to the numbers in the input list?
Paolo Di Tommaso
@pditommaso
Apr 19 2017 10:45
process foo {
  input: 
  set id, file("species${id}.fa") from bar
  .. 
}
Tim Diels
@timdiels
Apr 19 2017 10:50
And what if I want the whole list of files at once, i.e. bar.toList()?
Paolo Di Tommaso
@pditommaso
Apr 19 2017 10:51
with or without the ids ?
Tim Diels
@timdiels
Apr 19 2017 10:56
ids aren't necessary, they are only used to generate the filename
Paolo Di Tommaso
@pditommaso
Apr 19 2017 10:58
if so you can do the following
source_channel.map { it, file -> file } .collect().set { bar }

process foo {
  input:
  file("species*.fa") from bar
}
or

process foo {
  input:
  file("species*.fa") from bar.map { it, file -> file } .collect()
}
Tim Diels
@timdiels
Apr 19 2017 11:10
Oh, I meant I don't need the ids in the process script, but I do need them as part of the filename, i.e. "species${id}.fa"
and I'd be interested to see how to do it without assuming that the ids are a consecutive range starting at 0
Paolo Di Tommaso
@pditommaso
Apr 19 2017 11:37
the last snippet will rename the fasta as species0.fa, species1.fa, etc
Tim Diels
@timdiels
Apr 19 2017 11:50
Ok, when first sorting bar, that does fit my current use case, thanks
Tim Diels
@timdiels
Apr 19 2017 12:27
To use -pe serial 16 instead of -l slots=16, I have to unset cpus and use clusterOptions? Our cluster doesn't like slots:
Command output:
  Unable to run job: "job" denied: use parallel environments instead of requesting slots explicitly
Tim Diels
@timdiels
Apr 19 2017 12:58
Never mind, found it: "Would be nice if instead there was a pe directive, oh wait, there is"
Tim Diels
@timdiels
Apr 19 2017 13:13
@pditommaso About that earlier question, it starts at 1, i.e. species1.fa, species2.fa. How do I make it start at species0.fa? I'm trying to run orthofinder, it uses that number to match the fasta to blast hits named like 0_1 where 0 refers to species0.fa
I could do it with an additional process just to rename the files but was wondering whether there's a better way?