From b034029b59b1198075da8019074bc02051a6100e Mon Sep 17 00:00:00 2001 From: Annick Renevey <47788523+rannick@users.noreply.github.com> Date: Tue, 9 Aug 2022 09:18:37 +0200 Subject: [PATCH] add stub for cat/fastq (#1943) * add stub for cat/fastq * prettier linting --- modules/cat/fastq/main.nf | 29 +++++++++++++++++++++++++++ tests/modules/cat/fastq/test.yml | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/modules/cat/fastq/main.nf b/modules/cat/fastq/main.nf index b6854895..d275f19c 100644 --- a/modules/cat/fastq/main.nf +++ b/modules/cat/fastq/main.nf @@ -48,4 +48,33 @@ process CAT_FASTQ { """ } } + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + def readList = reads.collect{ it.toString() } + if (meta.single_end) { + if (readList.size > 1) { + """ + touch ${prefix}.merged.fastq.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//') + END_VERSIONS + """ + } + } else { + if (readList.size > 2) { + """ + touch ${prefix}_1.merged.fastq.gz + touch ${prefix}_2.merged.fastq.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//') + END_VERSIONS + """ + } + } + } diff --git a/tests/modules/cat/fastq/test.yml b/tests/modules/cat/fastq/test.yml index 56374060..60f3eb60 100644 --- a/tests/modules/cat/fastq/test.yml +++ b/tests/modules/cat/fastq/test.yml @@ -37,3 +37,37 @@ md5sum: 63f817db7a29a03eb538104495556f66 - path: ./output/cat/test_2.merged.fastq.gz md5sum: fe9f266f43a6fc3dcab690a18419a56e + +- name: cat fastq single-end stub + command: nextflow run ./tests/modules/cat/fastq -entry test_cat_fastq_single_end -c ./tests/config/nextflow.config -c ./tests/modules/cat/fastq/nextflow.config -stub-run + tags: + - cat + - cat/fastq + files: + - path: ./output/cat/test.merged.fastq.gz + +- name: cat fastq fastqc_paired_end stub + command: nextflow run ./tests/modules/cat/fastq -entry test_cat_fastq_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/cat/fastq/nextflow.config -stub-run + tags: + - cat + - cat/fastq + files: + - path: ./output/cat/test_2.merged.fastq.gz + - path: ./output/cat/test_1.merged.fastq.gz + +- name: cat fastq single-end-same-name stub + command: nextflow run ./tests/modules/cat/fastq -entry test_cat_fastq_single_end_same_name -c ./tests/config/nextflow.config -c ./tests/modules/cat/fastq/nextflow.config -stub-run + tags: + - cat + - cat/fastq + files: + - path: ./output/cat/test.merged.fastq.gz + +- name: cat fastq fastqc_paired_end_same_name stub + command: nextflow run ./tests/modules/cat/fastq -entry test_cat_fastq_paired_end_same_name -c ./tests/config/nextflow.config -c ./tests/modules/cat/fastq/nextflow.config -stub-run + tags: + - cat + - cat/fastq + files: + - path: ./output/cat/test_1.merged.fastq.gz + - path: ./output/cat/test_2.merged.fastq.gz