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

new module: jasminesv #2651

Merged
merged 10 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions modules/nf-core/jasminesv/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
process JASMINESV {
tag "$meta.id"
label 'process_low'

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

input:
tuple val(meta), path(vcfs), path(bams), path(sample_dists)
path(fasta)
path(fasta_fai)
path(chr_norm)

output:
tuple val(meta), path("*.vcf"), 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}"

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

make_bam = bams ? "ls *.bam > bams.txt" : ""
bam_argument = bams ? "bam_list=bams.txt" : ""
make_iris = args2 != '' ? "echo ${args2} > iris.txt" : ""
iris_argument = args2 != '' ? "iris_args=iris.txt" : ""
sample_dists_argument = sample_dists ? "sample_dists=${sample_dists}" : ""
chr_norm_argument = chr_norm ? "chr_norm_file=${chr_norm}" : ""

"""
ls *.vcf > vcfs.txt
${make_bam}
${make_iris}

jasmine \\
file_list=vcfs.txt \\
out_file=${prefix}.vcf \\
threads=${task.cpus} \\
genome_file=${fasta} \\
${bam_argument} \\
${iris_argument} \\
${sample_dists_argument} \\
${chr_norm_argument} \\
${args}


cat <<-END_VERSIONS > versions.yml
"${task.process}":
jasminesv: \$(echo \$(jasmine 2>&1 | grep "version" | sed 's/Jasmine version //'))
END_VERSIONS
"""
}
67 changes: 67 additions & 0 deletions modules/nf-core/jasminesv/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: "jasminesv"
description: Jointly Accurate Sv Merging with Intersample Network Edges
keywords:
- jasminesv
- jasmine
- structural variants
- vcf
- bam
tools:
- "jasminesv":
description: "Software for merging structural variants between individuals"
homepage: "https://github.com/mkirsche/Jasmine/wiki/Jasmine-User-Manual"
documentation: "https://github.com/mkirsche/Jasmine/wiki/Jasmine-User-Manual"
tool_dev_url: "https://github.com/mkirsche/Jasmine"
doi: ""
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 that need to be merged
Only supports unzipped VCFs: https://github.com/mkirsche/Jasmine/issues/31
pattern: "*.vcf"
- bams:
type: files
description: Optional - The BAM files from which the VCFs were created
pattern: "*.bam"
- sample_dists:
type: file
description: Optional - A txt file containing the distance thresholds for each sample
pattern: "*.txt"
- fasta:
type: file
description: Optional - The reference FASTA file used to create the VCFs
pattern: "*.{fasta,fa}"
- fasta_fai:
type: file
description: Optional - The index of the reference FASTA file used to create the VCFs
pattern: "*.fai"
- chr_norm:
type: file
description: Optional - A txt file containing the chromosomes and their aliases for normalization
pattern: "*.txt"

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"
12 changes: 8 additions & 4 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,10 @@ ivar/variants:
- modules/nf-core/ivar/variants/**
- tests/modules/nf-core/ivar/variants/**

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

jupyternotebook:
- modules/nf-core/jupyternotebook/**
- tests/modules/nf-core/jupyternotebook/**
Expand Down Expand Up @@ -2927,14 +2931,14 @@ subworkflows/vcf_annotate_snpeff:
- subworkflows/nf-core/vcf_annotate_snpeff/**
- tests/subworkflows/nf-core/vcf_annotate_snpeff/**

subworkflows/vcf_gather_bcftools:
- subworkflows/nf-core/vcf_gather_bcftools/**
- tests/subworkflows/nf-core/vcf_gather_bcftools/**

subworkflows/vcf_extract_relate_somalier:
- subworkflows/nf-core/vcf_extract_relate_somalier/**
- tests/subworkflows/nf-core/vcf_extract_relate_somalier/**

subworkflows/vcf_gather_bcftools:
- subworkflows/nf-core/vcf_gather_bcftools/**
- tests/subworkflows/nf-core/vcf_gather_bcftools/**

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

nextflow.enable.dsl = 2

include { JASMINESV } from '../../../../modules/nf-core/jasminesv/main.nf'

workflow test_jasminesv_minimum {

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

fasta = []
fasta_fai = []
chr_norm = []

JASMINESV ( input, fasta, fasta_fai, chr_norm )
}

workflow test_jasminesv_iris {

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

fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
fasta_fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
chr_norm = []

JASMINESV ( input, fasta, fasta_fai, chr_norm )
}

workflow test_jasminesv_all_inputs {

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

fasta = file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true)
fasta_fai = file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true)
chr_norm = Channel.of("chr21 21", "chr22 22").collectFile(name:"chr_norm.txt", newLine:true)

JASMINESV ( input, fasta, fasta_fai, chr_norm )
}
13 changes: 13 additions & 0 deletions tests/modules/nf-core/jasminesv/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
process {

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

withName: "test_jasminesv_iris:JASMINESV" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to also test for additional iris args?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that would be a good idea! Thanks for the suggestion, I'll look into it!

ext.args = "--run_iris"
}

withName: "test_jasminesv_all_inputs:JASMINESV" {
ext.args = "--normalize_chrs"
}

}
26 changes: 26 additions & 0 deletions tests/modules/nf-core/jasminesv/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
- name: jasminesv test_jasminesv_minimum
command: nextflow run ./tests/modules/nf-core/jasminesv -entry test_jasminesv_minimum -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/jasminesv/nextflow.config
tags:
- jasminesv
files:
- path: output/jasminesv/test.vcf
md5sum: a5f2ea4423010007d26bd61adb169eb7
- path: output/jasminesv/versions.yml

- name: jasminesv test_jasminesv_iris
command: nextflow run ./tests/modules/nf-core/jasminesv -entry test_jasminesv_iris -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/jasminesv/nextflow.config
tags:
- jasminesv
files:
- path: output/jasminesv/test.vcf
md5sum: 4140a44d52426b17c4882a2b4d7508fb
- path: output/jasminesv/versions.yml

- name: jasminesv test_jasminesv_all_inputs
command: nextflow run ./tests/modules/nf-core/jasminesv -entry test_jasminesv_all_inputs -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/jasminesv/nextflow.config
tags:
- jasminesv
files:
- path: output/jasminesv/test.vcf
md5sum: ee57b923cb0a6e2af25790942281fa09
- path: output/jasminesv/versions.yml