nf-core_modules/modules/miniasm/main.nf
avantonder 527ccdb419
Add Miniasm module (#962)
* add racon

* add miniasm module

* edit miniasm module

* edit miniasm module

* Update tests/modules/racon/main.nf

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>

* Update tests/modules/racon/test.yml

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>

* Update modules/miniasm/meta.yml

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>

* Update main.nf

Add some spaces.

* Update meta.yml

Correct DOI

* Update main.nf

* Apply suggestions from code review

* Update tests/modules/miniasm/test.yml

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>
Co-authored-by: Sébastien Guizard <sguizard@ed.ac.uk>
Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-11-15 17:50:56 +00:00

48 lines
1.5 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process MINIASM {
tag "$meta.id"
label 'process_high'
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::miniasm=0.3_r179" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/miniasm:0.3_r179--h5bf99c6_2"
} else {
container "quay.io/biocontainers/miniasm:0.3_r179--h5bf99c6_2"
}
input:
tuple val(meta), path(reads), path(paf)
output:
tuple val(meta), path("*.gfa.gz") , emit: gfa
tuple val(meta), path("*.fasta.gz"), emit: assembly
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
miniasm \\
$options.args \\
-f $reads \\
$paf > \\
${prefix}.gfa
awk '/^S/{print ">"\$2"\\n"\$3}' "${prefix}.gfa" | fold > ${prefix}.fasta
gzip -n ${prefix}.gfa
gzip -n ${prefix}.fasta
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( miniasm -V 2>&1 )
END_VERSIONS
"""
}