mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-15 06:03:10 +00:00
826a5603db
* 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>
48 lines
1.6 KiB
Text
48 lines
1.6 KiB
Text
process CAT_FASTQ {
|
|
tag "$meta.id"
|
|
label 'process_low'
|
|
|
|
conda (params.enable_conda ? "conda-forge::sed=4.7" : null)
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
'https://containers.biocontainers.pro/s3/SingImgsRepo/biocontainers/v1.2.0_cv1/biocontainers_v1.2.0_cv1.img' :
|
|
'biocontainers/biocontainers:v1.2.0_cv1' }"
|
|
|
|
input:
|
|
tuple val(meta), path(reads, stageAs: "input*/*")
|
|
|
|
output:
|
|
tuple val(meta), path("*.merged.fastq.gz"), emit: reads
|
|
path "versions.yml" , emit: versions
|
|
|
|
script:
|
|
def args = task.ext.args ?: ''
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
|
def readList = reads.collect{ it.toString() }
|
|
if (meta.single_end) {
|
|
if (readList.size > 1) {
|
|
"""
|
|
cat ${readList.join(' ')} > ${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) {
|
|
def read1 = []
|
|
def read2 = []
|
|
readList.eachWithIndex{ v, ix -> ( ix & 1 ? read2 : read1 ) << v }
|
|
"""
|
|
cat ${read1.join(' ')} > ${prefix}_1.merged.fastq.gz
|
|
cat ${read2.join(' ')} > ${prefix}_2.merged.fastq.gz
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
"${task.process}":
|
|
cat: \$(echo \$(cat --version 2>&1) | sed 's/^.*coreutils) //; s/ .*\$//')
|
|
END_VERSIONS
|
|
"""
|
|
}
|
|
}
|
|
}
|