Skip to content

Commit

Permalink
Update vcf_split_bcftools
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisLeNezet committed Nov 17, 2024
1 parent a94009a commit 4e0ce65
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 10 deletions.
58 changes: 52 additions & 6 deletions subworkflows/local/vcf_split_bcftools/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ nextflow_workflow {
tag "bcftools"
tag "bcftools/split"

test("Split vcf file") {
test("Split multiple vcf file") {
setup {
run("BCFTOOLS_MERGE") {
script "../../../../modules/nf-core/bcftools/merge/main.nf"
process {
"""
input[0] = Channel.of(
[
[id: "allSamples"],
[id: "allSamples.batch0"],
[file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s_imputed.bcf", checkIfExist:true),
file(params.pipelines_testdata_base_path + "hum_data/individuals/NA19401/NA19401.s_imputed.bcf", checkIfExist:true),
file(params.pipelines_testdata_base_path + "hum_data/individuals/NA20359/NA20359.s_imputed.bcf", checkIfExist:true)],
Expand All @@ -43,10 +43,6 @@ nextflow_workflow {
}
}
when {
params {
max_cpus = 2
max_memory = '2.GB'
}
workflow {
"""
input[0] = BCFTOOLS_MERGE.out.vcf.join(BCFTOOLS_MERGE.out.tbi)
Expand Down Expand Up @@ -74,4 +70,54 @@ nextflow_workflow {
)
}
}

test("Split one sample vcf file") {
when {
workflow {
"""
input[0] = Channel.of([
[id: 'NA12878'],
file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s_imputed.bcf", checkIfExist:true),
file(params.pipelines_testdata_base_path + "hum_data/individuals/NA12878/NA12878.s_imputed.bcf.csi", checkIfExist:true)
])
"""
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(
workflow.out.versions,
workflow.out.vcf_tbi.collect{[
it[0],
path(it[1]).getFileName().toString(),
path(it[2]).getFileName().toString()
] }
).match() }
)
}
}

test("Split no sample vcf file") {
when {
workflow {
"""
input[0] = Channel.of([
[id: 'dbsnp_146.hg38'],
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz", checkIfExist:true),
file(params.modules_testdata_base_path + "genomics/homo_sapiens/genome/vcf/dbsnp_146.hg38.vcf.gz.tbi", checkIfExist:true)
])
"""
}
}

then {
assertAll(
{ assert workflow.failed },
{ assert workflow.errorReport.contains("No samples to split: dbsnp_146.hg38.vcf.gz")
}
)
}
}
}
29 changes: 25 additions & 4 deletions subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
{
"Split vcf file": {
"Split one sample vcf file": {
"content": [
[
"versions.yml:md5,6c3351d97e3a99f7a7a3231fc49f92e2"
],
[
[
{
"id": "NA12878"
},
"NA12878.vcf.gz",
"NA12878.vcf.gz.tbi"
]
]
],
"meta": {
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-13T14:06:59.745818945"
},
"Split multiple vcf file": {
"content": [
[
"versions.yml:md5,6c3351d97e3a99f7a7a3231fc49f92e2"
Expand Down Expand Up @@ -34,9 +55,9 @@
]
],
"meta": {
"nf-test": "0.9.1",
"nf-test": "0.9.2",
"nextflow": "24.10.0"
},
"timestamp": "2024-11-07T14:13:06.801872176"
"timestamp": "2024-11-11T14:42:48.076610625"
}
}
}
3 changes: 3 additions & 0 deletions subworkflows/local/vcf_split_bcftools/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
process {
resourceLimits = [cpus: 2, memory: '2.GB']

withName: BCFTOOLS_MERGE {
ext.args = ["--write-index=tbi", "--output-type z"].join(' ')
}

withName: BCFTOOLS_PLUGINSPLIT {
ext.args = ["--write-index=tbi", "--output-type z"].join(' ')
}
Expand Down

0 comments on commit 4e0ce65

Please sign in to comment.