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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Changed`

- [#294](https://github.com/nf-core/phaseimpute/pull/294) - Migrate nf-tests to `UTILS.groovy` structure.
- [#267](https://github.com/nf-core/phaseimpute/pull/267) - Refactor repeated `params.steps` / `params.tools` and replace `println` calls with `log.info`.
- [#244](https://github.com/nf-core/phaseimpute/pull/244) - Start migration to strict syntax.
- [#237](https://github.com/nf-core/phaseimpute/pull/237) - Bump version to 1.2.0dev and update `CHANGELOG.md`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nextflow_function {
*/

name "Test function phaseimpute"
script "../function.nf"
script "../workflows/phaseimpute/function.nf"
tag "function"

test("Prepare chunks channel Glimpse - with chunks") {
Expand Down
38 changes: 38 additions & 0 deletions tests/lib/UTILS.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,42 @@ class UTILS {
def samples = path(filePath).vcf.header.getGenotypeSamples().sort()
return [summary: summary, samples: samples]
}


public static def getPhaseimputeTest = { Map scenario ->
return {
tag "pipeline"
tag "pipeline/phaseimpute"

if (scenario.tag) {
tag scenario.tag
}

config scenario.config

when {
params {
publish_dir_mode = "copy"
pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/refs/heads/phaseimpute/'
outdir = "$outputDir"
publish_all = true

(scenario.params ?: [:]).each { key, value ->
delegate."$key" = value
}
}
}

then {
assertAll(
{ assert workflow.success },
{ assert snapshot(
UTILS.getPipelineResults(outputDir, workflow),
*(scenario.details ? [scenario.details(outputDir)] : [])
).match() }
)
}
}
}

}
40 changes: 40 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,53 @@ process {
time: '2.h'
]

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_PHASE_SHAPEIT5:SHAPEIT5_PHASECOMMON' {
cpus = 1
ext.args = { "--seed ${params.seed}" }
ext.suffix = "bcf"
ext.prefix = { "${meta.panel_id}_${meta.regionout.replace(':',"_")}_chunks" }
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_IMPUTE_STITCH:STITCH' {
cpus = 1
ext.prefix = { "${meta.id}.batch${meta.batch}.${meta.regionout ? meta.regionout.replace(':','_') : meta.chr}.stitch" }
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_IMPUTE_QUILT:QUILT_QUILT' {
cpus = 1
ext.args = { "--seed=${params.seed}" }
ext.prefix = { "${meta.id}.batch${meta.batch}.${meta.regionout ? meta.regionout.replace(':','_') : meta.chr}.quilt" }
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_IMPUTE_QUILT2:QUILT_QUILT2' {
cpus = 1
ext.args = { "--seed=${params.seed} --use_mspbwt=TRUE --impute_rare_common=FALSE" }
ext.prefix = { "${meta.id}.batch${meta.batch}.${meta.regionout ? meta.regionout.replace(':','_') : meta.chr}.quilt2" }
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE' {
cpus = 1
cache = "lenient"
ext.prefix = { "${meta.id}.batch${meta.batch}.${meta.regionout ? meta.regionout.replace(':','_') : meta.chr}.glimpse2" }
ext.args = { "--keep-monomorphic-ref-sites --seed ${params.seed}" }
ext.suffix = "bcf"
publishDir = [ enabled: false ]
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_IMPUTE_GLIMPSE:GLIMPSE_PHASE' {
cpus = 1
ext.prefix = { "${meta.id}.batch${meta.batch}.${meta.regionout ? meta.regionout.replace(':','_') : meta.chr}.glimpse1" }
ext.args = { "--impute-reference-only-variants --seed ${params.seed}" }
ext.suffix = "bcf"
publishDir = [ enabled: false ]
}

withName: 'NFCORE_PHASEIMPUTE:PHASEIMPUTE:VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE' {
ext.args = { "gp=true ap=true seed=${params.seed}" }
ext.prefix = { "${meta.id}.${meta.chr}.beagle5" }
publishDir = [ enabled: false ]
}

}

// Or any resources requirements
Expand Down
44 changes: 44 additions & 0 deletions tests/test_all.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
def projectDir = new File('.').absolutePath

nextflow_pipeline {

name "Test phaseimpute workflow"
script "../main.nf"
tag "pipeline"
tag "pipeline/phaseimpute"
tag "test_all"

def test_scenario = [
[
name: "Check test_all - with map",
config: "../conf/test_all.config",
details: { outdir ->
[
"all_samples.glimpse1": UTILS.vcfDetails("$outdir/imputation/glimpse1/concat/all_samples.batch0.glimpse1.vcf.gz"),
"all_samples.glimpse2": UTILS.vcfDetails("$outdir/imputation/glimpse2/concat/all_samples.batch0.glimpse2.vcf.gz"),
"all_samples.quilt": UTILS.vcfDetails("$outdir/imputation/quilt/concat/all_samples.batch0.quilt.vcf.gz"),
"all_samples.stitch": UTILS.vcfDetails("$outdir/imputation/stitch/concat/all_samples.batch0.stitch.vcf.gz"),
]
},
],
[
name: "Check test_all - no map",
config: "../conf/test_all.config",
params: [
map: null,
],
details: { outdir ->
[
"all_samples.glimpse1": UTILS.vcfDetails("$outdir/imputation/glimpse1/concat/all_samples.batch0.glimpse1.vcf.gz"),
"all_samples.glimpse2": UTILS.vcfDetails("$outdir/imputation/glimpse2/concat/all_samples.batch0.glimpse2.vcf.gz"),
"all_samples.quilt": UTILS.vcfDetails("$outdir/imputation/quilt/concat/all_samples.batch0.quilt.vcf.gz"),
"all_samples.stitch": UTILS.vcfDetails("$outdir/imputation/stitch/concat/all_samples.batch0.stitch.vcf.gz"),
]
},
]
]

test_scenario.each { scenario ->
test(scenario.name, UTILS.getPhaseimputeTest(scenario))
}
}
29 changes: 29 additions & 0 deletions tests/test_batch.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
def projectDir = new File('.').absolutePath

nextflow_pipeline {

name "Test phaseimpute workflow"
script "../main.nf"
tag "pipeline"
tag "pipeline/phaseimpute"
tag "test_batch"

def test_scenario = [
[
name: "Check test_batch",
config: "../conf/test_batch.config",
details: { outdir ->
[
"all_samples.batch0.glimpse2": UTILS.vcfDetails("$outdir/imputation/glimpse2/concat/all_samples.batch0.glimpse2.vcf.gz"),
"all_samples.batch1.glimpse2": UTILS.vcfDetails("$outdir/imputation/glimpse2/concat/all_samples.batch1.glimpse2.vcf.gz"),
"all_samples.batch0.quilt": UTILS.vcfDetails("$outdir/imputation/quilt/concat/all_samples.batch0.quilt.vcf.gz"),
"all_samples.batch1.quilt": UTILS.vcfDetails("$outdir/imputation/quilt/concat/all_samples.batch1.quilt.vcf.gz"),
]
},
]
]

test_scenario.each { scenario ->
test(scenario.name, UTILS.getPhaseimputeTest(scenario))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -464,21 +464,35 @@
]
},
{
"all_samples.glimpse2": {
"all_samples.batch0.glimpse2": {
"summary": "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1739, phased=true]",
"samples": [
"NA12878",
"NA19401"
]
},
"all_samples.batch1.glimpse2": {
"summary": "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1739, phased=true]",
"samples": [
"NA20359"
]
},
"all_samples.quilt": {
"all_samples.batch0.quilt": {
"summary": "VcfFile [chromosomes=[chr21, chr22], sampleCount=2, variantCount=1739, phased=true]",
"samples": [
"NA12878",
"NA19401"
]
},
"all_samples.batch1.quilt": {
"summary": "VcfFile [chromosomes=[chr21, chr22], sampleCount=1, variantCount=1739, phased=true]",
"samples": [
"NA20359"
]
}
}
],
"timestamp": "2026-05-17T14:05:55.670301894",
"timestamp": "2026-05-24T16:25:40.025066728",
"meta": {
"nf-test": "0.9.5",
"nextflow": "26.04.0"
Expand Down
39 changes: 39 additions & 0 deletions tests/test_beagle5.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
def projectDir = new File('.').absolutePath

nextflow_pipeline {

name "Test phaseimpute workflow"
script "../main.nf"
tag "pipeline"
tag "pipeline/phaseimpute"
tag "test_beagle5"

def test_scenario = [
[
name: "Check test_beagle5 - with chunks - with map",
config: "../conf/test_beagle5.config",
details: { outdir ->
[
"NA12878.beagle5": UTILS.vcfDetails("$outdir/imputation/beagle5/concat/NA12878.beagle5.vcf.gz"),
]
},
],
[
name: "Check test_beagle5 - no chunks - no map",
config: "../conf/test_beagle5.config",
params: [
chunks: null,
map: null,
],
details: { outdir ->
[
"NA12878.beagle5": UTILS.vcfDetails("$outdir/imputation/beagle5/concat/NA12878.beagle5.vcf.gz"),
]
},
]
]

test_scenario.each { scenario ->
test(scenario.name, UTILS.getPhaseimputeTest(scenario))
}
}
28 changes: 28 additions & 0 deletions tests/test_dog.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
def projectDir = new File('.').absolutePath

nextflow_pipeline {

name "Test phaseimpute workflow"
script "../main.nf"
tag "pipeline"
tag "pipeline/phaseimpute"
tag "test_dog"

def test_scenario = [
[
name: "Check test_dog - no map",
config: "../conf/test_dog.config",
details: { outdir ->
[
"all_samples.glimpse1": UTILS.vcfDetails("$outdir/imputation/glimpse1/concat/all_samples.batch0.glimpse1.vcf.gz"),
"all_samples.glimpse2": UTILS.vcfDetails("$outdir/imputation/glimpse2/concat/all_samples.batch0.glimpse2.vcf.gz"),
"all_samples.quilt": UTILS.vcfDetails("$outdir/imputation/quilt/concat/all_samples.batch0.quilt.vcf.gz"),
]
},
]
]

test_scenario.each { scenario ->
test(scenario.name, UTILS.getPhaseimputeTest(scenario))
}
}
39 changes: 39 additions & 0 deletions tests/test_glimpse1.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
def projectDir = new File('.').absolutePath

nextflow_pipeline {

name "Test phaseimpute workflow"
script "../main.nf"
tag "pipeline"
tag "pipeline/phaseimpute"
tag "test_glimpse1"

def test_scenario = [
[
name: "Check test_glimpse1 - with chunks - with map",
config: "../conf/test.config",
details: { outdir ->
[
"all_samples.batch0.glimpse1": UTILS.vcfDetails("$outdir/imputation/glimpse1/concat/all_samples.batch0.glimpse1.vcf.gz"),
]
},
],
[
name: "Check test_glimpse1 - no chunks - no map",
config: "../conf/test.config",
params: [
chunks: null,
map: null,
],
details: { outdir ->
[
"all_samples.batch0.glimpse1": UTILS.vcfDetails("$outdir/imputation/glimpse1/concat/all_samples.batch0.glimpse1.vcf.gz"),
]
},
]
]

test_scenario.each { scenario ->
test(scenario.name, UTILS.getPhaseimputeTest(scenario))
}
}
Loading
Loading