nf-core_modules/modules/phyloflash/main.nf
Abhinav Sharma 15fd90ffe8
Add phyloflash module (#786)
* initial stubs [ci skip]

* remove comments and add main command [ci skip]

* design iteration [ci skip]

* add new standard functions.nf [ci skip]

* update the version string [ci skip]

* accomodate the db stubs and single/double ends [ci skip]

* add FIXME for missing info [ci skip]

* Accomodate the results folder [ci skip]

* Update main.nf

* Apply suggestions from code review

* Update main.nf

* Apply suggestions from code review

* Add version file to stubs [ci skip]

* Tweak the output dir pattern [ci skip]

* Update modules/phyloflash/main.nf

* Update modules/phyloflash/main.nf

* Update modules/phyloflash/main.nf

Co-authored-by: Robert A. Petit III <robbie.petit@gmail.com>
Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
Co-authored-by: FriederikeHanssen <Friederike.hanssen@qbic.uni-tuebingen.de>
2021-11-21 19:43:58 +00:00

85 lines
2.6 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process PHYLOFLASH {
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::phyloflash=3.4" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/phyloflash:3.4--hdfd78af_1"
} else {
container "quay.io/biocontainers/phyloflash:3.4--hdfd78af_1"
}
input:
tuple val(meta), path(reads)
path silva_db
path univec_db
output:
tuple val(meta), path("${meta.id}*/*"), emit: results
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
if (meta.single_end) {
"""
phyloFlash.pl \\
$options.args \\
-read1 ${reads[0]} \\
-lib $prefix \\
-interleaved \\
-dbhome . \\
-CPUs $task.cpus
mkdir $prefix
mv ${prefix}.* $prefix
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(phyloFlash.pl -version 2>&1) | sed "s/^.*phyloFlash v//")
END_VERSIONS
"""
} else {
"""
phyloFlash.pl \\
$options.args \\
-read1 ${reads[0]} \\
-read2 ${reads[1]} \\
-lib $prefix \\
-dbhome . \\
-CPUs $task.cpus
mkdir $prefix
mv ${prefix}.* $prefix
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(phyloFlash.pl -version 2>&1) | sed "s/^.*phyloFlash v//")
END_VERSIONS
"""
}
stub:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
mkdir ${prefix}
touch ${prefix}/${prefix}.SSU.collection.fasta
touch ${prefix}/${prefix}.phyloFlash
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(phyloFlash.pl -version 2>&1) | sed "s/^.*phyloFlash v//")
END_VERSIONS
"""
}