From 98642619bdfb755a2fb5cfb5d7170b03dd1dd39f Mon Sep 17 00:00:00 2001 From: Daniel Lundin Date: Thu, 25 Aug 2022 09:39:40 +0200 Subject: [PATCH] Add hmmbuild (#1960) * Fixing test.yml * hmmbuild passing tests * Output meta * Linting problem * Linting problem again * Fix prettier * Update modules/hmmer/hmmbuild/meta.yml Co-authored-by: James A. Fellows Yates * Fix missing prefix * Accept mxfile param * Output gzipped hmm * Moved input file for test to modules branch * Update modules/hmmer/hmmbuild/meta.yml Co-authored-by: James A. Fellows Yates * Describe mxfile * Get LENG 80 check back Co-authored-by: James A. Fellows Yates --- modules/hmmer/hmmbuild/main.nf | 44 ++++++++++++++++++++ modules/hmmer/hmmbuild/meta.yml | 44 ++++++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/hmmer/hmmbuild/main.nf | 15 +++++++ tests/modules/hmmer/hmmbuild/nextflow.config | 5 +++ tests/modules/hmmer/hmmbuild/test.yml | 12 ++++++ 6 files changed, 124 insertions(+) create mode 100644 modules/hmmer/hmmbuild/main.nf create mode 100644 modules/hmmer/hmmbuild/meta.yml create mode 100644 tests/modules/hmmer/hmmbuild/main.nf create mode 100644 tests/modules/hmmer/hmmbuild/nextflow.config create mode 100644 tests/modules/hmmer/hmmbuild/test.yml diff --git a/modules/hmmer/hmmbuild/main.nf b/modules/hmmer/hmmbuild/main.nf new file mode 100644 index 00000000..213328b3 --- /dev/null +++ b/modules/hmmer/hmmbuild/main.nf @@ -0,0 +1,44 @@ +process HMMER_HMMBUILD { + tag '$meta.id' + label 'process_low' + + conda (params.enable_conda ? "bioconda::hmmer=3.3.2" : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/hmmer:3.3.2--h87f3376_2': + 'quay.io/biocontainers/hmmer:3.3.2--h1b792b2_1' }" + + input: + tuple val(meta), path(alignment) + path mxfile + + output: + tuple val(meta), path("*.hmm.gz"), emit: hmm + path "*.hmmbuild.txt", emit: hmmbuildout + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def mxfileopt = mxfile ? "--mxfile ${mxfile}" : "" + + """ + hmmbuild \\ + $args \\ + --cpu $task.cpus \\ + -n ${prefix} \\ + -o ${prefix}.hmmbuild.txt \\ + ${mxfileopt} \\ + ${prefix}.hmm \\ + $alignment + + gzip ${prefix}.hmm + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + hmmer: \$(echo \$(hmmbuild -h | grep HMMER | sed 's/# HMMER //' | sed 's/ .*//' 2>&1)) + END_VERSIONS + """ +} diff --git a/modules/hmmer/hmmbuild/meta.yml b/modules/hmmer/hmmbuild/meta.yml new file mode 100644 index 00000000..77af69cf --- /dev/null +++ b/modules/hmmer/hmmbuild/meta.yml @@ -0,0 +1,44 @@ +name: "hmmer_hmmbuild" +description: create an hmm profile from a multiple sequence alignment +keywords: + - search + - hidden Markov model + - HMM + - hmmer + - hmmsearch +tools: + - "hmmer": + description: "Biosequence analysis using profile hidden Markov models" + homepage: "http://hmmer.org" + documentation: "http://hmmer.org/documentation.html" + tool_dev_url: "https://github.com/EddyRivasLab/hmmer" + doi: "10.1371/journal.pcbi.1002195" + licence: "['BSD']" + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - alignment: + type: file + description: multiple sequence alignment in fasta, clustal, stockholm or phylip format + pattern: "*" + - mxfile: + type: file + description: read substitution score matrix, for use when building profiles from single sequences (--singlemx option) + pattern: "*" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - hmm: + type: file + description: Gzipped HMM file + pattern: "*.{hmm.gz}" + +authors: + - "@erikrikarddaniel" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 847f7cef..89b29d26 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1142,6 +1142,10 @@ hmmer/hmmalign: - modules/hmmer/hmmalign/** - tests/modules/hmmer/hmmalign/** +hmmer/hmmbuild: + - modules/hmmer/hmmbuild/** + - tests/modules/hmmer/hmmbuild/** + hmmer/hmmsearch: - modules/hmmer/hmmsearch/** - tests/modules/hmmer/hmmsearch/** diff --git a/tests/modules/hmmer/hmmbuild/main.nf b/tests/modules/hmmer/hmmbuild/main.nf new file mode 100644 index 00000000..15fb04c6 --- /dev/null +++ b/tests/modules/hmmer/hmmbuild/main.nf @@ -0,0 +1,15 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { HMMER_HMMBUILD } from '../../../../modules/hmmer/hmmbuild/main.nf' + +workflow test_hmmer_hmmbuild { + + input = [ + [ id: 'PF14720' ], // meta map + file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/hmmer/PF14720_seed.alnfaa.gz', checkIfExists: true) + ] + + HMMER_HMMBUILD ( input, [] ) +} diff --git a/tests/modules/hmmer/hmmbuild/nextflow.config b/tests/modules/hmmer/hmmbuild/nextflow.config new file mode 100644 index 00000000..50f50a7a --- /dev/null +++ b/tests/modules/hmmer/hmmbuild/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} \ No newline at end of file diff --git a/tests/modules/hmmer/hmmbuild/test.yml b/tests/modules/hmmer/hmmbuild/test.yml new file mode 100644 index 00000000..04bd14e8 --- /dev/null +++ b/tests/modules/hmmer/hmmbuild/test.yml @@ -0,0 +1,12 @@ +- name: hmmer hmmbuild test_hmmer_hmmbuild + command: nextflow run ./tests/modules/hmmer/hmmbuild -entry test_hmmer_hmmbuild -c ./tests/config/nextflow.config -c ./tests/modules/hmmer/hmmbuild/nextflow.config + tags: + - hmmer + - hmmer/hmmbuild + files: + - path: output/hmmer/PF14720.hmm.gz + contains: + - "LENG 80" + - path: output/hmmer/versions.yml + contains: + - "hmmer:"