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

Issue 348 #419

Merged
merged 5 commits into from
Oct 11, 2024
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#393](https://github.com/genomic-medicine-sweden/nallo/pull/393) - Added a new `--minimap2_read_mapping_preset` parameter
- [#403](https://github.com/genomic-medicine-sweden/nallo/pull/403) - Added `FOUND_IN=hificnv` tags to CNV calling output
- [#417](https://github.com/genomic-medicine-sweden/nallo/pull/417) - Added `FOUND_IN=deepvariant` tags to SNV calling output
- [#419](https://github.com/genomic-medicine-sweden/nallo/pull/419) - Added support for SV filtering using input BED file ([#348](https://github.com/genomic-medicine-sweden/nallo/issues/348))

### `Changed`

Expand Down
3 changes: 2 additions & 1 deletion subworkflows/local/call_svs/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workflow CALL_SVS {
ch_fai // channel [mandatory]: [ val(meta), path(fai) ]
sv_caller // val [mandatory]: Which caller to use
ch_tandem_repeats // channel [optional]: [ val(meta), path(bed) ]
ch_bed // channel [optional]: [ val(meta), path(bed) ]

main:
ch_versions = Channel.empty()
Expand Down Expand Up @@ -82,7 +83,7 @@ workflow CALL_SVS {
.set { ch_bcftools_merge_in }

// Merge the files with new sample names
BCFTOOLS_MERGE ( ch_bcftools_merge_in, ch_fasta, ch_fai, [[],[]] )
BCFTOOLS_MERGE ( ch_bcftools_merge_in, ch_fasta, ch_fai, ch_bed )
ch_versions = ch_versions.mix(BCFTOOLS_MERGE.out.versions)

emit:
Expand Down
172 changes: 160 additions & 12 deletions subworkflows/local/call_svs/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ nextflow_workflow {
}
}

test("1 sample - [bam, bai], fasta, fai, [] - sniffles") {
test("1 sample - [bam, bai], fasta, fai, [], [] - sniffles") {

when {
workflow {
Expand All @@ -45,6 +45,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "sniffles"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand All @@ -64,7 +65,7 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, bed - sniffles") {
test("1 sample - [bam, bai], fasta, fai, bed, [] - sniffles") {

when {
workflow {
Expand All @@ -81,6 +82,7 @@ nextflow_workflow {
[ id:'trf' ],
file('https://github.com/fritzsedlazeck/Sniffles/raw/master/annotations/human_GRCh38_no_alt_analysis_set.trf.bed', checkIfExists: true)
]
input[5] = [[],[]]
"""
}
}
Expand All @@ -100,7 +102,7 @@ nextflow_workflow {

}

test("2 samples - [bam, bai], fasta, fai, [] - sniffles") {
test("2 samples - [bam, bai], fasta, fai, [], [] - sniffles") {

when {
workflow {
Expand All @@ -121,6 +123,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "sniffles"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand All @@ -141,7 +144,43 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, [] - severus") {
test("1 sample - [bam, bai], fasta, fai, [], bed - sniffles") {

when {
workflow {
"""
input[0] = Channel.of([
[ id:'test', single_end:false, project: 'project' ], // meta map
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam', checkIfExists: true),
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam.bai', checkIfExists: true)
])
input[1] = GUNZIP.out.gunzip
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "sniffles"
input[4] = [[],[]]
input[5] = Channel.of('chr20\t2650000\t2660000')
.collectFile(name: 'chr20.bed', newLine: true)
.map{ file -> [ [ id:'chr20'], file ] }
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert workflow.out.ch_sv_calls_tbi.get(0).get(1).endsWith("tbi") },
{ assert workflow.out.ch_multisample_tbi.get(0).get(1).endsWith("tbi") },
{ assert snapshot(
path(workflow.out.ch_sv_calls_vcf.get(0).get(1)).vcf.variantsMD5,
path(workflow.out.ch_multisample_vcf.get(0).get(1)).vcf.variantsMD5,
workflow.out.versions,
).match() }
)
}

}

test("1 sample - [bam, bai], fasta, fai, [], [] - severus") {

when {
workflow {
Expand All @@ -155,6 +194,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "severus"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand All @@ -174,7 +214,7 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, bed - severus") {
test("1 sample - [bam, bai], fasta, fai, bed, [] - severus") {

when {
workflow {
Expand All @@ -191,6 +231,43 @@ nextflow_workflow {
[ id:'trf' ],
file('https://github.com/fritzsedlazeck/Sniffles/raw/master/annotations/human_GRCh38_no_alt_analysis_set.trf.bed', checkIfExists: true)
]
input[5] = [[],[]]
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert workflow.out.ch_sv_calls_tbi.get(0).get(1).endsWith("tbi") },
{ assert workflow.out.ch_multisample_tbi.get(0).get(1).endsWith("tbi") },
{ assert snapshot(
path(workflow.out.ch_sv_calls_vcf.get(0).get(1)).vcf.variantsMD5,
path(workflow.out.ch_multisample_vcf.get(0).get(1)).vcf.variantsMD5,
workflow.out.versions,
).match() }
)
}

}

test("1 sample - [bam, bai], fasta, fai, [], bed - severus") {

when {
workflow {
"""
input[0] = Channel.of([
[ id:'test', single_end:false, project: 'project' ], // meta map
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam', checkIfExists: true),
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam.bai', checkIfExists: true)
])
input[1] = GUNZIP.out.gunzip
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "severus"
input[4] = [[],[]]
input[5] = Channel.of('chr20\t2650000\t2660000')
.collectFile(name: 'chr20.bed', newLine: true)
.map{ file -> [ [ id:'chr20'], file ] }
"""
}
}
Expand All @@ -210,7 +287,7 @@ nextflow_workflow {

}

test("2 samples - [bam, bai], fasta, fai, [] - severus") {
test("2 samples - [bam, bai], fasta, fai, [], [] - severus") {

when {
workflow {
Expand All @@ -231,6 +308,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "severus"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand All @@ -251,7 +329,7 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, [] - sniffles -stub") {
test("1 sample - [bam, bai], fasta, fai, [], [] - sniffles -stub") {

options "-stub"

Expand All @@ -267,6 +345,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "sniffles"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand All @@ -280,7 +359,7 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, bed - sniffles -stub") {
test("1 sample - [bam, bai], fasta, fai, bed, [] - sniffles -stub") {

options "-stub"

Expand All @@ -299,6 +378,39 @@ nextflow_workflow {
[ id:'trf' ],
file('https://github.com/fritzsedlazeck/Sniffles/raw/master/annotations/human_GRCh38_no_alt_analysis_set.trf.bed', checkIfExists: true)
]
input[5] = [[],[]]
"""
}
}

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

}

test("1 sample - [bam, bai], fasta, fai, [], bed - sniffles -stub") {

options "-stub"

when {
workflow {
"""
input[0] = Channel.of([
[ id:'test', single_end:false, project: 'project' ], // meta map
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam', checkIfExists: true),
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam.bai', checkIfExists: true)
])
input[1] = GUNZIP.out.gunzip
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "sniffles"
input[4] = [[],[]]
input[5] = Channel.of('chr20\t2650000\t2660000')
.collectFile(name: 'chr20.bed', newLine: true)
.map{ file -> [ [ id:'chr20'], file ] }
"""
}
}
Expand All @@ -312,7 +424,7 @@ nextflow_workflow {

}

test("2 samples - [bam, bai], fasta, fai, [] - sniffles -stub") {
test("2 samples - [bam, bai], fasta, fai, [], [] - sniffles -stub") {

options "-stub"

Expand All @@ -335,6 +447,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "sniffles"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand All @@ -354,7 +467,37 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, [] - severus -stub") {
test("1 sample - [bam, bai], fasta, fai, [], [] - severus -stub") {

options "-stub"

when {
workflow {
"""
input[0] = Channel.of([
[ id:'test', single_end:false, project: 'project' ], // meta map
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam', checkIfExists: true),
file(params.pipelines_testdata_base_path + 'testdata/HG002_PacBio_Revio.bam.bai', checkIfExists: true)
])
input[1] = GUNZIP.out.gunzip
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "severus"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}

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

}

test("1 sample - [bam, bai], fasta, fai, [], bed - severus -stub") {

options "-stub"

Expand All @@ -370,6 +513,9 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "severus"
input[4] = [[],[]]
input[5] = Channel.of('chr20\t2650000\t2660000')
.collectFile(name: 'chr20.bed', newLine: true)
.map{ file -> [ [ id:'chr20'], file ] }
"""
}
}
Expand All @@ -383,7 +529,7 @@ nextflow_workflow {

}

test("1 sample - [bam, bai], fasta, fai, bed - severus -stub") {
test("1 sample - [bam, bai], fasta, fai, bed, [] - severus -stub") {

options "-stub"

Expand All @@ -402,6 +548,7 @@ nextflow_workflow {
[ id:'trf' ],
file('https://github.com/fritzsedlazeck/Sniffles/raw/master/annotations/human_GRCh38_no_alt_analysis_set.trf.bed', checkIfExists: true)
]
input[5] = [[],[]]
"""
}
}
Expand All @@ -415,7 +562,7 @@ nextflow_workflow {

}

test("2 samples - [bam, bai], fasta, fai, [] - severus -stub") {
test("2 samples - [bam, bai], fasta, fai, [], [] - severus -stub") {

options "-stub"

Expand All @@ -438,6 +585,7 @@ nextflow_workflow {
input[2] = SAMTOOLS_FAIDX.out.fai
input[3] = "severus"
input[4] = [[],[]]
input[5] = [[],[]]
"""
}
}
Expand Down
Loading
Loading