Skip to content

Commit

Permalink
new module svtools/vcftobedpe (#7449)
Browse files Browse the repository at this point in the history
* new module svtools/vcftobedpe

* Update modules/nf-core/svtools/vcftobedpe/main.nf

* Update modules/nf-core/svtools/vcftobedpe/main.nf

Co-authored-by: James A. Fellows Yates <[email protected]>

---------

Co-authored-by: James A. Fellows Yates <[email protected]>
  • Loading branch information
nvnieuwk and jfy133 authored Feb 6, 2025
1 parent 1436029 commit 5cf15e4
Show file tree
Hide file tree
Showing 5 changed files with 228 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/svtools/vcftobedpe/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::svtools=0.5.1"
46 changes: 46 additions & 0 deletions modules/nf-core/svtools/vcftobedpe/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
process SVTOOLS_VCFTOBEDPE {
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/svtools:0.5.1--py_0':
'biocontainers/svtools:0.5.1--py_0' }"

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

output:
tuple val(meta), path("*.bedpe"), emit: bedpe
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}"
"""
svtools vcftobedpe \\
$args
--input $vcf \\
--output ${prefix}.bedpe \\
--tempdir ./tmp
cat <<-END_VERSIONS > versions.yml
"${task.process}":
svtools: \$(svtools --version |& sed '1!d ; s/svtools //')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.bedpe
cat <<-END_VERSIONS > versions.yml
"${task.process}":
svtools: \$(svtools --version |& sed '1!d ; s/svtools //')
END_VERSIONS
"""
}
49 changes: 49 additions & 0 deletions modules/nf-core/svtools/vcftobedpe/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "svtools_vcftobedpe"
description: Convert a VCF file to a BEDPE file.
keywords:
- structural
- bedpe
- vcf
- conversion
- variants
tools:
- "svtools":
description: "Tools for processing and analyzing structural variants"
tool_dev_url: "https://github.com/hall-lab/svtools"
licence: ['MIT License']

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- vcf:
type: file
description: Input VCF file containing structural variants
pattern: "*.{vcf,vcf.gz}"

output:
- bedpe:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- "*.bedpe":
type: file
description: The converted BEDPE file
pattern: "*.bedpe"

- versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"

authors:
- "@nvnieuwk"
maintainers:
- "@nvnieuwk"
58 changes: 58 additions & 0 deletions modules/nf-core/svtools/vcftobedpe/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "svtools"
tag "svtools/vcftobedpe"

test("homo_sapiens - vcf") {

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

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

}

test("homo_sapiens - vcf - stub") {

options "-stub"

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

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

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/svtools/vcftobedpe/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"homo_sapiens - vcf": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.bedpe:md5,78e3231e39d534d26ba32f64f8f5e094"
]
],
"1": [
"versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8"
],
"bedpe": [
[
{
"id": "test"
},
"test.bedpe:md5,78e3231e39d534d26ba32f64f8f5e094"
]
],
"versions": [
"versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8"
]
}
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-06T16:08:14.1286306"
},
"homo_sapiens - vcf - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.bedpe:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8"
],
"bedpe": [
[
{
"id": "test"
},
"test.bedpe:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,1af4f5a32bfc89f4d6d6c94cf1d4afd8"
]
}
],
"meta": {
"nf-test": "0.9.1",
"nextflow": "24.10.4"
},
"timestamp": "2025-02-06T16:08:21.008497589"
}
}

0 comments on commit 5cf15e4

Please sign in to comment.