Skip to content

Commit

Permalink
Vcf2cytosure (nf-core#4312)
Browse files Browse the repository at this point in the history
* adding vcf2cytosure

* fixing test

* updating meta
  • Loading branch information
jemten authored Nov 8, 2023
1 parent 4ef7bec commit 2dba354
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/nf-core/vcf2cytosure/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- bioconda::vcf2cytosure=0.9.1
66 changes: 66 additions & 0 deletions modules/nf-core/vcf2cytosure/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
process VCF2CYTOSURE {
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/vcf2cytosure:0.9.1--pyh7cba7a3_1':
'biocontainers/vcf2cytosure:0.9.1--pyh7cba7a3_1' }"

input:
tuple val(meta), path(sv_vcf)
tuple val(meta2), path(coverage_bed)
tuple val(meta3), path(cns)
tuple val(meta4), path(snv_vcf)
path blacklist_bed

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

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

script:
def args = task.ext.args ?: ''
def coverage = coverage_bed ? "--coverage ${coverage_bed}" : ''
def cnvkit = cns ? ( coverage_bed ? '' : "--cn ${cns}" ) : ''
def snv = snv_vcf ? ( coverage_bed ? '' : "--snv ${snv_vcf}" ) : ''
def blacklist = blacklist_bed ? "--blacklist ${blacklist_bed}" : ''
def prefix = task.ext.prefix ?: sv_vcf ? "${meta.id}" : "${meta3.id}"

if ( cns && coverage_bed || snv_vcf && coverage_bed ) error "Coverage_bed input is not compatible with cns and snv"

"""
vcf2cytosure \\
--vcf $sv_vcf \\
--out ${prefix}.cgh \\
$coverage \\
$cnvkit \\
$snv \\
$blacklist \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
vcf2cytosure: \$(echo \$(vcf2cytosure --version 2>&1) | sed 's/^.* cytosure //' )
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def coverage = coverage_bed ? "--coverage ${coverage_bed}" : ''
def cnvkit = cns ? ( coverage_bed ? '' : "--cn ${cns}" ) : ''
def snv = snv_vcf ? ( coverage_bed ? '' : "--snv ${snv_vcf}" ) : ''
def blacklist = blacklist_bed ? "--blacklist ${blacklist_bed}" : ''
def prefix = task.ext.prefix ?: "${meta.id}"

"""
touch ${prefix}.xml
cat <<-END_VERSIONS > versions.yml
"${task.process}":
vcf2cytosure: \$(echo \$(vcf2cytosure --version 2>&1) | sed 's/^.* cytosure //' )
END_VERSIONS
"""
}
77 changes: 77 additions & 0 deletions modules/nf-core/vcf2cytosure/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json
name: "vcf2cytosure"
description: Convert VCF with structural variations to CytoSure format
keywords:
- structural_variants
- array_cgh
- vcf
- cytosure
tools:
- "vcf2cytosure":
description: "Convert VCF with structural variations to CytoSure format"
homepage: "https://github.com/NBISweden/vcf2cytosure"
documentation: "https://github.com/NBISweden/vcf2cytosure"
tool_dev_url: "https://github.com/NBISweden/vcf2cytosure"
licence: "['MIT']"

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- meta2:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- meta3:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- meta4:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- sv_vcf:
type: file
description: VCF file with structural variants
pattern: "*.{vcf,vcf.gz}"
- coverage_bed:
type: file
description: Bed file with coverage data
pattern: "*.bed"
- cns:
type: file
description: CN file from CNVkit, not compatible with coverage_bed file
- snv_vcf:
type: file
description: |
VCF file with SNVs to calculate probe coverage,
not compatible with coverage_bed
pattern: "*.{vcf,vcf.gz}"
- blacklilst_bed:
type: file
description: Bed file with regions to exclude
pattern: "*.bed"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- cgh:
type: file
description: SV:s in CytoSure format
pattern: "*.cgh"

authors:
- "@jemten"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4031,6 +4031,10 @@ varlociraptor/preprocess:
- modules/nf-core/varlociraptor/preprocess/**
- tests/modules/nf-core/varlociraptor/preprocess/**

vcf2cytosure:
- modules/nf-core/vcf2cytosure/**
- tests/modules/nf-core/vcf2cytosure/**

vcf2db:
- modules/nf-core/vcf2db/**
- tests/modules/nf-core/vcf2db/**
Expand Down
3 changes: 3 additions & 0 deletions tests/config/test_data.config
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ params {

cutandrun_bedgraph_test_1 = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/bedgraph/cutandtag_h3k27me3_test_1.bedGraph"
cutandrun_bedgraph_test_2 = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/bedgraph/cutandtag_igg_test_1.bedGraph"
na24385_chr22_coverage = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/bedgraph/NA24385_coverage.bed"

empty_vcf_gz = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/empty.vcf.gz"
empty_vcf_gz_tbi = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/empty.vcf.gz.tbi"
Expand All @@ -477,6 +478,8 @@ params {
test_rnaseq_vcf = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/test.rnaseq.vcf"
test_sv_vcf = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/sv_query.vcf.gz"
test_sv_vcf_tbi = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/sv_query.vcf.gz.tbi"
na24385_chr22_sv_vcf = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz"
na24385_chr22_sv_vcf_tbi = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/NA24385_sv.vcf.gz.tbi"
genmod_vcf_gz = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/genmod.vcf.gz"
genmod_annotate_vcf_gz = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/test_annotate.vcf.gz"
genmod_models_vcf_gz = "${params.test_data_base}/data/genomics/homo_sapiens/illumina/vcf/test_models.vcf.gz"
Expand Down
19 changes: 19 additions & 0 deletions tests/modules/nf-core/vcf2cytosure/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { VCF2CYTOSURE } from '../../../../modules/nf-core/vcf2cytosure/main.nf'

workflow test_vcf2cytosure {

sv_vcf = [
[ id:'test' ], // meta map
[ file(params.test_data['homo_sapiens']['illumina']['na24385_chr22_sv_vcf'], checkIfExists: true) ]
]
coverage = [
[ id:'test' ], // meta map
[ file(params.test_data['homo_sapiens']['illumina']['na24385_chr22_coverage'], checkIfExists: true) ]
]
VCF2CYTOSURE ( sv_vcf, coverage, [[],[]], [[],[]], [] )

}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/vcf2cytosure/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
process {

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

}
8 changes: 8 additions & 0 deletions tests/modules/nf-core/vcf2cytosure/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- name: vcf2cytosure test_vcf2cytosure
command: nextflow run ./tests/modules/nf-core/vcf2cytosure -entry test_vcf2cytosure -c ./tests/config/nextflow.config
tags:
- vcf2cytosure
files:
- path: output/vcf2cytosure/test.cgh
md5sum: fc3f1ffac5b797881d992994d5d56550
- path: output/vcf2cytosure/versions.yml

0 comments on commit 2dba354

Please sign in to comment.