Skip to content

Commit

Permalink
port bam split by region to nf-test
Browse files Browse the repository at this point in the history
  • Loading branch information
fellen31 committed Feb 14, 2025
1 parent 68b686d commit c148d20
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 97 deletions.
14 changes: 0 additions & 14 deletions subworkflows/nf-core/bam_split_by_region/nextflow.config

This file was deleted.

45 changes: 45 additions & 0 deletions subworkflows/nf-core/bam_split_by_region/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core subworkflows test bam_split_by_region
nextflow_workflow {

name "Test Subworkflow BAM_SPLIT_BY_REGION"
script "../main.nf"
workflow "BAM_SPLIT_BY_REGION"

tag "subworkflows"
tag "subworkflows_nfcore"
tag "subworkflows/bam_split_by_region"
tag "samtools"
tag "samtools/sort"
tag "samtools/index"

config "./nextflow.config"

test("homo_sapiens - test_paired_end_markduplicates_sorted_bam") {

when {
workflow {
"""
input[0] = Channel.of([
[ id: 'test', single_end: false ],
file(params.modules_testdata_base_path +'genomics/homo_sapiens/illumina/bam/test.paired_end.markduplicates.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path +'genomics/homo_sapiens/illumina/bam/test.paired_end.markduplicates.sorted.bam.bai', checkIfExists: true),
file(params.modules_testdata_base_path +'genomics/homo_sapiens/genome/chr21/sequence/multi_intervals.bed', checkIfExists: true),
])
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(
workflow.out.bam_bai.findAll { file(it.get(1)).name }.toSorted(),
workflow.out.bam_bai.findAll { bam(it.get(1)).getReadsMD5() }.toSorted(),
workflow.out.bam_bai.findAll { file(it.get(2)).name }.toSorted(),
workflow.out.versions
).match() }
)
}
}
}
102 changes: 102 additions & 0 deletions subworkflows/nf-core/bam_split_by_region/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"homo_sapiens - test_paired_end_markduplicates_sorted_bam": {
"content": [
[
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:24132499-24910998"
},
"test_chr21:24132499-24910998.bam:md5,649908006f4333ef13e42313e0885d96",
"test_chr21:24132499-24910998.bam.bai:md5,0d76977b2e36046cc176112776c5fa4e"
],
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:25689497-46709983"
},
"test_chr21:25689497-46709983.bam:md5,c4bc65ad94bde9cc901d33e964a977c6",
"test_chr21:25689497-46709983.bam.bai:md5,834238b87a13404627fecaa1ed7ae4f4"
],
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:1-23354000"
},
"test_chr21:1-23354000.bam:md5,e17b22b80b4ba098232f12a3cb612c73",
"test_chr21:1-23354000.bam.bai:md5,adbf2a0b95a947c055c219f0d950add0"
]
],
[
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:24132499-24910998"
},
"test_chr21:24132499-24910998.bam:md5,649908006f4333ef13e42313e0885d96",
"test_chr21:24132499-24910998.bam.bai:md5,0d76977b2e36046cc176112776c5fa4e"
],
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:25689497-46709983"
},
"test_chr21:25689497-46709983.bam:md5,c4bc65ad94bde9cc901d33e964a977c6",
"test_chr21:25689497-46709983.bam.bai:md5,834238b87a13404627fecaa1ed7ae4f4"
],
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:1-23354000"
},
"test_chr21:1-23354000.bam:md5,e17b22b80b4ba098232f12a3cb612c73",
"test_chr21:1-23354000.bam.bai:md5,adbf2a0b95a947c055c219f0d950add0"
]
],
[
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:24132499-24910998"
},
"test_chr21:24132499-24910998.bam:md5,649908006f4333ef13e42313e0885d96",
"test_chr21:24132499-24910998.bam.bai:md5,0d76977b2e36046cc176112776c5fa4e"
],
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:25689497-46709983"
},
"test_chr21:25689497-46709983.bam:md5,c4bc65ad94bde9cc901d33e964a977c6",
"test_chr21:25689497-46709983.bam.bai:md5,834238b87a13404627fecaa1ed7ae4f4"
],
[
{
"id": "test",
"single_end": false,
"genomic_region": "chr21:1-23354000"
},
"test_chr21:1-23354000.bam:md5,e17b22b80b4ba098232f12a3cb612c73",
"test_chr21:1-23354000.bam.bai:md5,adbf2a0b95a947c055c219f0d950add0"
]
],
[
"versions.yml:md5,022ce36c7637b4c28f9e7a3b6d788543",
"versions.yml:md5,1430b8967dea6b0eb5a65313c8d81e81"
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.3"
},
"timestamp": "2025-02-14T08:59:50.32521715"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
process {
withName: "BAM_SPLIT_BY_REGION:SAMTOOLS_VIEW" {
ext.args2 = { "${meta.genomic_region}" } // Specifies the chromosome name used for splitting the input bam file.
ext.prefix = { "${meta.id}_${meta.genomic_region}" }
}
}
3 changes: 0 additions & 3 deletions tests/config/pytest_modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -426,9 +426,6 @@ subworkflows/bam_markduplicates_samtools:
subworkflows/bam_ngscheckmate:
- subworkflows/nf-core/bam_ngscheckmate/**
- tests/subworkflows/nf-core/bam_ngscheckmate/**
subworkflows/bam_split_by_region:
- subworkflows/nf-core/bam_split_by_region/**
- tests/subworkflows/nf-core/bam_split_by_region/**
subworkflows/bam_tumor_normal_somatic_variant_calling_gatk:
- subworkflows/nf-core/bam_tumor_normal_somatic_variant_calling_gatk/**
- tests/subworkflows/nf-core/bam_tumor_normal_somatic_variant_calling_gatk/**
Expand Down
30 changes: 0 additions & 30 deletions tests/subworkflows/nf-core/bam_split_by_region/main.nf

This file was deleted.

15 changes: 0 additions & 15 deletions tests/subworkflows/nf-core/bam_split_by_region/nextflow.config

This file was deleted.

35 changes: 0 additions & 35 deletions tests/subworkflows/nf-core/bam_split_by_region/test.yml

This file was deleted.

0 comments on commit c148d20

Please sign in to comment.