How pmbb-informatics-and-genomics/pmbb-nf-toolkit-phenotyping works
This is a modular Nextflow DSL2 toolkit that converts biobank phenotype configuration and source tables into per-phenotype outputs, with optional gathering, event-window masking, pregnancy filtering, and risk classification. The principal workflow resolves inherited YAML settings into per-phenotype JSON, preprocesses inputs into long-format TSVs, dispatches them to type-specific phenotype encoders, and optionally gathers results. The graph also shows the documented mask and risk branches. Some wiring is based on README topology; unsampled module internals are not inferred.
Main entry points: preprocess.py Preprocess tables · main.nf Nextflow workflow · event_mask.py Event mask windows · advanced_coded.py Advanced coded
Components 21
Pipeline orchestration
- Nextflow workflow
main.nf - Config resolver
bin/resolve_config.py - Phenotype JSON configs
Input preparation
- Preprocess tables
bin/preprocess.py - Long-format TSVs
- Pregnancy filter
modules/pregnancy_filter/main.nf - Event mask windows
bin/event_mask.py - Mask intervals
- Apply mask
bin/apply_mask.py
Phenotype processing
- Basic coded
bin/basic_coded.py - Advanced coded
bin/advanced_coded.py - Quantitative encoding
bin/basic_quantitative.py - Categorical encoding
bin/basic_categorical.py - Code matching utilities
bin/icd_utils.py
Outputs and analysis
- Per-phenotype TSVs
- Phenotype manifest
bin/phenotype_manifest.py - Gather tables
bin/gather.py - Gathered phenotype table
- Risk classification
bin/risk_classification.py - Risk matrix and report
Other components
- Biobank analyst
Connections 27
- Biobank analyst → Nextflow workflow: runs pipeline
README.md - Nextflow workflow → Config resolver: resolves config
README.md - Config resolver → Phenotype JSON configs: writes configs
README.md - Nextflow workflow → Preprocess tables: dispatches jobs
README.md - Phenotype JSON configs → Preprocess tables: configures jobs
README.md - Preprocess tables → Long-format TSVs: writes long TSVs
README.md - Long-format TSVs → Pregnancy filter: filters opted data
- Long-format TSVs → Event mask windows: supplies event codes
README.md - Event mask windows → Mask intervals: computes windows
README.md - Mask intervals → Apply mask: filters by windows
README.md - Long-format TSVs → Apply mask: supplies phenotype rows
README.md - Preprocess tables → Basic coded: fans out codes
README.md - Preprocess tables → Advanced coded: fans out coded data
README.md - Preprocess tables → Quantitative encoding: fans out quantitative
README.md - Preprocess tables → Categorical encoding: fans out categorical
README.md - Advanced coded → Code matching utilities: matches patterns
bin/advanced_coded.py - Event mask windows → Code matching utilities: matches codes
bin/event_mask.py - Basic coded → Per-phenotype TSVs: writes phenotype TSVs
README.md - Advanced coded → Per-phenotype TSVs: writes phenotype TSVs
README.md - Quantitative encoding → Per-phenotype TSVs: writes phenotype TSVs
README.md - Categorical encoding → Per-phenotype TSVs: writes phenotype TSVs
README.md - Per-phenotype TSVs → Phenotype manifest: indexes output columns
README.md - Per-phenotype TSVs → Gather tables: joins phenotype TSVs
README.md - Gather tables → Gathered phenotype table: writes wide table
README.md - Gathered phenotype table → Risk classification: provides wide input
README.md - Phenotype JSON configs → Risk classification: provides risk rules
README.md - Risk classification → Risk matrix and report: writes risk results
README.md