Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion modules/nf-core/sniffles/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ process SNIFFLES {
: 'community.wave.seqera.io/library/sniffles:2.8.1--b8c26c44b42620c5' }"

input:
tuple val(meta), path(input), path(index)
tuple val(meta), path(input), path(index), path(genotype_vcf)
tuple val(meta2), path(fasta)
tuple val(meta3), path(tandem_file)
val(vcf_output)
Expand All @@ -31,13 +31,18 @@ process SNIFFLES {
def tandem_repeats = tandem_file ? "--tandem-repeats ${tandem_file}" : ''
def vcf = vcf_output ? "--vcf ${prefix}.vcf.gz": ''
def snf = snf_output ? "--snf ${prefix}.snf": ''
// Sniffles reads the sites file as plain text, a gzipped one is decompressed first (fritzsedlazeck/Sniffles#613)
def decompress = genotype_vcf && genotype_vcf.name.endsWith('.gz') ? "gzip -dc ${genotype_vcf} > ${prefix}.sites.vcf" : ''
def genotype = genotype_vcf ? "--genotype-vcf ${genotype_vcf.name.endsWith('.gz') ? prefix + '.sites.vcf' : genotype_vcf}" : ''

"""
$decompress
sniffles \\
--input $input \\
$reference \\
-t $task.cpus \\
$tandem_repeats \\
$genotype \\
$vcf \\
$snf \\
$args
Expand Down
8 changes: 7 additions & 1 deletion modules/nf-core/sniffles/meta.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sniffles
description: structural-variant calling with sniffles
description: structural-variant calling and genotyping of known structural variants (forced calling with --genotype-vcf) with sniffles.
keywords:
- sniffles
- structural-variant calling
Expand Down Expand Up @@ -30,6 +30,12 @@ input:
description: Index of BAM/CAM file
pattern: "*.{bai,crai}"
ontologies: []
- genotype_vcf:
type: file
description: Optional VCF of known structural variants to genotype in the input BAM/CRAM (forced calling), plain or gzipped. Use an empty list (`[]`) for regular SV calling.
pattern: "*.{vcf,vcf.gz}"
ontologies:
- edam: http://edamontology.org/format_3016
- - meta2:
type: map
description: |
Expand Down
132 changes: 124 additions & 8 deletions modules/nf-core/sniffles/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ nextflow_process {
tag "modules"
tag "modules_nfcore"
tag "sniffles"
tag "gunzip"

test("homo_sapiens - [bam, bai], fasta, [], true, false") {

Expand All @@ -17,7 +18,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -52,7 +54,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -85,7 +88,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -121,7 +125,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -162,7 +167,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -194,7 +200,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -226,7 +233,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand Down Expand Up @@ -258,7 +266,8 @@ nextflow_process {
input[0] = [
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true)
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/test.sorted.bam.bai', checkIfExists: true),
[]
]
input[1] = [
[ id:'genome' ],
Expand All @@ -283,4 +292,111 @@ nextflow_process {

}

test("homo_sapiens - nanopore [bam, bai, vcf.gz], [], [], true, false - genotype") {

when {
process {
"""
input[0] = [
[ id:'hg002' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_genotype.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_genotype.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_sites.vcf.gz', checkIfExists: true)
]
input[1] = [[], []]
input[2] = [[], []]
input[3] = true
input[4] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.findAll { key, val -> key.startsWith("versions") },
file(process.out.tbi.get(0).get(1)).name,
path(process.out.vcf.get(0).get(1)).linesGzip.findAll { line -> !line.startsWith("##genotype") },
).match() }
)
}

}

test("homo_sapiens - nanopore [bam, bai, vcf], [], [], true, false - genotype") {

setup {
run("GUNZIP") {
script "../../gunzip/main.nf"
process {
"""
input[0] = [
[ id:'sites' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_sites.vcf.gz', checkIfExists: true)
]
"""
}
}
}

when {
process {
"""
input[0] = channel.of([
[ id:'hg002' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_genotype.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_genotype.bam.bai', checkIfExists: true)
]).combine(GUNZIP.out.gunzip.map { _meta, vcf -> vcf })
input[1] = [[], []]
input[2] = [[], []]
input[3] = true
input[4] = false
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(
process.out.findAll { key, val -> key.startsWith("versions") },
file(process.out.tbi.get(0).get(1)).name,
path(process.out.vcf.get(0).get(1)).linesGzip.findAll { line -> !line.startsWith("##genotype") },
).match() }
)
}

}

test("homo_sapiens - nanopore [bam, bai, vcf.gz], [], [], true, false - genotype - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'hg002' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_genotype.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_genotype.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/nanopore/bam/HG002_ont_sv_genotype/HG002_ont_sv_sites.vcf.gz', checkIfExists: true)
]
input[1] = [[], []]
input[2] = [[], []]
input[3] = true
input[4] = false
"""
}
}

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

}

}
Loading
Loading