Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/nf-core/yallhap/classify/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::yallhap=0.4.0
46 changes: 46 additions & 0 deletions modules/nf-core/yallhap/classify/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
process YALLHAP_CLASSIFY {
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/yallhap:0.4.0--pyhdfd78af_0':
'biocontainers/yallhap:0.4.0--pyhdfd78af_0' }"

input:
tuple val(meta), path(vcf), path(tbi)
tuple val(meta2), path(tree)
tuple val(meta3), path(snp_db)

output:
tuple val(meta), path("*.json"), emit: json, optional: true
tuple val(meta), path("*.tsv") , emit: tsv , optional: true
tuple val("${task.process}"), val('yallhap'), eval("yallhap --version | sed 's/.*version //'"), emit: versions_yallhap, topic: versions

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

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def format = task.ext.format ?: 'json'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than adding a new task.ext directive, could you make this an input to the module (val format) instead?

def output_ext = format == 'tsv' ? 'tsv' : 'json'
"""
yallhap \\
classify \\
${vcf} \\
--tree ${tree} \\
--snp-db ${snp_db} \\
--format ${format} \\
--output ${prefix}.${output_ext} \\
${args}
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def format = task.ext.format ?: 'json'
def output_ext = format == 'tsv' ? 'tsv' : 'json'
"""
touch ${prefix}.${output_ext}
"""
}
109 changes: 109 additions & 0 deletions modules/nf-core/yallhap/classify/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "yallhap_classify"
description: Y-chromosome haplogroup classification from VCF files
keywords:
- haplogroups
- Y-chromosome
- ydna
- ancient DNA
- classify
- phylogenetics
tools:
- "yallhap":
description: "Modern Y-chromosome haplogroup inference tool supporting modern and ancient DNA with probabilistic confidence scoring"
homepage: "https://github.com/trianglegrrl/yallHap"
documentation: "https://github.com/trianglegrrl/yallHap#readme"
tool_dev_url: "https://github.com/trianglegrrl/yallHap"
licence: ["MIT"]
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcf:
type: file
description: VCF file containing Y-chromosome variants
pattern: "*.{vcf,vcf.gz}"
ontologies:
- edam: http://edamontology.org/format_3016 # VCF
- tbi:
type: file
description: Index file for the VCF (optional for uncompressed VCF)
pattern: "*.{tbi,csi}"
ontologies:
- edam: http://edamontology.org/format_3700 # Tabix index
- - meta2:
type: map
description: |
Groovy Map containing reference tree information
e.g. [ id:'yfull' ]
- tree:
type: file
description: YFull phylogenetic tree in JSON format
pattern: "*.json"
ontologies:
- edam: http://edamontology.org/format_3464 # JSON
- - meta3:
type: map
description: |
Groovy Map containing SNP database information
e.g. [ id:'ybrowse_grch38' ]
- snp_db:
type: file
description: SNP database CSV file (YBrowse format) with variant positions
pattern: "*.csv"
ontologies:
- edam: http://edamontology.org/format_3752 # CSV
output:
json:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.json":
type: file
description: JSON file containing haplogroup classification results
pattern: "*.json"
ontologies:
- edam: http://edamontology.org/format_3464 # JSON
tsv:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- "*.tsv":
type: file
description: TSV file containing haplogroup classification results
pattern: "*.tsv"
ontologies:
- edam: http://edamontology.org/format_3475 # TSV
versions_yallhap:
- - ${task.process}:
type: string
description: The process the versions were collected from
- yallhap:
type: string
description: The tool name
- "yallhap --version | sed 's/.*version //'":
type: eval
description: The expression to obtain the version of the tool
topics:
versions:
- - ${task.process}:
type: string
description: The process the versions were collected from
- yallhap:
type: string
description: The tool name
- "yallhap --version | sed 's/.*version //'":
type: eval
description: The expression to obtain the version of the tool
authors:
- "@trianglegrrl"
maintainers:
- "@trianglegrrl"
55 changes: 55 additions & 0 deletions modules/nf-core/yallhap/classify/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "yallhap"
tag "yallhap/classify"

test("homo_sapiens - chrY vcf - stub") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to write a minimal test that is not a stub?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the snappy review! Just waiting for bioconda-recipes to accept my yallHap version bump before I push the updates here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It comes with a test-datasets update and tests for classification of BAM and VCF formats. nf-core/test-datasets#1842)


options '-stub'

when {
process {
"""
// Create minimal stub files for testing
def vcf_file = file("\${workDir}/test_chrY.vcf.gz")
vcf_file.text = ""
def tbi_file = file("\${workDir}/test_chrY.vcf.gz.tbi")
tbi_file.text = ""
def tree_file = file("\${workDir}/yfull_tree.json")
tree_file.text = "{}"
def snp_db_file = file("\${workDir}/ybrowse_snps.csv")
snp_db_file.text = "name,grch38_pos,ancestral,derived,haplogroup"

input[0] = [
[ id:'test' ], // meta map
vcf_file,
tbi_file
]
input[1] = [
[ id:'yfull' ],
tree_file
]
input[2] = [
[ id:'ybrowse' ],
snp_db_file
]
"""
}
}

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

}
49 changes: 49 additions & 0 deletions modules/nf-core/yallhap/classify/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"homo_sapiens - chrY vcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [

],
"2": [
[
"YALLHAP_CLASSIFY",
"yallhap",
"0.1.0"
]
],
"json": [
[
{
"id": "test"
},
"test.json:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"tsv": [

],
"versions_yallhap": [
[
"YALLHAP_CLASSIFY",
"yallhap",
"0.1.0"
]
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.5"
},
"timestamp": "2026-01-19T19:58:07.267441"
}
}
Loading