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

flexi_splitter: reformat output file to avoid file name conflict

parent 86b3d5ab
No related branches found
No related tags found
No related merge requests found
......@@ -4,11 +4,26 @@ container_url = "lbmc/flexi_splitter:${version}"
params.split = ""
params.split_out = ""
process split {
workflow split {
take:
reads
config
main:
split_file(reads, config)
split_file.out.fastq.view()
emit:
fastq = split_file.out.fastq
}
process split_file {
// You can get an example of config file here:
// src/nf_modules/flexi_splitter/marseq_flexi_splitter.yaml
container = "${container_url}"
label "big_mem_multi_cpus"
label "big_mem_mono_cpus"
tag "$file_prefix"
if (params.split_out != "") {
publishDir "results/${params.split_out}", mode: 'copy'
......@@ -19,7 +34,7 @@ process split {
tuple val(config_id), path(config)
output:
tuple val(file_id), path("*"), emit: fastq
tuple val(file_id), path("split/*/*"), emit: fastq
script:
if (file_id instanceof List){
......@@ -31,9 +46,25 @@ process split {
if (reads.size() == 2)
"""
flexi_splitter ${params.split} -n 2 -f ${reads[0]},${reads[1]} -o split -c ${config}
rm -Rf split/unassigned
find split -type "f" | \
sed -E "s|(.*/split/(.*)/(.*))|\1 \2_\3|g" |
awk '{"mv "\$1" "\$2"}'
rm -Rf split
mkdir -p results/
find split -type "f" | \
sed -E "s|(.*/split/(.*)/(.*))|\1 \2_\3|g" |
awk '{"mv "\$1" results/"\$2"}'
rm -Rf split
"""
else
"""
flexi_splitter ${params.split} -n 1 -f ${reads[0]} -o split -c ${config}
rm -Rf split/unassigned
mkdir -p results/
find split -type "f" | \
sed -E "s|(.*/split/(.*)/(.*))|\1 \2_\3|g" |
awk '{"mv "\$1" results/"\$2"}'
rm -Rf split
"""
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment