mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-11 04:33:10 +00:00
59 lines
2.2 KiB
Text
59 lines
2.2 KiB
Text
|
// Import generic module functions
|
||
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||
|
|
||
|
params.options = [:]
|
||
|
options = initOptions(params.options)
|
||
|
|
||
|
process SRATOOLS_FASTERQDUMP {
|
||
|
tag "$meta.id"
|
||
|
label 'process_medium'
|
||
|
publishDir "${params.outdir}",
|
||
|
mode: params.publish_dir_mode,
|
||
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||
|
|
||
|
conda (params.enable_conda ? 'bioconda::sra-tools=2.11.0 conda-forge::pigz=2.6' : null)
|
||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||
|
container 'https://depot.galaxyproject.org/singularity/mulled-v2-5f89fe0cd045cb1d615630b9261a1d17943a9b6a:6a9ff0e76ec016c3d0d27e0c0d362339f2d787e6-0'
|
||
|
} else {
|
||
|
container 'quay.io/biocontainers/mulled-v2-5f89fe0cd045cb1d615630b9261a1d17943a9b6a:6a9ff0e76ec016c3d0d27e0c0d362339f2d787e6-0'
|
||
|
}
|
||
|
|
||
|
input:
|
||
|
tuple val(meta), path(sra)
|
||
|
|
||
|
output:
|
||
|
tuple val(meta), path(output), emit: reads
|
||
|
path "versions.yml" , emit: versions
|
||
|
|
||
|
script:
|
||
|
def config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n"
|
||
|
// Paired-end data extracted by fasterq-dump (--split-3 the default) always creates
|
||
|
// *_1.fastq *_2.fastq files but sometimes also an additional *.fastq file
|
||
|
// for unpaired reads which we ignore here.
|
||
|
output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz'
|
||
|
"""
|
||
|
eval "\$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')"
|
||
|
if [[ ! -f "\${NCBI_SETTINGS}" ]]; then
|
||
|
mkdir -p "\$(dirname "\${NCBI_SETTINGS}")"
|
||
|
printf '${config}' > "\${NCBI_SETTINGS}"
|
||
|
fi
|
||
|
|
||
|
fasterq-dump \\
|
||
|
${options.args} \\
|
||
|
--threads $task.cpus \\
|
||
|
${sra.name}
|
||
|
|
||
|
pigz \\
|
||
|
${options.args2} \\
|
||
|
--no-name \\
|
||
|
--processes $task.cpus \\
|
||
|
*.fastq
|
||
|
|
||
|
cat <<-END_VERSIONS > versions.yml
|
||
|
${getProcessName(task.process)}:
|
||
|
${getSoftwareName(task.process)}: \$(fasterq-dump --version 2>&1 | grep -Eo '[0-9.]+')
|
||
|
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
||
|
END_VERSIONS
|
||
|
"""
|
||
|
}
|