diff --git a/modules/cat/fastq/main.nf b/modules/cat/fastq/main.nf index 9b84d0c4..4fa365d3 100644 --- a/modules/cat/fastq/main.nf +++ b/modules/cat/fastq/main.nf @@ -20,7 +20,7 @@ process CAT_FASTQ { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def readList = reads.collect{ it.toString() } + def readList = reads instanceof List ? reads.collect{ it.toString() } : [reads.toString()] if (meta.single_end) { if (readList.size >= 1) { """ @@ -51,7 +51,7 @@ process CAT_FASTQ { stub: def prefix = task.ext.prefix ?: "${meta.id}" - def readList = reads.collect{ it.toString() } + def readList = reads instanceof List ? reads.collect{ it.toString() } : [reads.toString()] if (meta.single_end) { if (readList.size > 1) { """ diff --git a/modules/samtools/merge/main.nf b/modules/samtools/merge/main.nf index 6b105382..91f14116 100644 --- a/modules/samtools/merge/main.nf +++ b/modules/samtools/merge/main.nf @@ -25,7 +25,7 @@ process SAMTOOLS_MERGE { script: def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" - def file_type = input_files[0].getExtension() + def file_type = input_files instanceof List ? input_files[0].getExtension() : input_files.getExtension() def reference = fasta ? "--reference ${fasta}" : "" """ samtools \\ @@ -44,7 +44,7 @@ process SAMTOOLS_MERGE { stub: prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}" - def file_type = input_files[0].getExtension() + def file_type = input_files instanceof List ? input_files[0].getExtension() : input_files.getExtension() """ touch ${prefix}.${file_type} diff --git a/tests/modules/cat/fastq/main.nf b/tests/modules/cat/fastq/main.nf index 1ed23ce5..671d01e2 100644 --- a/tests/modules/cat/fastq/main.nf +++ b/tests/modules/cat/fastq/main.nf @@ -47,3 +47,12 @@ workflow test_cat_fastq_paired_end_same_name { CAT_FASTQ ( input ) } + +workflow test_cat_fastq_single_end_single_file { + input = [ + [ id:'test', single_end:true ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)] + ] + + CAT_FASTQ ( input ) +} diff --git a/tests/modules/cat/fastq/test.yml b/tests/modules/cat/fastq/test.yml index 60f3eb60..416f1a8b 100644 --- a/tests/modules/cat/fastq/test.yml +++ b/tests/modules/cat/fastq/test.yml @@ -38,6 +38,15 @@ - path: ./output/cat/test_2.merged.fastq.gz md5sum: fe9f266f43a6fc3dcab690a18419a56e +- name: cat fastq single-end-single-file + command: nextflow run ./tests/modules/cat/fastq -entry test_cat_fastq_single_end_single_file -c ./tests/config/nextflow.config -c ./tests/modules/cat/fastq/nextflow.config + tags: + - cat + - cat/fastq + files: + - path: ./output/cat/test.merged.fastq.gz + md5sum: e325ef7deb4023447a1f074e285761af + - 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: diff --git a/tests/modules/samtools/merge/main.nf b/tests/modules/samtools/merge/main.nf index 979fb73f..0d01eb72 100644 --- a/tests/modules/samtools/merge/main.nf +++ b/tests/modules/samtools/merge/main.nf @@ -27,3 +27,13 @@ workflow test_samtools_merge_cram { fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) SAMTOOLS_MERGE ( input, fasta, fai ) } + +workflow test_samtools_merge_single_file { + input = [ [ id: 'test' ], // meta map + [ + file(params.test_data['sarscov2']['illumina']['test_paired_end_methylated_sorted_bam'], checkIfExists: true), + ] + ] + + SAMTOOLS_MERGE ( input, [], [] ) +} diff --git a/tests/modules/samtools/merge/test.yml b/tests/modules/samtools/merge/test.yml index fb420a1c..20594a28 100644 --- a/tests/modules/samtools/merge/test.yml +++ b/tests/modules/samtools/merge/test.yml @@ -13,3 +13,12 @@ - samtools/merge files: - path: output/samtools/test.cram + +- name: samtools merge test_samtools_merge_single_file + command: nextflow run ./tests/modules/samtools/merge -entry test_samtools_merge_single_file -c ./tests/config/nextflow.config -c ./tests/modules/samtools/merge/nextflow.config + tags: + - samtools + - samtools/merge + files: + - path: output/samtools/test.bam + md5sum: 6e38ae132fadae4cb4915814d6f872b2