Stage fastq for concat in subfolders to avoid name collision issue (#1107)

* Stage fastq for concat in subfolders in task workdir

* Update main.nf

* Update test.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
This commit is contained in:
Mingda Jin 2021-12-13 11:18:27 -08:00 committed by GitHub
parent 0fafaeebf5
commit 826a5603db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 7 deletions

View file

@ -8,7 +8,7 @@ process CAT_FASTQ {
'biocontainers/biocontainers:v1.2.0_cv1' }"
input:
tuple val(meta), path(reads)
tuple val(meta), path(reads, stageAs: "input*/*")
output:
tuple val(meta), path("*.merged.fastq.gz"), emit: reads
@ -21,7 +21,7 @@ process CAT_FASTQ {
if (meta.single_end) {
if (readList.size > 1) {
"""
cat ${readList.sort().join(' ')} > ${prefix}.merged.fastq.gz
cat ${readList.join(' ')} > ${prefix}.merged.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":
@ -35,8 +35,8 @@ process CAT_FASTQ {
def read2 = []
readList.eachWithIndex{ v, ix -> ( ix & 1 ? read2 : read1 ) << v }
"""
cat ${read1.sort().join(' ')} > ${prefix}_1.merged.fastq.gz
cat ${read2.sort().join(' ')} > ${prefix}_2.merged.fastq.gz
cat ${read1.join(' ')} > ${prefix}_1.merged.fastq.gz
cat ${read2.join(' ')} > ${prefix}_2.merged.fastq.gz
cat <<-END_VERSIONS > versions.yml
"${task.process}":

View file

@ -25,3 +25,25 @@ workflow test_cat_fastq_paired_end {
CAT_FASTQ ( input )
}
workflow test_cat_fastq_single_end_same_name {
input = [
[ id:'test', single_end:true ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]
]
CAT_FASTQ ( input )
}
workflow test_cat_fastq_paired_end_same_name {
input = [
[ id:'test', single_end:false ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) ]
]
CAT_FASTQ ( input )
}

View file

@ -5,7 +5,7 @@
- cat/fastq
files:
- path: ./output/cat/test.merged.fastq.gz
md5sum: 59f6dbe193741bb40f498f254aeb2e99
md5sum: f9cf5e375f7de81a406144a2c70cc64d
- name: cat fastq fastqc_paired_end
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
@ -14,6 +14,26 @@
- cat/fastq
files:
- path: ./output/cat/test_2.merged.fastq.gz
md5sum: d2b1a836eef1058738ecab36c907c5ba
md5sum: 77c8e966e130d8c6b6ec9be52fcb2bda
- path: ./output/cat/test_1.merged.fastq.gz
md5sum: 59f6dbe193741bb40f498f254aeb2e99
md5sum: f9cf5e375f7de81a406144a2c70cc64d
- name: cat fastq single-end-same-name
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
tags:
- cat
- cat/fastq
files:
- path: ./output/cat/test.merged.fastq.gz
md5sum: 63f817db7a29a03eb538104495556f66
- name: cat fastq fastqc_paired_end_same_name
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
tags:
- cat
- cat/fastq
files:
- path: ./output/cat/test_1.merged.fastq.gz
md5sum: 63f817db7a29a03eb538104495556f66
- path: ./output/cat/test_2.merged.fastq.gz
md5sum: fe9f266f43a6fc3dcab690a18419a56e