Skip to content

Commit

Permalink
add haplogrep3
Browse files Browse the repository at this point in the history
  • Loading branch information
ramprasadn committed Jan 28, 2025
1 parent 6f21c0f commit a997ed0
Show file tree
Hide file tree
Showing 6 changed files with 233 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/nf-core/haplogrep3/classify/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::haplogrep=3.2.2
47 changes: 47 additions & 0 deletions modules/nf-core/haplogrep3/classify/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
process HAPLOGREP3_CLASSIFY {
tag "$meta.id"
label 'process_low'

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

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

output:
tuple val(meta), path("*.txt"), emit: txt
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}"
"""
haplogrep3 \\
classify \\
$args \\
--in $inputfile \\
--out ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
haplogrep3: \$(echo \$(haplogrep3 2>&1) | (sed '2!d') | (sed 's/Haplogrep 3 //'))
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.txt
cat <<-END_VERSIONS > versions.yml
"${task.process}":
haplogrep3: \$(echo \$(haplogrep3 2>&1) | (sed '2!d') | (sed 's/Haplogrep 3 //'))
END_VERSIONS
"""

}
45 changes: 45 additions & 0 deletions modules/nf-core/haplogrep3/classify/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "haplogrep3_classify"
description: classification into haplogroups
keywords:
- haplogroups
- classify
- mtDNA
tools:
- "haplogrep3":
description: "A tool for mtDNA haplogroup classification."
homepage: "https://github.com/genepi/haplogrep3"
documentation: "https://github.com/genepi/haplogrep3"
tool_dev_url: "https://github.com/genepi/haplogrep3"
licence: ["MIT"]
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- inputfile:
type: file
description: valid options are hsd, vcf, or fasta files
pattern: "*.{vcf,vcf.gz,fasta,hsd}"
output:
- txt:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.txt":
type: file
description: text file with classification information
pattern: "*.{txt}"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@lucpen"
maintainers:
- "@lucpen"
- "@ramprasadn"
59 changes: 59 additions & 0 deletions modules/nf-core/haplogrep3/classify/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "haplogrep3"
tag "haplogrep3/classify"

test("test-haplogrep3-classify") {

config './nextflow.config'

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878_chrM.vcf.gz', checkIfExists: true)
]
"""
}
}

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

test("test-haplogrep3-classify-stub") {

options '-stub'

when {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/vcf/NA12878_chrM.vcf.gz', checkIfExists: true)
]
"""
}
}

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

}
72 changes: 72 additions & 0 deletions modules/nf-core/haplogrep3/classify/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"test-haplogrep3-classify-stub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,bd62c94d9b52732b89fbd979ded94a60"
],
"txt": [
[
{
"id": "test",
"single_end": false
},
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,bd62c94d9b52732b89fbd979ded94a60"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-28T15:34:35.106097277"
},
"test-haplogrep3-classify": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"test.txt:md5,fb242df629aa6168371d1d742f0fb179"
]
],
"1": [
"versions.yml:md5,bd62c94d9b52732b89fbd979ded94a60"
],
"txt": [
[
{
"id": "test",
"single_end": false
},
"test.txt:md5,fb242df629aa6168371d1d742f0fb179"
]
],
"versions": [
"versions.yml:md5,bd62c94d9b52732b89fbd979ded94a60"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-01-28T15:36:19.954363253"
}
}
5 changes: 5 additions & 0 deletions modules/nf-core/haplogrep3/classify/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {
withName: HAPLOGREP3_CLASSIFY {
ext.args = '--tree [email protected]'
}
}

0 comments on commit a997ed0

Please sign in to comment.