-
Notifications
You must be signed in to change notification settings - Fork 254
nf-core/nf-test guide #3387
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
base: main
Are you sure you want to change the base?
nf-core/nf-test guide #3387
Changes from 2 commits
46a9ec9
e9dbed1
843dedc
b8ed9c4
03ffe78
dcbabb7
026c71e
5421cad
b9d8f43
4b6198e
367618f
f0e4858
c7ce2f3
25a5a4c
6937422
ba41ea1
0e44c89
6469170
b87864c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| --- | ||
| title: "1. Installation" | ||
| subtitle: Setting up nf-test in your development environment | ||
| weight: 10 | ||
| --- | ||
|
|
||
| ## Installing nf-test | ||
|
|
||
| **For nf-core pipeline development and testing, you need to install nf-test separately.** nf-core tools only provides test commands for the `nf-core/modules` repository context. | ||
|
|
||
| ### Prerequisites | ||
|
|
||
| Before installing nf-test, ensure you have: | ||
|
|
||
| - **Java 11 or higher** | ||
| - **Nextflow** (latest stable version recommended) | ||
|
|
||
| ### Recommended Installation: Using Conda/Mamba | ||
|
|
||
| ```bash | ||
| conda install -c bioconda nf-core | ||
| conda install -c bioconda nf-test | ||
| # or | ||
| mamba install -c bioconda nf-core | ||
| mamba install -c bioconda nf-test | ||
| ``` | ||
|
|
||
| ### Alternative Installation Methods | ||
|
|
||
sateeshperi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ```bash | ||
| curl -fsSL https://get.nf-test.com | bash | ||
| ``` | ||
|
|
||
| Move the `nf-test` file to a directory accessible by your `$PATH` variable: | ||
|
|
||
| ```bash | ||
| # Make it executable and move to PATH | ||
| chmod +x nf-test | ||
| sudo mv nf-test /usr/local/bin/ | ||
| ``` | ||
|
|
||
| #### Install specific version | ||
|
|
||
sateeshperi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ```bash | ||
| curl -fsSL https://get.nf-test.com | bash -s 0.9.0 | ||
| ``` | ||
|
|
||
| > **For complete installation instructions and troubleshooting**, visit the [official nf-test installation documentation](https://www.nf-test.com/docs/getting-started/). | ||
|
|
||
| ### Verification | ||
|
|
||
| Verify your installation: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| nf-test version | ||
| ``` | ||
|
|
||
| List available tests: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| nf-test list | ||
| ``` | ||
|
|
||
| ## Next Steps | ||
|
|
||
| Once you have nf-test installed, proceed to [nf-test Commands & Integration](./02_commands_integration.md) to learn the essential commands. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| --- | ||
| title: "2. nf-test Commands & Integration" | ||
| subtitle: Essential commands and nf-core integration | ||
| weight: 20 | ||
| --- | ||
|
|
||
|
||
| ## Prerequisites | ||
|
|
||
| Before running these commands, ensure you have: | ||
|
|
||
| - nf-test installed (see [Installation Guide](./01_installation.md)) | ||
| - An nf-core pipeline or nf-core/modules repo set up | ||
| - Access to test data (local or remote) | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ## Understanding Testing Contexts | ||
|
|
||
| There are **two main contexts** for running nf-test commands in the nf-core ecosystem: | ||
|
|
||
| ### 1. nf-core/modules Repository Context | ||
|
|
||
| When working in the **nf-core/modules repository**, use `nf-core` tools commands: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - Testing individual modules and subworkflows | ||
| - Contributing to the shared nf-core modules library | ||
| - Use `nf-core modules test` and `nf-core subworkflows test` | ||
|
|
||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ### 2. Individual Pipeline Context | ||
|
|
||
| When developing **individual nf-core pipelines**, use `nf-test` commands directly: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| - Testing complete pipeline workflows | ||
| - Pipeline-specific test configurations | ||
| - Use `nf-test test` commands | ||
|
|
||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| --- | ||
|
|
||
| ## nf-core/modules Repository Commands | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| > **Note**: These commands only work within the nf-core/modules repository | ||
|
|
||
| ### Module Testing | ||
|
|
||
| ```bash | ||
| # Test a specific module | ||
| nf-core modules test bedtools/bamtobed --profile docker | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Update module test snapshots | ||
| nf-core modules test bedtools/bamtobed --profile docker --update | ||
|
|
||
| # Test with verbose output | ||
| nf-core modules test bedtools/bamtobed --profile docker --verbose | ||
| ``` | ||
|
|
||
| ### Subworkflow Testing | ||
|
|
||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ```bash | ||
| # Test a subworkflow | ||
| nf-core subworkflows test vcf_impute_glimpse --profile docker | ||
|
|
||
| # Update subworkflow snapshots | ||
| nf-core subworkflows test vcf_impute_glimpse --profile docker --update | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Individual Pipeline Commands | ||
|
|
||
| > **Note**: Use these commands when working on individual nf-core pipelines. You can use `nf-core/sarek`, `nf-core/methylseq`, `nf-core/rnaseq` as examples. | ||
|
|
||
| ### Basic Testing | ||
|
|
||
| ```bash | ||
| # List all available tests | ||
| nf-test list | ||
|
|
||
| # Run all tests with profiles | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| nf-test test --profile test,docker | ||
|
|
||
| # Run specific test file | ||
| nf-test test tests/default.nf-test --profile test,docker | ||
|
|
||
| # Update snapshots | ||
| nf-test test --profile test,docker --update-snapshot | ||
|
|
||
| # Run tests with verbose output | ||
| nf-test test --profile test,docker --verbose | ||
|
|
||
| # Run specific test by tag | ||
| nf-test test --tag pipeline --profile test,docker | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Next Steps | ||
|
|
||
| Continue to [Project Setup](./03_project_setup.md) to configure your testing environment. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| --- | ||
| title: "3. Repository Setup" | ||
| subtitle: Configuring your nf-core pipeline repository for testing with nf-test | ||
| weight: 30 | ||
| --- | ||
|
|
||
| ## Example nf-core Repository Structure | ||
|
|
||
| Here is an example of an nf-core pipeline project with nf-test: | ||
|
|
||
| ``` | ||
| my-pipeline/ | ||
| ├── main.nf # Main pipeline script | ||
| ├── nextflow.config # Main pipeline configuration | ||
| ├── nextflow_schema.json # Pipeline parameter schema | ||
| ├── nf-test.config # nf-test configuration | ||
| ├── modules.json # Module dependencies | ||
| ├── tests/ # Pipeline-level tests | ||
| │ ├── default.nf.test # Main pipeline test | ||
| │ ├── nextflow.config # Test-specific config | ||
sateeshperi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| │ └── .nftignore # Files to ignore in snapshots | ||
| ├── conf/ # Configuration profiles | ||
| │ ├── test.config # Test profile | ||
| │ ├── test_full.config # Full test profile | ||
| │ ├── base.config # Base configuration | ||
| │ └── igenomes.config # Reference genome configurations | ||
| ├── assets/ # Pipeline assets | ||
| │ ├── samplesheet.csv # Test samplesheet | ||
| │ └── schema_input.json # Input validation schema | ||
| ├── modules/nf-core/ # Module tests | ||
| │ └── */tests/main.nf.test # Individual module tests | ||
| ├── subworkflows/nf-core/ # Subworkflow tests | ||
| │ └── */tests/main.nf.test # Individual subworkflow tests | ||
| └── .nf-test/ # nf-test working directory | ||
| ``` | ||
|
|
||
| ### 1. Key Configuration Files | ||
|
|
||
| #### `nf-test.config` (Main Configuration) | ||
|
|
||
| **Purpose**: Controls nf-test global settings | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```groovy | ||
| config { | ||
| testsDir "." | ||
| workDir System.getenv("NFT_WORKDIR") ?: ".nf-test" | ||
| configFile "tests/nextflow.config" | ||
| ignore 'modules/nf-core/**/*', 'subworkflows/nf-core/**/*' | ||
| profile "test" | ||
| triggers 'nextflow.config', 'nf-test.config', 'conf/test.config', 'tests/nextflow.config', 'tests/.nftignore' | ||
| plugins { | ||
| load "[email protected]" | ||
| // Add plugins based on your pipeline needs: | ||
| // load "[email protected]" // For BAM file testing | ||
| // load "[email protected]" // For VCF file testing | ||
| // load "[email protected]" // For FASTQ file testing | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| > **For complete configuration options**, see the [official nf-test configuration documentation](https://www.nf-test.com/docs/configuration/). | ||
|
|
||
| ### Available nf-test Plugins | ||
|
|
||
| For nf-core pipeline testing, you may need these plugins: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| | Plugin Name | Description/Use | | ||
| | ---------------- | ---------------------------------------------------------------------------------------------------------------------------- | | ||
| | **nft-utils** | Essential utility functions like `getAllFilesFromDir()` and `removeNextflowVersion()` - widely used across nf-core pipelines | | ||
| | **nft-bam** | Helper functionality for handling SAM/BAM/CRAM files during tests - critical for genomics pipelines | | ||
| | **nft-vcf** | Support for VCF files - utilities for testing variant call format files | | ||
| | **nft-fasta** | Support for FASTA files - enables validation and testing of FASTA file formats | | ||
| | **nft-fastq** | Support for FASTQ files - validation and testing utilities for sequencing data files | | ||
| | **nft-csv** | Support for CSV files - utilities for testing comma-separated value files | | ||
| | **nft-compress** | Support for ZIP files - enables testing of compressed file handling | | ||
| | **nft-anndata** | Support for AnnData (h5ad) files - utilities for testing single-cell analysis data formats | | ||
| | **nft-tiff** | Support for TIFF files - enables testing of Tagged Image File Format files | | ||
|
|
||
| > **Note:** For the complete list of available plugins and their latest versions, visit the [nf-test plugins registry](https://plugins.nf-test.com/). | ||
|
|
||
| #### `tests/nextflow.config` (Test-Specific Settings) | ||
|
|
||
| **Purpose**: Defines parameters and settings specifically for test execution | ||
|
|
||
sateeshperi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ```groovy | ||
| params { | ||
| modules_testdata_base_path = 's3://ngi-igenomes/testdata/nf-core/modules/' | ||
| pipelines_testdata_base_path = 'https://raw.githubusercontent.com/nf-core/test-datasets/PIPELINE_NAME/' | ||
| input = "${projectDir}/assets/samplesheet.csv" | ||
| outdir = 'results' | ||
| } | ||
|
|
||
| process { | ||
| resourceLimits = [ | ||
| cpus: 2, | ||
| memory: '3.GB', | ||
| time: '2.h' | ||
| ] | ||
| } | ||
|
|
||
| aws.client.anonymous = true | ||
| ``` | ||
|
|
||
| ## Test Data Integration | ||
|
|
||
| nf-core tools 3.3+ includes a command for discovering and managing test datasets: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| # List all available test datasets | ||
| nf-core test-datasets list | ||
|
|
||
| # List datasets for a specific branch | ||
| nf-core test-datasets list --branch mag | ||
|
|
||
| # Search for specific datasets | ||
| nf-core test-datasets search --branch mag minigut_reads | ||
|
|
||
| # Generate download URLs for datasets | ||
| nf-core test-datasets list --branch mag --generate-dl-url | ||
|
|
||
| # Generate nf-test compatible paths | ||
| nf-core test-datasets list --branch mag --generate-nf-path | ||
| ``` | ||
|
|
||
| > **Note:** This feature requires [nf-core/tools 3.3+](https://nf-co.re/blog/2025/tools-3_3#new-nf-core-test-datasets-command). | ||
|
|
||
| ## Generating Tests (Optional) | ||
|
|
||
| Most nf-core pipelines already have tests generated. If needed: | ||
sateeshperi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```bash | ||
| # Generate test template for a process | ||
| nf-test generate process path/to/main.nf | ||
|
|
||
| # Generate test for workflow | ||
| nf-test generate workflow path/to/main.nf | ||
| ``` | ||
|
|
||
| ## Basic Commands Summary | ||
|
|
||
| | Command | Purpose | | ||
| | -------------------------------- | ----------------------- | | ||
| | `nf-test list` | Show available tests | | ||
| | `nf-test test --profile docker` | Run all tests | | ||
| | `nf-test test --update-snapshot` | Update expected outputs | | ||
| | `nf-test test --verbose` | Show detailed output | | ||
|
|
||
| ## Next Steps | ||
|
|
||
| With your project properly configured, proceed to [Testing Modules](./04_testing_modules.md) to start writing comprehensive module tests. | ||
Uh oh!
There was an error while loading. Please reload this page.