This document provides comprehensive guidance for AI agents working with the quantms bioinformatics pipeline. These guidelines ensure code quality, maintainability, and compliance with project standards.
ALWAYS run pre-commit hooks before committing ANY changes:
pre-commit run --all-filesThis is non-negotiable. All code must pass formatting and style checks before being committed.
- Project Overview
- Technology Stack
- Validation Workflow
- Testing Strategy
- Development Conventions
- CI/CD Awareness
- Common Tasks
- Troubleshooting
quantms is an nf-core bioinformatics best-practice analysis pipeline for Quantitative Mass Spectrometry (MS). It supports three major analytical workflows:
- DDA-LFQ: Data-dependent acquisition with label-free quantification
- DDA-ISO: Data-dependent acquisition with isobaric labeling (TMT, iTRAQ)
- DIA-LFQ: Data-independent acquisition with label-free quantification
Key Features:
- Built with Nextflow DSL2
- Integrates multiple search engines: Comet, MSGF+, Sage, DIA-NN
- Uses OpenMS tools for proteomics processing
- Statistical analysis with MSstats
- Quality control with pmultiqc
- Complies with nf-core standards
Repository: https://github.com/bigbio/quantms Documentation: https://quantms.readthedocs.io/
- Nextflow: >=25.04.0 (DSL2 syntax)
- nf-schema plugin: 2.5.1 (parameter validation)
- nf-test: Testing framework (config:
nf-test.config) - nf-core tools: Pipeline standards and linting
- Containers: Docker/Singularity/Apptainer/Podman (Conda deprecated)
nextflow.config- Main pipeline configuration (541 lines)nextflow_schema.json- Parameter schema (auto-generated)nf-test.config- Testing configuration.nf-core.yml- nf-core compliance settingsmodules.json- Module dependencies.pre-commit-config.yaml- Pre-commit hooks
quantms/
├── main.nf # Pipeline entry point
├── workflows/ # Main workflows (quantms.nf, lfq.nf, tmt.nf, dia.nf)
├── subworkflows/local/ # Reusable subworkflows
├── modules/ # Process definitions
│ ├── local/ # Custom modules
│ ├── bigbio/ # BigBio shared modules
│ └── nf-core/ # nf-core modules
├── conf/ # Configuration files
│ ├── base.config # Resource definitions
│ ├── modules/ # Module-specific configs
│ └── tests/ # Test profile configs (13 profiles)
├── tests/ # nf-test test cases
├── bin/ # Utility scripts (R scripts for MSstats)
└── assets/ # Pipeline assets and schemas
Installation:
pip install pre-commit
pre-commit install # Install git hooks (one-time setup)Run before EVERY commit:
pre-commit run --all-filesConfigured Hooks (.pre-commit-config.yaml):
-
Prettier (v3.1.0 with prettier@3.6.2)
- Formats code consistently across multiple file types
- Auto-fixes formatting issues
-
trailing-whitespace
- Removes trailing whitespace (preserves markdown linebreaks)
-
end-of-file-fixer
- Ensures files end with a single newline
Excluded Files:
CHANGELOG.md(manually maintained)modules/nf-core/**(managed by nf-core)subworkflows/nf-core/**(managed by nf-core)*.snap(test snapshots)
Auto-fix in CI: If you forget to run pre-commit locally, comment on your PR:
@nf-core-bot fix linting
The bot will run pre-commit and push fixes automatically.
Run before creating PR:
nf-core pipelines lintFor master branch PRs:
nf-core pipelines lint --releaseThis validates:
- nf-core pipeline standards compliance
- File structure and naming
- Configuration completeness
- Documentation requirements
After adding/modifying parameters in nextflow.config:
nf-core pipelines schema buildThis updates nextflow_schema.json with interactive prompts to add descriptions and validation rules.
Do NOT run the full test suite before every commit. The CI system runs comprehensive tests automatically. Instead:
- Pre-commit hooks: ALWAYS (fast, catches style issues)
- Targeted tests: Run tests relevant to your changes
- CI validation: Trust the CI to catch integration issues
No testing required:
- README, CHANGELOG, docs/ updates
- Minor config tweaks (labels, descriptions)
- Comment additions
- Asset file updates (email templates, correction matrices)
Run specific test profile(s):
| Change Area | Test Profile(s) | Command |
|---|---|---|
| LFQ workflow | test_lfq |
nextflow run . -profile test_lfq,docker --outdir results |
| TMT/iTRAQ workflow | test_tmt |
nextflow run . -profile test_tmt,docker --outdir results |
| TMT with correction | test_tmt_corr |
nextflow run . -profile test_tmt_corr,docker --outdir results |
| DIA workflow | test_dia |
nextflow run . -profile test_dia,docker --outdir results |
| PTM localization | test_localize |
nextflow run . -profile test_localize,docker --outdir results |
| Sage search engine | test_lfq_sage |
nextflow run . -profile test_lfq_sage,docker --outdir results |
| AlphaPeptDeep rescoring | test_dda_id_alphapeptdeep |
nextflow run . -profile test_dda_id_alphapeptdeep,docker --outdir results |
| MS2PIP rescoring | test_dda_id_ms2pip |
nextflow run . -profile test_dda_id_ms2pip,docker --outdir results |
Run nf-test suite:
# Run all tests with nf-test
nf-test test --profile debug,test,docker --verbose
# Or run specific test file
nf-test test tests/default.nf.test --profile debug,test,docker --verboseWhen to run comprehensive tests:
- Core pipeline logic changes (main.nf, quantms.nf)
- Cross-cutting subworkflow modifications
- Module changes affecting multiple workflows
- Before final PR submission (optional but recommended)
All test profiles are in conf/tests/:
test_lfq.config- Quick LFQ test (default)test_tmt.config- TMT isobaric labelingtest_tmt_corr.config- TMT with plex correctiontest_dia.config- DIA label-freetest_latest_dia.config- Latest DIA versiontest_localize.config- PTM localizationtest_lfq_sage.config- LFQ with Sagetest_full_lfq.config- Full-size LFQ datasettest_full_tmt.config- Full-size TMT datasettest_full_dia.config- Full-size DIA datasettest_dda_id_alphapeptdeep.config- AlphaPeptDeep rescoringtest_dda_id_ms2pip.config- MS2PIP rescoringtest_dda_id_fine_tuning.config- Fine-tuning workflow
The pipeline uses snapshot-based testing (tests/default.nf.test):
- Compares stable file names and content
- Validates workflow success
- Ignores volatile files (pipeline_info/*.{html,json,txt})
Updating snapshots after intentional changes:
nf-test test --profile debug,test,docker --update-snapshot- Target branch:
dev(NOT master) - Master branch: Release-ready code only
- PR process: Fork → feature branch → PR to
dev
Initial output from a process:
ch_output_from_<process_name>Intermediate/terminal channels:
ch_<previous_process>_for_<next_process>Examples:
ch_output_from_comet
ch_comet_for_fdr_control
ch_fdr_for_protein_inference- Use lowercase with underscores:
peptide_indexer,protein_inference - Be descriptive:
OPENMS_PERCOLATORADAPTERnotPERCOLATOR - Follow nf-core conventions for consistency
Defined in conf/base.config:
| Label | CPU | Memory | Time | Use Case |
|---|---|---|---|---|
process_single |
1 | 6 GB | 4h | Single-threaded tools |
process_tiny |
1 | 1 GB | 1h | Minimal processing |
process_very_low |
2 | 12 GB | 4h | Light parallelism |
process_low |
4 | 36 GB | 8h | Moderate workload |
process_medium |
8 | 72 GB | 16h | Standard processing |
process_high |
12 | 108 GB | 20h | Heavy computation |
Usage in process:
process MY_PROCESS {
label 'process_medium'
cpus task.cpus
memory task.memory
}When adding a new processing step to the pipeline:
- Define input/output channels in the workflow
- Write process block in
modules/local/or reuse from nf-core/bigbio - Add parameters to
nextflow.configwith sensible defaults - Update schema:
nf-core pipelines schema build
- Add parameter validation (type, range, enum constraints)
- Perform local testing with appropriate test profile
- Add test configuration in
conf/tests/if needed - Update MultiQC config (
assets/multiqc_config.yml) if generates reports - Update documentation:
docs/usage.md- Parameter descriptionsdocs/output.md- Output file descriptions
- Update CHANGELOG.md and
CITATIONS.mdif adds new tools
Module-specific settings in conf/modules/modules.config:
withName: 'OPENMS_PERCOLATORADAPTER' {
ext.args = [
params.fdr_threshold ? "-score_type q-value -threshold ${params.fdr_threshold}" : '',
params.train_FDR ? "-train_FDR ${params.train_FDR}" : ''
].join(' ').trim()
publishDir = [
path: { "${params.outdir}/intermediate_results/fdr_control" },
mode: params.publish_dir_mode,
pattern: '*.idparquet'
]
}- Indentation: 4 spaces (enforced by Prettier)
- Line length: Aim for <120 characters
- Comments: Use
//for single-line,/* */for multi-line - Strings: Use single quotes
'text'unless interpolation needed"$var" - Groovy closures: Follow Nextflow DSL2 patterns
Understanding what runs automatically helps you anticipate issues:
Triggers: All PRs, releases Runs:
- Pre-commit hooks (prettier, whitespace, EOF)
nf-core pipelines lint(with--releasefor master PRs)
Artifacts: lint_log.txt, lint_results.md
Triggers: Push to dev/master, PRs, releases Matrix:
- Nextflow:
25.04.0 - Test profiles: All 7 main profiles (lfq, tmt, dia, localize, sage, alphapeptdeep, ms2pip)
- Container: Docker
Steps:
- Checkout with full history
- Setup Java 17
- Install Nextflow
- Free disk space
- Run pipeline with test profile
- Upload artifacts on failure
Artifacts: Failed logs, results, nextflow logs (timestamped)
Concurrency: Cancels in-progress runs for same PR
Matrix:
- Nextflow:
25.04.0+latest-everything - Test profiles: All 8 profiles including
test_tmt_corr - Runs without
devprofile on master
Purpose: Prevents direct PRs to master
Action: Only allows PRs from dev or patch branches
Trigger: Comment @nf-core-bot fix linting on PR
Action: Runs pre-commit, commits fixes, pushes changes
✅ You don't need to run all tests locally - CI does this
✅ Pre-commit failures in CI - Use @nf-core-bot fix linting
✅ Test failures - Check artifacts for logs
✅ Lint failures - Run nf-core pipelines lint locally first
✅ Branch errors - Ensure PRs target dev not master
# Clone repository
git clone https://github.com/bigbio/quantms.git
cd quantms
# Install pre-commit hooks
pip install pre-commit
pre-commit install
# Install nf-core tools
pip install nf-core
# Install nf-test (if testing locally)
# See: https://code.askimed.com/nf-test/installation/# 1. Create feature branch from dev
git checkout dev
git pull origin dev
git checkout -b feature/my-new-feature
# 2. Make your changes
# ... edit files ...
# 3. Run pre-commit (MANDATORY)
pre-commit run --all-files
# 4. Update schema if parameters changed
nf-core pipelines schema build
# 5. Run targeted tests (if code changes)
nextflow run . -profile test_lfq,docker --outdir results_test
# 6. Commit changes
git add .
git commit -m "feat: add new feature"
# 7. Push and create PR
git push origin feature/my-new-feature
# Create PR to dev branch on GitHub# List installed modules
nf-core modules list local
# Update specific module
nf-core modules update <module_name>
# Update all modules
nf-core modules update --all# Basic test run
nextflow run . -profile test,docker --outdir results
# With debug output
nextflow run . -profile debug,test,docker --outdir results
# Specific test profile
nextflow run . -profile test_lfq,docker --outdir results
# Resume from cache
nextflow run . -profile test,docker --outdir results -resume
# Custom parameters
nextflow run . -profile test,docker \
--outdir results \
--enable_mod_localization \
--mod_residues 'S,T,Y' \
--mod_mass_shift 79.966331After running pipeline, check these files in results/:
pipeline_info/execution_report.html- Resource usagepipeline_info/execution_timeline.html- Timeline visualizationpipeline_info/execution_trace.txt- Detailed tracemultiqc/multiqc_report.html- Quality control report
Problem: Pre-commit hook fails with formatting issues
Files were modified by this hook. Additional output:
Solution: The files were auto-fixed. Stage and commit again:
git add .
git commit -m "your message"Problem: Pre-commit is slow on large changesets
Solution: Run on specific files only:
pre-commit run --files path/to/file1.nf path/to/file2.configProblem: Test fails with "Process exceeded memory limit"
Solution: Ensure you're using the test profile with resource limits:
nextflow run . -profile test,docker --outdir resultsThe test profile sets process.memory = 6.GB and process.cpus = 2 for CI compatibility.
Problem: Snapshot test fails after intentional output changes
Solution: Update snapshots:
nf-test test --profile debug,test,docker --update-snapshotThen commit the updated .snap files.
Problem: Container not found / pulling issues
Solution:
- Check internet connection
- Use alternative container engine:
nextflow run . -profile test,singularity --outdir results - For Wave-enabled containers, add
waveprofile:nextflow run . -profile test,docker,wave --outdir results
Problem: Test data not accessible
Solution: Test data is hosted on GitHub. Ensure:
- Internet connectivity
- No firewall blocking GitHub raw content
- Try with
-resumeto use cached data
Problem: "Nextflow version is too old"
Solution: Update Nextflow:
nextflow self-update
# Or install specific version
export NXF_VER=25.04.0
nextflow -versionProblem: "Process terminated with exit code 137"
Solution: Out of memory. Either:
- Use test profile:
-profile test,docker - Increase Docker memory limit in Docker Desktop settings
- Reduce
params.max_memoryin config
Problem: "Error executing process > WORKFLOW:SUBWORKFLOW:PROCESS"
Solution:
- Check
.nextflow.logfor details:tail -100 .nextflow.log
- Check work directory for process error:
cat work/<hash>/.command.err cat work/<hash>/.command.log
- Rerun with more verbose output:
nextflow run . -profile debug,test,docker --outdir results
Problem: "Unknown parameter"
Solution:
- Check if parameter is in
nextflow.config - Update schema:
nf-core pipelines schema build
- Validate against schema:
nf-core pipelines schema validate params.json
Problem: Schema build fails / JSON validation error
Solution:
- Check
nextflow_schema.jsonsyntax:cat nextflow_schema.json | jq .
- If corrupted, restore from git:
git checkout nextflow_schema.json nf-core pipelines schema build
Problem: CI tests pass locally but fail in GitHub Actions
Solution: Common causes:
- Resource limits: CI has stricter limits (2 CPU, 6 GB RAM)
- Test profile: Ensure using
testprofile in CI config - Container differences: CI uses different architecture (amd64)
- Timeouts: CI has time limits, may need to optimize slow processes
Problem: Lint check fails in CI but passes locally
Solution:
- Ensure using same nf-core version:
# Check version in .nf-core.yml pip install nf-core==<version>
- Run lint with same flags as CI:
nf-core pipelines lint # For master PRs: nf-core pipelines lint --release
Problem: @nf-core-bot fix linting doesn't work
Solution:
- Check bot has write permissions to your fork
- Ensure PR is from a branch (not fork's master)
- Manually run and commit:
pre-commit run --all-files git add . git commit -m "style: apply pre-commit fixes" git push
Problem: "Module not found" error
Solution:
- Check
modules.jsonfor module entry - Install module:
nf-core modules install <module_name>
- For local modules, verify path in
modules/local/
Problem: Module config not applied
Solution: Check conf/modules/modules.config:
- Use correct selector:
withName: 'EXACT_PROCESS_NAME' - Process names are case-sensitive
- For subworkflow processes:
withName: '.*:SUBWORKFLOW:PROCESS'
- Always check
.nextflow.log- Contains detailed error info - Inspect work directory - Failed process outputs in
work/<hash>/ - Use
-resume- Saves time by using cached results - Enable debug profile - More verbose logging:
-profile debug - Check resource usage - View
pipeline_info/execution_report.html - Test incrementally - Test small changes before big refactors
- Use nf-test - Unit test individual processes/subworkflows
- Pipeline Documentation: https://quantms.readthedocs.io/
- nf-core Guidelines: https://nf-co.re/docs/guidelines
- Nextflow Documentation: https://www.nextflow.io/docs/latest/
- nf-test Documentation: https://code.askimed.com/nf-test/
- GitHub Discussions: https://github.com/bigbio/quantms/discussions
- Issues: https://github.com/bigbio/quantms/issues
# Pre-commit (MANDATORY before commit)
pre-commit run --all-files
# Lint pipeline
nf-core pipelines lint
# Update schema
nf-core pipelines schema build
# Run LFQ test
nextflow run . -profile test_lfq,docker --outdir results
# Run TMT test
nextflow run . -profile test_tmt,docker --outdir results
# Run DIA test
nextflow run . -profile test_dia,docker --outdir results
# Run nf-test suite
nf-test test --profile debug,test,docker --verbose
# Update snapshots
nf-test test --profile debug,test,docker --update-snapshot
# Resume pipeline
nextflow run . -profile test,docker --outdir results -resume
# Clean work directory
nextflow clean -f- Main config:
nextflow.config - Schema:
nextflow_schema.json - Pre-commit config:
.pre-commit-config.yaml - nf-test config:
nf-test.config - Test configs:
conf/tests/*.config - Module configs:
conf/modules/modules.config - Base resources:
conf/base.config - Main workflow:
workflows/quantms.nf - Entry point:
main.nf
Last Updated: January 14, 2026 Pipeline Version: 1.8.0dev Minimum Nextflow: 25.04.0