Skip to content
Snippets Groups Projects
Verified Commit 192fef09 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

bowtie2: change file_id handling

parent 5a367584
Branches
No related tags found
No related merge requests found
...@@ -125,15 +125,22 @@ process fastp { ...@@ -125,15 +125,22 @@ process fastp {
Here `file_id` can be anything from a simple identifier to a list of several variables. Here `file_id` can be anything from a simple identifier to a list of several variables.
In which case the first item of the List should be usable as a file prefix. In which case the first item of the List should be usable as a file prefix.
So you have to keep that in mind if you want to use it to define output file names (you can test for that with `file_id instanceof List`). So you have to keep that in mind if you want to use it to define output file names (you can test for that with `file_id instanceof List`).
In some case, the `file_id` may be a Map to have a cleaner access to the `file_id` content by explicit keywords.
If you want to use information within the `file_id` to name outputs in your `script` section, you can use the following snipet: If you want to use information within the `file_id` to name outputs in your `script` section, you can use the following snipet:
```Groovy ```Groovy
script: script:
if (file_id instanceof List){ switch(file_id) {
file_prefix = file_id[0] case {it instanceof List}:
} else { file_prefix = file_id[0]
file_prefix = file_id break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_id
break
} }
``` ```
......
...@@ -56,10 +56,16 @@ process mapping_fastq { ...@@ -56,10 +56,16 @@ process mapping_fastq {
index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1] index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
} }
} }
if (file_id instanceof List){ switch(file_id) {
file_prefix = file_id[0] case {it instanceof List}:
} else { file_prefix = file_id[0]
file_prefix = file_id break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_id
break
} }
if (reads.size() == 2) if (reads.size() == 2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment