Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Updated nf-tests. #107

Merged
merged 2 commits into from
Mar 5, 2025
Merged
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 @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [PR #100](https://github.com/nf-core/molkart/pull/100) - Added author and license information to all bin scripts (@FloWuenne)
- [PR #101](https://github.com/nf-core/molkart/pull/101) - Updated manifest and author information (@FloWuenne)
- [PR #102](https://github.com/nf-core/molkart/pull/102) - Updated documentation (@kbestak)
- [PR #107](https://github.com/nf-core/molkart/pull/107) - Updated nf-tests to use nft-utils (@FloWuenne)

### Fixed

Expand Down
9 changes: 7 additions & 2 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
config {

testsDir "tests"
workDir ".nf-test"
configFile "tests/nextflow.config"
workDir System.getenv("NFT_WORKDIR") ?: ".nf-test"
configFile ""
profile ""

// Include plugins
plugins {
load "[email protected]"
}

}
15 changes: 15 additions & 0 deletions tests/.nftignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.DS_Store
pipeline_info/*.{html,json,txt,yml}
multiqc/multiqc_data/multiqc_data.json
multiqc/multiqc_data/multiqc.log
multiqc/multiqc_plots/pdf/*
multiqc/multiqc_plots/png/*
multiqc/multiqc_plots/svg/*
multiqc/multiqc_report.html
multiqc/crop_overview.png
multiqc/crop_overview.txt
clahe/*.tiff
stack/*.tif
molkartqc/crop_overview.png
training_subset/hdf5/*
training_subset/tiff/*
123 changes: 68 additions & 55 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ nextflow_pipeline {

name "Test Workflow main.nf"
script "../main.nf"
config "./nextflow.config"
tag "pipeline"
tag "pipeline_molkart"

Expand All @@ -21,24 +20,24 @@ nextflow_pipeline {
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assert workflow.success
assert snapshot(
path("$outputDir/mindagap/nuc_only_nuclear_gridfilled.tiff"),
path("$outputDir/mindagap/nuc_only_spots_markedDups.txt"),
path("$outputDir/segmentation/cellpose/nuc_only_cellpose_mask.tif"),
path("$outputDir/segmentation/mesmer/nuc_only_mesmer_mask.tif"),
path("$outputDir/segmentation/stardist/nuc_only_stardist_mask.tif"),
path("$outputDir/segmentation/filtered_masks/nuc_only_mesmer_filtered.tif"),
path("$outputDir/segmentation/filtered_masks/nuc_only_stardist_filtered.tif"),
path("$outputDir/segmentation/filtered_masks/nuc_only_cellpose_filtered.tif"),
path("$outputDir/spot2cell/cellxgene_nuc_only_cellpose.csv"),
path("$outputDir/spot2cell/cellxgene_nuc_only_mesmer.csv"),
path("$outputDir/anndata/nuc_only_cellpose.adata"),
path("$outputDir/anndata/nuc_only_mesmer.adata"),
path("$outputDir/molkartqc/nuc_only.cellpose.spot_QC.csv"),
path("$outputDir/molkartqc/nuc_only.mesmer.spot_QC.csv")
).match()
assert file("$outputDir/multiqc/multiqc_report.html").exists()
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_molkart_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name,
// All files with stable contents
stable_path
).match() }
)
}
}

Expand All @@ -57,26 +56,24 @@ nextflow_pipeline {
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assert workflow.success
assert snapshot(
path("$outputDir/mindagap/mem_only_membrane_gridfilled.tiff"),
path("$outputDir/mindagap/mem_only_nuclear_gridfilled.tiff"),
path("$outputDir/mindagap/mem_only_spots_markedDups.txt"),
path("$outputDir/segmentation/cellpose/mem_only_cellpose_mask.tif"),
path("$outputDir/segmentation/mesmer/mem_only_mesmer_mask.tif"),
path("$outputDir/segmentation/filtered_masks/mem_only_mesmer_filtered.tif"),
path("$outputDir/segmentation/filtered_masks/mem_only_cellpose_filtered.tif"),
path("$outputDir/spot2cell/cellxgene_mem_only_cellpose.csv"),
path("$outputDir/spot2cell/cellxgene_mem_only_mesmer.csv"),
path("$outputDir/anndata/mem_only_cellpose.adata"),
path("$outputDir/anndata/mem_only_mesmer.adata"),
path("$outputDir/molkartqc/mem_only.cellpose.spot_QC.csv"),
path("$outputDir/molkartqc/mem_only.mesmer.spot_QC.csv"),
).match()
assert file("$outputDir/stack/mem_only_stack.ome.tif").exists()
assert file("$outputDir/clahe/mem_only_membrane_gridfilled_clahe.tiff").exists()
assert file("$outputDir/clahe/mem_only_nuclear_gridfilled_clahe.tiff").exists()
assert file("$outputDir/multiqc/multiqc_report.html").exists()
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_molkart_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name,
// All files with stable contents
stable_path
).match() }
)
}
}

Expand All @@ -93,16 +90,24 @@ nextflow_pipeline {
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assert workflow.success
assert snapshot(
path("$outputDir/segmentation/cellpose/mem_only_cellpose_mask.tif"),
path("$outputDir/segmentation/filtered_masks/mem_only_cellpose_filtered.tif"),
path("$outputDir/spot2cell/cellxgene_mem_only_cellpose.csv"),
path("$outputDir/anndata/mem_only_cellpose.adata"),
path("$outputDir/molkartqc/mem_only.cellpose.spot_QC.csv"),
).match()
assert file("$outputDir/stack/mem_only_stack.ome.tif").exists()
assert file("$outputDir/multiqc/multiqc_report.html").exists()
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_molkart_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name,
// All files with stable contents
stable_path
).match() }
)
}
}

Expand All @@ -124,16 +129,24 @@ nextflow_pipeline {
}

then {
// stable_name: All files + folders in ${params.outdir}/ with a stable name
def stable_name = getAllFilesFromDir(params.outdir, relative: true, includeDir: true, ignore: ['pipeline_info/*.{html,json,txt}'])
// stable_path: All files in ${params.outdir}/ with stable content
def stable_path = getAllFilesFromDir(params.outdir, ignoreFile: 'tests/.nftignore')
assert workflow.success
assert snapshot(
path("$outputDir/mindagap/nuc_only_nuclear_gridfilled.tiff"),
).match()
assert file("$outputDir/clahe/nuc_only_nuclear_gridfilled_clahe.tiff").exists()
assert file("$outputDir/training_subset/hdf5/nuc_only_nuclear_gridfilled_clahe_crop0.hdf5").exists()
assert file("$outputDir/training_subset/hdf5/nuc_only_nuclear_gridfilled_clahe_crop1.hdf5").exists()
assert file("$outputDir/training_subset/tiff/nuc_only_nuclear_gridfilled_clahe_crop0.tiff").exists()
assert file("$outputDir/training_subset/tiff/nuc_only_nuclear_gridfilled_clahe_crop1.tiff").exists()
assert file("$outputDir/multiqc/crop_overview.png").exists()
assertAll(
{ assert workflow.success},
{ assert snapshot(
// Number of successful tasks
workflow.trace.succeeded().size(),
// pipeline versions.yml file for multiqc from which Nextflow version is removed because we tests pipelines on multiple Nextflow versions
removeNextflowVersion("$outputDir/pipeline_info/nf_core_molkart_software_mqc_versions.yml"),
// All stable path name, with a relative path
stable_name,
// All files with stable contents
stable_path
).match() }
)
}
}
}
Loading