mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-23 11:38:17 +00:00
e937c7950a
* Update README * Rename pytest_software.yml to pytest_modules.yml * Rename main software directory to modules * Remove deprecated modules * Rename tests software to modules * Replace paths for tests in pytest_modules.yml * Replace software with modules in Github Actions * Replace software with modules in main.nf tests * Rename software to modules in test.yml
47 lines
1.6 KiB
Text
47 lines
1.6 KiB
Text
// Import generic module functions
|
|
include { initOptions; saveFiles } from './functions'
|
|
|
|
params.options = [:]
|
|
options = initOptions(params.options)
|
|
|
|
process CAT_FASTQ {
|
|
tag "$meta.id"
|
|
label 'process_low'
|
|
publishDir "${params.outdir}",
|
|
mode: params.publish_dir_mode,
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'merged_fastq', meta:meta, publish_by_meta:['id']) }
|
|
|
|
conda (params.enable_conda ? "conda-forge::sed=4.7" : null)
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
container "https://containers.biocontainers.pro/s3/SingImgsRepo/biocontainers/v1.2.0_cv1/biocontainers_v1.2.0_cv1.img"
|
|
} else {
|
|
container "biocontainers/biocontainers:v1.2.0_cv1"
|
|
}
|
|
|
|
input:
|
|
tuple val(meta), path(reads)
|
|
|
|
output:
|
|
tuple val(meta), path("*.merged.fastq.gz"), emit: reads
|
|
|
|
script:
|
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
|
def readList = reads.collect{ it.toString() }
|
|
if (meta.single_end) {
|
|
if (readList.size > 1) {
|
|
"""
|
|
cat ${readList.sort().join(' ')} > ${prefix}.merged.fastq.gz
|
|
"""
|
|
}
|
|
} else {
|
|
if (readList.size > 2) {
|
|
def read1 = []
|
|
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
|
|
"""
|
|
}
|
|
}
|
|
}
|