Skip to content

Commit

Permalink
added snapshot for all workflows
Browse files Browse the repository at this point in the history
added two test cases
    missing phenotypes should cause pipeline failing and no output file
    specify one phenotype should output only one output file
  • Loading branch information
AmstlerStephan committed Dec 15, 2023
1 parent 3f5b554 commit c733b9d
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 83 deletions.
110 changes: 74 additions & 36 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,6 @@ nextflow_pipeline {
assert snapshot(new File("$outputDir/results/Y1.regenie.gz"), new File("$outputDir/results/Y2.regenie.gz") , workflow.trace).match()
}

}

test("Should fail since no phenotype is specified") {

when {

params {
project = 'test-gene-based-test'
genotypes_build = 'hg19'
genotypes_prediction = "$projectDir/tests/input/pipeline/example.{bim,bed,fam}"
genotypes_association = "$projectDir/tests/input/pipeline/example.{bim,bed,fam}"
genotypes_association_format = 'bed'
phenotypes_filename = "$projectDir/tests/input/pipeline/phenotype_bin.txt"
phenotypes_binary_trait = true
phenotypes_columns = ''
covariates_filename = "$projectDir/tests/input/pipeline/covariates.txt"
covariates_columns = 'V1,V2,V3'
regenie_run_gene_based_tests = true
regenie_gene_anno = "$projectDir/tests/input/gene_based_tests/example.annotation"
regenie_gene_setlist = "$projectDir/tests/input/gene_based_tests/example.setlist"
regenie_gene_masks = "$projectDir/tests/input/gene_based_tests/example.masks"
regenie_gene_test = 'skat'
regenie_gene_aaf = 0.01
regenie_gene_vc_max_aaf = 100
regenie_gene_vc_mac_thr = 10
regenie_gene_build_mask = 'sum'
rsids_filename = "$projectDir/tests/input/pipeline/rsids.tsv.gz"
outdir = "$outputDir"
}
}

then {
assert workflow.fail
assert workflow.out.my_channel.size() == 0
}

}

