Skip to content

Commit

Permalink
new module survivor/merge (#2648)
Browse files Browse the repository at this point in the history
* new module survivor/merge

* fix versions

* review updates

* add stubs

* fix tests

* changed conda according to #2654

* moved the args to input vals

* update meta

* update to latest decision

* fix test

* Update modules/nf-core/survivor/merge/main.nf

Co-authored-by: Jonathan Manning <[email protected]>

---------

Co-authored-by: Jonathan Manning <[email protected]>
  • Loading branch information
nvnieuwk and Jonathan Manning authored Feb 28, 2023
1 parent 40ce6b3 commit 61cdc61
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 0 deletions.
71 changes: 71 additions & 0 deletions modules/nf-core/survivor/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
process SURVIVOR_MERGE {
tag "$meta.id"
label 'process_low'

conda "bioconda::survivor=1.0.7"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/survivor:1.0.7--h9a82719_1':
'quay.io/biocontainers/survivor:1.0.7--h9a82719_1' }"

input:
tuple val(meta), path(vcfs)
val(max_distance_breakpoints)
val(min_supporting_callers)
val(account_for_type)
val(account_for_sv_strands)
val(estimate_distanced_by_sv_size)
val(min_sv_size)

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

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

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

vcfs.each{
if (it.getExtension() == "gz"){
error "Gzipped files are not supported by Survivor, please gunzip your VCF files first."
// https://github.com/fritzsedlazeck/SURVIVOR/issues/158
}
}

"""
SURVIVOR merge \\
<(ls *.vcf) \\
${max_distance_breakpoints} \\
${min_supporting_callers} \\
${account_for_type} \\
${account_for_sv_strands} \\
${estimate_distanced_by_sv_size} \\
${min_sv_size} \\
${prefix}.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
survivor: \$(echo \$(SURVIVOR 2>&1 | grep "Version" | sed 's/^Version: //'))
END_VERSIONS
"""

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

vcfs.each{
if (it.getExtension() == "gz"){
error "Gzipped files are not supported by Survivor, please gunzip your VCF files first."
// https://github.com/fritzsedlazeck/SURVIVOR/issues/158
}
}

"""
touch ${prefix}.vcf
cat <<-END_VERSIONS > versions.yml
"${task.process}":
survivor: \$(echo \$(SURVIVOR 2>&1 | grep "Version" | sed 's/^Version: //'))
END_VERSIONS
"""
}
64 changes: 64 additions & 0 deletions modules/nf-core/survivor/merge/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: "survivor_merge"
description: Compare or merge VCF files to generate a consensus or multi sample VCF files.
keywords:
- survivor
- merge
- vcf
- structural variants
tools:
- "survivor":
description: "Toolset for SV simulation, comparison and filtering"
homepage: "https://github.com/fritzsedlazeck/SURVIVOR/wiki"
documentation: "https://github.com/fritzsedlazeck/SURVIVOR/wiki"
tool_dev_url: "https://github.com/fritzsedlazeck/SURVIVOR"
doi: "10.1038/NCOMMS14061"
licence: "['MIT']"

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- vcfs:
type: files
description: |
The VCF files to be merged
Gzipped VCF files are not supported: https://github.com/fritzsedlazeck/SURVIVOR/issues/158
pattern: "*.vcf"
- max_distance_breakpoints:
type: integer
description: Max distance between breakpoints (0-1 percent of length, 1- number of bp)
- min_supporting_callers:
type: integer
description: Minimum number of supporting caller
- account_for_type:
type: integer
description: Take the type into account (1==yes, else no)
- account_for_sv_strands:
type: integer
description: Take the strands of SVs into account (1==yes, else no)
- estimate_distanced_by_sv_size:
type: integer
description: Estimate distance based on the size of SV (1==yes, else no)
- min_sv_size:
type: integer
description: Minimum size of SVs to be taken into account

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"
- vcf:
type: file
description: The merged VCF file
pattern: "*.vcf"

authors:
- "@nvnieuwk"
4 changes: 4 additions & 0 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3135,6 +3135,10 @@ subworkflows/vcf_gather_bcftools:
- subworkflows/nf-core/vcf_gather_bcftools/**
- tests/subworkflows/nf-core/vcf_gather_bcftools/**

survivor/merge:
- modules/nf-core/survivor/merge/**
- tests/modules/nf-core/survivor/merge/**

subworkflows/vcf_impute_glimpse:
- subworkflows/nf-core/vcf_impute_glimpse/**
- tests/subworkflows/nf-core/vcf_impute_glimpse/**
Expand Down
26 changes: 26 additions & 0 deletions tests/modules/nf-core/survivor/merge/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env nextflow

nextflow.enable.dsl = 2

include { SURVIVOR_MERGE } from '../../../../../modules/nf-core/survivor/merge/main.nf'

workflow test_survivor_merge {

input = [
[ id:'test', single_end:false ], // meta map
[
file(params.test_data['homo_sapiens']['illumina']['test2_genome_vcf'], checkIfExists: true),
file(params.test_data['homo_sapiens']['illumina']['test_genome_vcf'], checkIfExists: true)
]
]

SURVIVOR_MERGE (
input,
0.2,
1,
0,
0,
0,
20
)
}
5 changes: 5 additions & 0 deletions tests/modules/nf-core/survivor/merge/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()}" }

}
11 changes: 11 additions & 0 deletions tests/modules/nf-core/survivor/merge/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- name: survivor merge test_survivor_merge
command: nextflow run ./tests/modules/nf-core/survivor/merge -entry test_survivor_merge -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/survivor/merge/nextflow.config
tags:
- survivor
- survivor/merge
files:
- path: output/survivor/test.vcf
contains:
- "##fileformat=VCFv4.1"
- "##source=SURVIVOR"
- path: output/survivor/versions.yml

0 comments on commit 61cdc61

Please sign in to comment.