Skip to content

Commit

Permalink
new module: hmmer/hmmpress (#7514)
Browse files Browse the repository at this point in the history
* add hmmer_hmmpress module and tests

* move setup block outside of test block

* add missing colon to meta.yml

* fix identation in meta.yml

* linter suggested fixes

* change label to 'process_single'

Co-authored-by: Evangelos Karatzas <[email protected]>

* change test name to follow nf-core guidelines

Co-authored-by: Evangelos Karatzas <[email protected]>

* change test name to follow nf-core guidelines

Co-authored-by: Evangelos Karatzas <[email protected]>

* update snapshot

---------

Co-authored-by: Evangelos Karatzas <[email protected]>
  • Loading branch information
ochkalova and vagkaratzas authored Feb 25, 2025
1 parent f495fdd commit 26b0fc1
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/hmmer/hmmpress/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::hmmer=3.4
48 changes: 48 additions & 0 deletions modules/nf-core/hmmer/hmmpress/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process HMMER_HMMPRESS {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/hmmer:3.4--hdbdd923_1' :
'biocontainers/hmmer:3.4--hdbdd923_1' }"

input:
tuple val(meta), path(hmmfile)

output:
tuple val(meta), path("*.h3?"), emit: compressed_db
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''

"""
hmmpress \\
$args \\
${hmmfile}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hmmer: \$(echo \$(hmmpress -h | grep HMMER | sed 's/# HMMER //' | sed 's/ .*//' 2>&1))
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "stub"

"""
touch ${prefix}.h3m
touch ${prefix}.h3i
touch ${prefix}.h3f
touch ${prefix}.h3p
cat <<-END_VERSIONS > versions.yml
"${task.process}":
hmmer: \$(echo \$(hmmpress -h | grep HMMER | sed 's/# HMMER //' | sed 's/ .*//' 2>&1))
END_VERSIONS
"""
}
47 changes: 47 additions & 0 deletions modules/nf-core/hmmer/hmmpress/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "hmmer_hmmpress"
description: compress and index profile database for hmmscan
keywords:
- hidden Markov model
- HMM
- hmmer
- hmmpress
- hmmscan
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"]
identifier: biotools:hmmer
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- hmmfile:
type: file
description: HMMER flatfile database of HMM profiles
pattern: "*"
output:
- compressed_db:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.h3?":
type: list
description: Binary files with compressed profiles and their index
pattern: "*.h3?"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@ochkalova"
maintainers:
- "@ochkalova"
66 changes: 66 additions & 0 deletions modules/nf-core/hmmer/hmmpress/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

nextflow_process {

name "Test Process HMMER_HMMPRESS"
script "../main.nf"
process "HMMER_HMMPRESS"

tag "modules"
tag "modules_nfcore"
tag "hmmer"
tag "hmmer/hmmpress"
tag "gunzip"

setup {
run("GUNZIP") {
script "../../../gunzip"

process {
"""
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/proteome.hmm.gz', checkIfExists: true)
]
"""
}
}
}

test("sarscov2 - proteome - hmm - gz") {

when {
process {
"""
input[0] = GUNZIP.out.gunzip
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

test("sarscov2 - proteome - hmm - gz - stub") {
options '-stub'

when {
process {
"""
input[0] = GUNZIP.out.gunzip
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}

}
88 changes: 88 additions & 0 deletions modules/nf-core/hmmer/hmmpress/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"sarscov2 - proteome - hmm - gz": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"proteome.hmm.h3f:md5,d0640e710a5eec56aa95a64e6dcb9971",
"proteome.hmm.h3i:md5,1e68ee61bfe47697e3df24b5551dbb82",
"proteome.hmm.h3m:md5,9fa27bd2fda0e8c037852301245dcbfb",
"proteome.hmm.h3p:md5,e73ab76f194340b797e8485464caa369"
]
]
],
"1": [
"versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6"
],
"compressed_db": [
[
{
"id": "test"
},
[
"proteome.hmm.h3f:md5,d0640e710a5eec56aa95a64e6dcb9971",
"proteome.hmm.h3i:md5,1e68ee61bfe47697e3df24b5551dbb82",
"proteome.hmm.h3m:md5,9fa27bd2fda0e8c037852301245dcbfb",
"proteome.hmm.h3p:md5,e73ab76f194340b797e8485464caa369"
]
]
],
"versions": [
"versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-25T14:43:13.712539"
},
"sarscov2 - proteome - hmm - gz - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
[
"stub.h3f:md5,d41d8cd98f00b204e9800998ecf8427e",
"stub.h3i:md5,d41d8cd98f00b204e9800998ecf8427e",
"stub.h3m:md5,d41d8cd98f00b204e9800998ecf8427e",
"stub.h3p:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"1": [
"versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6"
],
"compressed_db": [
[
{
"id": "test"
},
[
"stub.h3f:md5,d41d8cd98f00b204e9800998ecf8427e",
"stub.h3i:md5,d41d8cd98f00b204e9800998ecf8427e",
"stub.h3m:md5,d41d8cd98f00b204e9800998ecf8427e",
"stub.h3p:md5,d41d8cd98f00b204e9800998ecf8427e"
]
]
],
"versions": [
"versions.yml:md5,f5473ee4ad53142d92c79b5a0fe94bf6"
]
}
],
"meta": {
"nf-test": "0.9.0",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-25T14:43:19.740161"
}
}

0 comments on commit 26b0fc1

Please sign in to comment.