Add svdb/merge (#1233)

* nf-core create

* svdb merge module and test

* remove to-do from test.yml

* version

* update meta.yml

* add stub

* add when
This commit is contained in:
Ramprasad Neethiraj 2022-02-04 15:29:44 +01:00 committed by GitHub
parent e20e57f90b
commit f44e6c74b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,52 @@
process SVDB_MERGE {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::svdb=2.5.0" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/svdb:2.5.0--py39hcbe4a3b_0':
'quay.io/biocontainers/svdb:2.5.0--py39hcbe4a3b_0' }"
input:
tuple val(meta), path(vcfs)
val (priority)
output:
tuple val(meta), path("*_sv_merge.vcf"), emit: vcf
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}"
def input = ""
for (int index = 0; index < vcfs.size(); index++) {
input += " ${vcfs[index]}:${priority[index]}"
}
"""
svdb \\
--merge \\
$args \\
--priority ${priority.join(',')} \\
--vcf $input \\
> ${prefix}_sv_merge.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
svdb: \$( echo \$(svdb) | head -1 | sed 's/usage: SVDB-\\([0-9]\\.[0-9]\\.[0-9]\\).*/\\1/' )
END_VERSIONS
"""
stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}_sv_merge.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
svdb: \$( echo \$(svdb) | head -1 | sed 's/usage: SVDB-\\([0-9]\\.[0-9]\\.[0-9]\\).*/\\1/' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,39 @@
name: svdb_merge
description: The merge module merges structural variants within one or more vcf files.
keywords:
- structural variants
tools:
- svdb:
description: structural variant database software
homepage: https://github.com/J35P312/SVDB
documentation: https://github.com/J35P312/SVDB/blob/master/README.md
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- priority:
type: list
description: prioritise the input vcf files according to this list, e.g ['tiddit','cnvnator']
- vcfs:
type: list
description: Two or more VCF files. Order of files should correspond to the order of tags used for priority.
pattern: "*.{vcf,vcf.gz}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test' ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- vcf:
type: file
description: merged VCF file
pattern: "*_sv_merge.vcf"
authors:
- "@ramprasadn"

View file

@ -1445,6 +1445,10 @@ subread/featurecounts:
- modules/subread/featurecounts/** - modules/subread/featurecounts/**
- tests/modules/subread/featurecounts/** - tests/modules/subread/featurecounts/**
svdb/merge:
- modules/svdb/merge/**
- tests/modules/svdb/merge/**
svdb/query: svdb/query:
- modules/svdb/query/** - modules/svdb/query/**
- tests/modules/svdb/query/** - tests/modules/svdb/query/**

View file

@ -0,0 +1,16 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { SVDB_MERGE } from '../../../../modules/svdb/merge/main.nf'
workflow test_svdb_merge {
input = [ [ id:'test' ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test2_vcf'], checkIfExists: true) ]
]
priority = [ 'tiddit', 'cnvnator']
SVDB_MERGE ( input, priority )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,7 @@
- name: svdb merge
command: nextflow run ./tests/modules/svdb/merge -entry test_svdb_merge -c ./tests/config/nextflow.config -c ./tests/modules/svdb/merge/nextflow.config
tags:
- svdb
- svdb/merge
files:
- path: output/svdb/test_sv_merge.vcf