diff --git a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test index 46c09660..1864bb76 100644 --- a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test +++ b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test @@ -15,7 +15,7 @@ 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" @@ -23,7 +23,7 @@ nextflow_workflow { """ 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)], @@ -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) @@ -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") + } + ) + } + } } diff --git a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap index d3bd681e..02a8da3a 100644 --- a/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap +++ b/subworkflows/local/vcf_split_bcftools/tests/main.nf.test.snap @@ -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" @@ -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" } -} \ No newline at end of file +} diff --git a/subworkflows/local/vcf_split_bcftools/tests/nextflow.config b/subworkflows/local/vcf_split_bcftools/tests/nextflow.config index 523678dc..a2282fbf 100644 --- a/subworkflows/local/vcf_split_bcftools/tests/nextflow.config +++ b/subworkflows/local/vcf_split_bcftools/tests/nextflow.config @@ -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(' ') }