nf-core_modules/software/hmmer/hmmalign/main.nf
Daniel Lundin d7a3286a9a
New module to use hmmalign from HMMER to align sequences (#470)
* Ignore vim tmp files

* Added hmmalign module, not yet tests

* Test output

* Replaced functions.nf for hmmalign with upstream

* Update software/hmmer/hmmalign/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update software/hmmer/hmmalign/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update software/hmmer/hmmalign/meta.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update tests/software/hmmer/hmmalign/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update tests/software/hmmer/hmmalign/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update tests/software/hmmer/hmmalign/test.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update tests/config/pytest_software.yml

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

* Update software/hmmer/hmmalign/main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-04-28 11:21:24 +01:00

42 lines
1.4 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
params.options = [:]
options = initOptions(params.options)
process HMMER_HMMALIGN {
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::hmmer=3.3.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/hmmer:3.3.2--h1b792b2_1"
} else {
container "quay.io/biocontainers/hmmer:3.3.2--h1b792b2_1"
}
input:
tuple val(meta), path(fasta)
path hmm
output:
tuple val(meta), path("*.sthlm.gz"), emit: sthlm
path "*.version.txt" , emit: version
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def fastacmd = fasta.getExtension() == 'gz' ? "gunzip -c $fasta" : "cat $fasta"
"""
$fastacmd | \\
hmmalign \\
$options.args \\
$hmm \\
- | gzip -c > ${meta.id}.sthlm.gz
echo \$(hmmalign -h | grep -o '^# HMMER [0-9.]*') | sed 's/^# HMMER *//' > ${software}.version.txt
"""
}