Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new module vt/decompose_blocksub #7139

Merged
7 changes: 7 additions & 0 deletions modules/nf-core/vt/decomposeblocksub/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::vt=2015.11.10"
59 changes: 59 additions & 0 deletions modules/nf-core/vt/decomposeblocksub/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
process VT_DECOMPOSEBLOCKSUB {
tag "$meta.id"
label 'process_low'

// WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions.
conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/vt:2015.11.10--h5ef6573_4':
'biocontainers/vt:2015.11.10--h5ef6573_4' }"

input:
tuple val(meta), path(vcf), path(index), path(intervals)

output:
tuple val(meta), path("*.vcf.gz") , emit: vcf
path "versions.yml" , emit: versions

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

script:
def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"

if ("$vcf" == "${prefix}.vcf.gz") {
error "Input and output names are the same, set prefix in module configuration to disambiguate!"
}

def bed = intervals ? "-i ${intervals}" : ""
"""
vt decompose_blocksub \\
-o ${prefix}.vcf.gz \\
${bed} \\
${args} \\
${vcf}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
vt: \$(echo \$(vt decompose_blocksub 2>&1 | grep 'decompose_blocksub v' | sed -n 's/.*decompose_blocksub v\\([0-9]\\+\\.[0-9]\\+\\).*/\\1/p' ))
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"

if ("$vcf" == "${prefix}.vcf.gz") {
error "Input and output names are the same, set prefix in module configuration to disambiguate!"
}

"""
touch ${prefix}.vcf.gz

cat <<-END_VERSIONS > versions.yml
"${task.process}":
vt: \$(echo \$(vt decompose_blocksub 2>&1 | grep 'decompose_blocksub v' | sed -n 's/.*decompose_blocksub v\\([0-9]\\+\\.[0-9]\\+\\).*/\\1/p' ))
END_VERSIONS
"""
}
63 changes: 63 additions & 0 deletions modules/nf-core/vt/decomposeblocksub/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: "vt_decomposeblocksub"
description: Decomposes biallelic block substitutions into its constituent SNPs.
keywords:
- decomposeblocksub
- multiallelic
- small variants
- snps
- indels
- block substitutions
tools:
- "vt":
description: "A tool set for short variant discovery in genetic sequence data"
homepage: "https://genome.sph.umich.edu/wiki/Vt"
documentation: "https://genome.sph.umich.edu/wiki/Vt"
tool_dev_url: "https://github.com/atks/vt"
licence: ["MIT"]
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- vcf:
type: file
description: The VCF file to decompose
pattern: "*.vcf(.gz)?"
ontologies:
- edam: "http://edamontology.org/format_3016"
- index:
type: file
description: The VCF file to decompose
pattern: "*.tbi"
ontologies:
- edam: "http://edamontology.org/format_3616"
- intervals:
type: file
description: The intervals of the variants of decompose
pattern: "*.bed"
ontologies:
- edam: "http://edamontology.org/format_3003"
output:
- vcf:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- "*.vcf.gz":
type: file
description: The decomposed VCF file
pattern: "*.vcf.gz"
kubranarci marked this conversation as resolved.
Show resolved Hide resolved
ontologies:
- edam: "http://edamontology.org/format_3016"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@kubranarci"
maintainers:
- "@kubranarci"
62 changes: 62 additions & 0 deletions modules/nf-core/vt/decomposeblocksub/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@

nextflow_process {

name "Test Process VT_DECOMPOSEBLOCKSUB"
script "../main.nf"
process "VT_DECOMPOSEBLOCKSUB"
config "./nextflow.config"

tag "modules"
tag "modules_nfcore"
tag "vt"
tag "vt/decomposeblocksub"

test("test-vt-decomposeblocksub") {

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

"""
}
}

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

test("test-vt-decomposeblocksub-intervals") {

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

"""
}
}

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

}
72 changes: 72 additions & 0 deletions modules/nf-core/vt/decomposeblocksub/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"test-vt-decomposeblocksub-intervals": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a"
]
],
"1": [
"versions.yml:md5,2e541ec639f0458804a6cd3a58211f66"
],
"vcf": [
[
{
"id": "test",
"single_end": false
},
"decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a"
]
],
"versions": [
"versions.yml:md5,2e541ec639f0458804a6cd3a58211f66"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-03T09:38:47.060601884"
},
"test-vt-decomposeblocksub": {
"content": [
{
"0": [
[
{
"id": "test",
"single_end": false
},
"decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a"
]
],
"1": [
"versions.yml:md5,2e541ec639f0458804a6cd3a58211f66"
],
"vcf": [
[
{
"id": "test",
"single_end": false
},
"decomposeblocksub.vcf.gz:md5,6dd85c7989b945dccb0a834c2c05407a"
]
],
"versions": [
"versions.yml:md5,2e541ec639f0458804a6cd3a58211f66"
]
}
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.2"
},
"timestamp": "2024-12-03T09:38:24.537448596"
}
}
6 changes: 6 additions & 0 deletions modules/nf-core/vt/decomposeblocksub/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {
withName: VT_DECOMPOSEBLOCKSUB {
ext.prefix = "decomposeblocksub"
ext.args = "-a"
}
}
Loading