test("Should execute gene-based test pipeline") {
Expand Down Expand Up @@ -901,4 +865,78 @@ test("Should GWAS with chunking and optional step 1 param") {
}


test("Should execute gene-based-test with only one output file") {

when {

params {
project = 'test-gene-based-test'
genotypes_build = 'hg19'
genotypes_prediction = "$projectDir/tests/input/pipeline/example.{bim,bed,fam}"
genotypes_association = "$projectDir/tests/input/pipeline/example.{bim,bed,fam}"
genotypes_association_format = 'bed'
phenotypes_filename = "$projectDir/tests/input/pipeline/phenotype_bin.txt"
phenotypes_binary_trait = true
phenotypes_columns = 'Y1'
covariates_filename = "$projectDir/tests/input/pipeline/covariates.txt"
covariates_columns = 'V1,V2,V3'
regenie_run_gene_based_tests = true
regenie_gene_anno = "$projectDir/tests/input/gene_based_tests/example.annotation"
regenie_gene_setlist = "$projectDir/tests/input/gene_based_tests/example.setlist"
regenie_gene_masks = "$projectDir/tests/input/gene_based_tests/example.masks"
regenie_gene_test = 'skat'
regenie_gene_aaf = 0.01
regenie_gene_vc_max_aaf = 100
regenie_gene_vc_mac_thr = 10
regenie_gene_build_mask = 'sum'
rsids_filename = "$projectDir/tests/input/pipeline/rsids.tsv.gz"
outdir = "$outputDir"
}
}

then {
assert workflow.success
snapshot(new File("$outputDir/results/Y1.regenie.gz"), workflow.trace).match()
}

}


test("Should fail since no phenotype is specified") {

when {

params {
project = 'test-gene-based-test'
genotypes_build = 'hg19'
genotypes_prediction = "$projectDir/tests/input/pipeline/example.{bim,bed,fam}"
genotypes_association = "$projectDir/tests/input/pipeline/example.{bim,bed,fam}"
genotypes_association_format = 'bed'
phenotypes_filename = "$projectDir/tests/input/pipeline/phenotype_bin.txt"
phenotypes_binary_trait = true
phenotypes_columns = ''
covariates_filename = "$projectDir/tests/input/pipeline/covariates.txt"
covariates_columns = 'V1,V2,V3'
regenie_run_gene_based_tests = true
regenie_gene_anno = "$projectDir/tests/input/gene_based_tests/example.annotation"
regenie_gene_setlist = "$projectDir/tests/input/gene_based_tests/example.setlist"
regenie_gene_masks = "$projectDir/tests/input/gene_based_tests/example.masks"
regenie_gene_test = 'skat'
regenie_gene_aaf = 0.01
regenie_gene_vc_max_aaf = 100
regenie_gene_vc_mac_thr = 10
regenie_gene_build_mask = 'sum'
rsids_filename = "$projectDir/tests/input/pipeline/rsids.tsv.gz"
outdir = "$outputDir"
}
}

then {
assert workflow.failed
snapshot(workflow.trace).match()
}

}


}
71 changes: 24 additions & 47 deletions tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -169,59 +169,15 @@
},
"Should execute GWAS with header in phenotype file (custom batch size)": {
"content": [
{
"directory": false,
"file": false,
"freeSpace": 0,
"canonicalPath": "/home/nanopore/genepi_hackathon/nf-test/nf-gwas-1/.nf-test/tests/60a3cad7bcdf791d727b26515b05aeb1/output/results/Y1.regenie.gz",
"usableSpace": 0,
"hidden": false,
"totalSpace": 0,
"path": "/home/nanopore/genepi_hackathon/nf-test/nf-gwas-1/.nf-test/tests/60a3cad7bcdf791d727b26515b05aeb1/output/results/Y1.regenie.gz",
"name": "Y1.regenie.gz",
"absolute": true,
"absolutePath": "/home/nanopore/genepi_hackathon/nf-test/nf-gwas-1/.nf-test/tests/60a3cad7bcdf791d727b26515b05aeb1/output/results/Y1.regenie.gz",
"parent": [
"PHENO1.regenie.gz:md5,c03c47e1d4300277f2a445afc14c6d1e",
"PHENO1.regenie.gz.tbi:md5,52c43bd02a8ceff6c362d0b56ff5fbfe",
"PHENO2.regenie.gz:md5,3b600580a44b792462720d7e7c734ccc",
"PHENO2.regenie.gz.tbi:md5,72f72954151e910c9ed849b95ac9b402",
[
"PHENO1.regenie.filtered.gz:md5,1da6cac933d2aa0b38613b96e9a5c517",
"PHENO2.regenie.filtered.gz:md5,8dba8315f5bd13f8ae62c9ba1a7dfce6"
]
]
},
{
"directory": false,
"file": false,
"freeSpace": 0,
"canonicalPath": "/home/nanopore/genepi_hackathon/nf-test/nf-gwas-1/.nf-test/tests/60a3cad7bcdf791d727b26515b05aeb1/output/results/Y2.regenie.gz",
"usableSpace": 0,
"hidden": false,
"totalSpace": 0,
"path": "/home/nanopore/genepi_hackathon/nf-test/nf-gwas-1/.nf-test/tests/60a3cad7bcdf791d727b26515b05aeb1/output/results/Y2.regenie.gz",
"name": "Y2.regenie.gz",
"absolute": true,
"absolutePath": "/home/nanopore/genepi_hackathon/nf-test/nf-gwas-1/.nf-test/tests/60a3cad7bcdf791d727b26515b05aeb1/output/results/Y2.regenie.gz",
"parent": [
"PHENO1.regenie.gz:md5,c03c47e1d4300277f2a445afc14c6d1e",
"PHENO1.regenie.gz.tbi:md5,52c43bd02a8ceff6c362d0b56ff5fbfe",
"PHENO2.regenie.gz:md5,3b600580a44b792462720d7e7c734ccc",
"PHENO2.regenie.gz.tbi:md5,72f72954151e910c9ed849b95ac9b402",
[
"PHENO1.regenie.filtered.gz:md5,1da6cac933d2aa0b38613b96e9a5c517",
"PHENO2.regenie.filtered.gz:md5,8dba8315f5bd13f8ae62c9ba1a7dfce6"
]
]
},
"PHENO1.regenie.gz:md5,c03c47e1d4300277f2a445afc14c6d1e",
"PHENO2.regenie.gz:md5,3b600580a44b792462720d7e7c734ccc",
{
"tasksFailed": 0,
"tasksCount": 40,
"tasksSucceeded": 40
}
],
"timestamp": "2023-12-14T16:44:21.551356"
"timestamp": "2023-12-15T09:39:33.247657"
},
"Should execute GWAS with recessive test": {
"content": [
Expand Down Expand Up @@ -366,6 +322,16 @@
],
"timestamp": "2023-12-14T16:42:19.084491"
},
"Should fail since no phenotype is specified": {
"content": [
{
"tasksFailed": 0,
"tasksCount": 0,
"tasksSucceeded": 0
}
],
"timestamp": "2023-12-15T09:46:31.396474"
},
"Should execute liftover and GWAS pipeline with array results": {
"content": [
"Y1.regenie.gz:md5,2819b6b773587f7f88028281a29bd1a4",
Expand All @@ -378,6 +344,17 @@
],
"timestamp": "2023-12-14T16:39:34.107772"
},
"Should execute gene-based-test with only one output file": {
"content": [
"Y1.regenie.gz:md5,61a5f115619d3ee3c14a34a63e1fe73b",
{
"tasksFailed": 0,
"tasksCount": 9,
"tasksSucceeded": 9
}
],
"timestamp": "2023-12-15T09:53:01.767545"
},
"Should execute GWAS with deletion of missing phenotype data": {
"content": [
"Y1.regenie.gz:md5,3b46e913e302d59a27c87f989384a689",
Expand Down

0 comments on commit c733b9d

Please sign in to comment.