[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CW21NSZMCPMF7D9CHJM718":3,"skill-same:01M7CW21NSZMCPMF7D9CHJM718":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7CW21NSZMCPMF7D9CHJM718","bio-metabolomics-normalization-qc",null,"Designs QC, corrects signal drift, removes batch effects, filters features, normalizes samples, and imputes missing values for untargeted LC-MS\u002FGC-MS metabolomics, framing each step as a measurement model that can create or erase biological signal. Use when processing a peak\u002Ffeature table before statistical analysis, choosing a drift-correction or sample-normalization method, deciding QC RSD vs D-ratio filtering, or handling left-censored missing values. The feature table is produced by metabolomics\u002Fxcms-preprocessing or metabolomics\u002Fmsdial-preprocessing; transformation\u002Fscaling for modeling defers to metabolomics\u002Fstatistical-analysis; cross-study design issues link to experimental-design\u002Fbatch-design.","mrsonord2240\u002Fopenscience-specialists","mrsonord2240","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F76487430?v=4","01M7CTEM40S43GSJZ9A3YCCXZK","Samuel Nord","01M7CTEM4K69JD1GBYNHVJ9ZP4",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bio-metabolomics-normalization-qc\ndescription: Designs QC, corrects signal drift, removes batch effects, filters features, normalizes samples, and imputes missing values for untargeted LC-MS\u002FGC-MS metabolomics, framing each step as a measurement model that can create or erase biological signal. Use when processing a peak\u002Ffeature table before statistical analysis, choosing a drift-correction or sample-normalization method, deciding QC RSD vs D-ratio filtering, or handling left-censored missing values. The feature table is produced by metabolomics\u002Fxcms-preprocessing or metabolomics\u002Fmsdial-preprocessing; transformation\u002Fscaling for modeling defers to metabolomics\u002Fstatistical-analysis; cross-study design issues link to experimental-design\u002Fbatch-design.\ntool_type: r\nprimary_tool: pmp\n---\n\n## Version Compatibility\n\nReference examples tested with: pmp 1.14+, statTarget 1.30+, imputeLCMD 2.1+, missForest 1.5+, sva 3.50+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nValid drift correction requires QC injections that bracket the samples at both ends and sample the drift curve (~1 QC every 5-10 injections); conditioning injections must be excluded. Valid batch correction requires biological groups randomized across batches; a confounded design cannot be rescued by any algorithm.\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\n# Metabolomics Normalization and QC\n\n**\"Normalize my metabolomics data and correct for batch effects\"** -> Filter junk features by QC quality, correct within-batch drift against injection order, normalize per-sample dilution, and impute by missingness mechanism -- each step verified against held-out QCs, not just QC clustering.\n- R drift correction: `QCRSC()` (pmp), `shiftCor()` (statTarget)\n- R normalization: `pqn_normalisation()` (pmp)\n- R imputation: `mv_imputation()` (pmp), `impute.QRILC()` (imputeLCMD), `missForest()` (missForest)\n\n## The Single Most Important Insight -- Normalization Is a Modeling Decision, Not a Cleanup Step\n\nEvery preprocessing step imposes an assumption about where the *unwanted* variance lives; if that assumption is wrong the result is not noisier, it is confidently wrong. Three corollaries reorganize the whole skill. (1) QC-based correction assumes the pooled QC's per-feature drift trajectory *is* the samples' trajectory -- false for subgroup-specific features (the pool dilutes them toward absence) and for features at different abundance in samples vs pool (suppression is concentration-dependent), so correcting them extrapolates from noise. (2) The order\u002Fbatch\u002Fbiology confound is information-theoretically unwinnable post hoc: if group is collinear with batch or injection order, no estimator can attribute the shared variance to one source -- it only redistributes it, wrongly. Randomization at the bench is the only real fix. (3) Over-correction is invisible to the metric everyone reports: \"QC RSD dropped \u002F QCs cluster tighter\" is exactly what a too-flexible model games (a cubic spline threading every QC drives QC RSD to ~0% while raising biological-sample RSD). Validate on held-out QCs and dilution-QC linearity, never on the metric the model optimized.\n\n## The Four Orthogonal Operations (Do Not Conflate)\n\n| Operation | Acts on | Removes | Methods |\n|---|---|---|---|\n| Drift \u002F signal correction | each feature, within a batch, vs injection order | longitudinal intensity decay\u002Frise (column fouling, sensitivity loss) | QC-RLSC (LOESS), QCRSC (spline), QC-RFSC (RF vs order), SERRF (RF across correlated features) |\n| Batch correction | each feature, across batches | step-changes between analytical batches | QC-anchored median\u002Freference alignment; ComBat (reserved, dangerous) |\n| Sample normalization | each sample (column) | dilution \u002F total-amount differences | PQN, MSTUS, TIC\u002Fsum, median, internal standard |\n| Transformation \u002F scaling | each feature (row) | mean-variance dependence; range dominance | log\u002Fglog; Pareto\u002Fauto -> defers to metabolomics\u002Fstatistical-analysis |\n\nTIC normalization does not handle drift, and -- because of closure -- can spread one feature's change across all others. Keep the axes separate.\n\n## Pipeline Order (and Why Order Matters)\n\n| # | Step | Why here | Tool |\n|---|---|---|---|\n| 0 | Exclude conditioning injections | Pre-equilibrium signal warps a LOESS edge and corrupts RSD\u002Fblank filters | manual (drop first ~8 QC) |\n| 1 | Blank filter -> detection-rate filter | Removes background\u002Fcontaminant and mostly-absent features before any model trains on them | `filter_peaks_by_blank`, `filter_peaks_by_fraction` (pmp) |\n| 2 | Within-batch drift correction | Flattens order-dependent trend per feature before cross-sample comparison | `QCRSC` (pmp), `shiftCor` (statTarget) |\n| 3 | QC RSD \u002F D-ratio filter | Drift correction *should* improve RSD; filter after so reproducibility reflects corrected data (report both stages) | `filter_peaks_by_rsd` (pmp), `dratio_filter` (structToolbox) |\n| 4 | Between-batch alignment | QC-anchored offsets removed after within-batch drift is flat | median-of-QC \u002F batchCorr |\n| 5 | Missing-value imputation | Filter aggressively first, then impute only the sparse residual holes by mechanism | `mv_imputation` (pmp), `impute.QRILC`, `missForest` |\n| 5a | -- QRILC's own log2\u002F2^x round-trip | `impute.QRILC` requires log-scale input; this is local to the call, not a promotion of step 7 | see Impute section below |\n| 6 | Sample normalization | Dilution correction on quality features, after junk removed | `pqn_normalisation` (pmp) |\n| 7 | Transformation + scaling | Defers to metabolomics\u002Fstatistical-analysis | `glog_transformation` (pmp) |\n\nDetection-rate filtering must precede imputation: never impute a feature that is 90% missing, which would fabricate 90% of it.\n\n## Decision Tree -- Sample Normalization by Matrix\n\n| Matrix \u002F situation | Use | Why |\n|---|---|---|\n| Urine \u002F variable-dilution biofluid | PQN or MSTUS (osmolality\u002FSG if measured) | Dilution varies wildly; PQN's median-quotient isolates the common dilution factor; MSTUS excludes drug\u002Fdiet xenobiotics that corrupt TIC |\n| Plasma \u002F serum | PQN or median (TIC only if no dominant peak) | Volume relatively constant; closure risk lower but still present |\n| Tissue \u002F cells | Per measured amount (mass, protein, cell count) at the bench | The confounder (input amount) is known -- more honest than any data-driven post-hoc method |\n| Targeted \u002F few analytes | Per-class internal standards | One IS cannot represent all chemical classes\u002FRT regions |\n| Global profile genuinely differs between groups | Avoid quantile normalization | It forces all samples to one distribution, erasing real distributional biology |\n| Creatinine for urine | Avoid as sole method | Fails under renal impairment \u002F muscle-mass differences (Warrack 2009) |\n\nWhen >50% of features move coherently (potent drug, gross pathology), the PQN median-quotient measures the biology, not dilution, and subtracts it out -- switch to a measured external quantity and check whether the normalization factor correlates with the phenotype.\n\n## Decision Tree -- Drift Correction Method\n\n| Situation | Do | Why |\n|---|---|---|\n| Smooth monotonic drift, frequent QCs, small\u002Fmedium study | QCRSC (spline) or QC-RLSC | Per-feature fit vs order; CV-select span to avoid overfit |\n| Non-smooth \u002F multi-pattern drift within a batch | QC-RFSC (statTarget) or batchCorr clusters | RF \u002F cluster-based captures non-monotonic trend |\n| Large cohort (>~500), complex multi-source error, want lowest RSD | SERRF | Borrows strength across correlated features (~5% RSD on >800-sample cohorts, Fan 2019) |\n| Sparse QCs (\u003C5-6 spanning the batch) | Coarse median-of-QC offset or no within-batch correction | LOESS\u002Fspline with too few QCs produces gaps\u002Fgarbage |\n| Feature weak\u002Fabsent in QCs | Exclude from correction | Correcting it extrapolates from noise |\n| No detectable drift in a feature | Do not correct it | Correcting a flat QC trajectory only adds the model's wiggle |\n| Run order confounded with biology | Do not drift-correct; fix design or caveat | A smooth function of order absorbs and subtracts the biological trend |\n\nFlexible ML methods (SERRF\u002FRF\u002Fadversarial) win on large complex cohorts but are *more* prone to learning-and-removing biology that tracks order\u002Fbatch. Always confirm QC RSD dropped AND biological-sample RSD did not rise.\n\n## Filter Features by QC Quality (RSD and D-ratio)\n\n**Goal:** Keep only reproducible features whose technical variance is small relative to biological variance.\n\n**Approach:** Compute per-feature QC RSD and the robust D-ratio (technical SD \u002F biological SD), then apply a boolean mask. Lead with D-ratio: CV alone is matrix-blind, scoring a precisely-measured-but-flat feature as good and a noisy-but-biologically-huge feature as bad.\n\n```r\nlibrary(matrixStats)\n\nrobust_dratio_filter \u003C- function(data, is_qc, dratio_max = 0.5, rsd_max = 0.3) {\n    qc \u003C- as.matrix(data[is_qc, ])\n    bio \u003C- as.matrix(data[!is_qc, ])\n    # MAD-based (robust) form, because MS intensities are right-skewed\n    sd_qc \u003C- colMads(qc, na.rm = TRUE)\n    sd_bio \u003C- colMads(bio, na.rm = TRUE)\n    dratio \u003C- sd_qc \u002F sd_bio\n    rsd \u003C- colSds(qc, na.rm = TRUE) \u002F colMeans(qc, na.rm = TRUE)\n    keep \u003C- dratio \u003C= dratio_max & rsd \u003C= rsd_max\n    keep[is.na(keep)] \u003C- FALSE\n    message(sprintf('D-ratio\u003C=%.2f & RSD\u003C=%.0f%%: kept %d \u002F %d features',\n                    dratio_max, rsd_max * 100, sum(keep), ncol(data)))\n    data[, keep]\n}\n```\n\n## Correct Within-Batch Drift (QC-RSC)\n\n**Goal:** Flatten per-feature, injection-order-dependent signal drift using the QC trajectory.\n\n**Approach:** Fit a QC-robust smoothing spline of intensity vs injection order per feature, interpolate at every sample position, and divide. pmp's `QCRSC` selects the spline smoothing by leave-one-out CV when `spar=0`, requires `minQC` QCs per batch, and excludes features too weak in QC automatically.\n\n```r\nlibrary(pmp)\n\n# df: features in ROWS, samples in COLUMNS (pmp convention)\ncorrected \u003C- QCRSC(df = feature_matrix, order = injection_order, batch = batch_id,\n                   classes = sample_class, spar = 0, log = TRUE,\n                   minQC = 5, qc_label = 'QC')\n# Verify correction worked on HELD-OUT QCs \u002F dilution linearity, not on QC clustering.\n# QCRSC does not error or warn when a batch has fewer QCs than `minQC` -- it silently returns\n# that batch's features as all-NA. Check immediately, per batch, before trusting the output:\nout_mat \u003C- if (methods::is(corrected, 'SummarizedExperiment')) SummarizedExperiment::assay(corrected) else corrected\nstopifnot(any(rowSums(!is.na(out_mat)) > 0))  # fails loudly if every feature came back NA\n```\n\nstatTarget alternative (`MLmethod='QCRFSC'` for RF, `'QCRLSC'` for LOESS; `QCspan=0` auto-GCV span applies to QCRLSC; inputs are two order-aligned CSVs):\n\n```r\nlibrary(statTarget)\nshiftCor(samPeno = 'meta.csv', samFile = 'peaks.csv', Frule = 0.8,\n         MLmethod = 'QCRFSC', ntree = 500, QCspan = 0, degree = 2,\n         imputeM = 'KNN', coCV = 30, plot = FALSE)\n```\n\n## Normalize Per-Sample Dilution (PQN)\n\n**Goal:** Remove per-sample global intensity differences (dilution, extraction efficiency) without subtracting genuine fold changes.\n\n**Approach:** Build a reference spectrum (median of QCs), compute per-feature sample\u002Freference quotients, take the median quotient as the dilution factor, and divide. The median is robust because it ignores the minority of genuinely-changed features.\n\n```r\nlibrary(pmp)\n# df: features in ROWS, samples in COLUMNS; reference built from QC samples\nnormalized \u003C- pqn_normalisation(df = feature_matrix, classes = sample_class,\n                                qc_label = 'QC')\n\n# Per-sample factor for the phenotype-correlation guardrail below: pqn_normalisation() does not\n# return it as a visible top-level result, but it computes and stores it. For a plain-matrix `df`\n# (as above), it lands in the flags attribute; for a SummarizedExperiment `df`, use colData()\n# instead. Verified: `normalized * pqn_factor == feature_matrix` to floating-point precision.\npqn_factor \u003C- attr(normalized, 'flags')[, 'pqn_coef']         # plain matrix input\n# pqn_factor \u003C- SummarizedExperiment::colData(normalized)$pqn_coef   # SummarizedExperiment input\n```\n\n## Impute by Missingness Mechanism\n\n**Goal:** Fill residual sparse holes with the method matched to *why* the value is missing.\n\n**Approach:** Diagnose the mechanism per feature -- missingness correlated with low abundance is MNAR (left-censored) and needs QRILC\u002FGSimp; sporadic missingness across the abundance range is MAR and needs RF\u002FkNN. Using a MAR method on MNAR zeros pulls the censored group's mean up and erases the on\u002Foff signal.\n\n```r\nlibrary(imputeLCMD)\nlibrary(missForest)\n\n# MNAR \u002F left-censored: impute.QRILC fits an unbounded truncated-normal and is only valid on\n# log-scale intensities -- called on raw intensities it silently draws NEGATIVE values (impossible\n# for a peak intensity). Always log2-transform immediately before the call and back-transform (2^x)\n# immediately after, even though the pipeline's own log\u002Fglog scaling step (#7) comes later --\n# this round-trip is local to QRILC and leaves the matrix on its original scale for step 6\u002F7.\nlog_mat \u003C- log2(feature_matrix_features_in_rows)\nqrilc_imputed \u003C- 2^(impute.QRILC(log_mat, tune.sigma = 1)[[1]])\n\n# MAR \u002F sporadic: iterative random-forest prediction (samples in ROWS, features in COLS)\nrf_imputed \u003C- missForest(sample_by_feature_matrix, maxiter = 10, ntree = 100)$ximp\n```\n\nHalf-min imputation collapses the imputed subset's variance to zero, understating SE and inflating false significance -- prefer QRILC\u002FGSimp, which draw a distribution of plausible low values. Re-run key results under >=2 imputation methods; if headline metabolites flip, the finding lives in the imputation.\n\n**Verify after every QRILC call:** `stopifnot(min(qrilc_imputed, na.rm = TRUE) >= 0)`. If this fails, the log2\u002F2^x round-trip above was skipped or a non-QRILC path fed it raw intensities.\n\n## Per-Method Failure Modes\n\n### QC-spline \u002F LOESS over-correction\n- **Trigger:** Span too small, too few QCs, or a cubic spline using each QC as a lock-point.\n- **Mechanism:** The fit threads the QCs perfectly, modeling inter-QC noise as drift and injecting it into samples.\n- **Symptom:** QC RSD drops toward 0% while biological-sample RSD rises and the number of significant features explodes.\n- **Fix:** CV-select the span, validate on held-out QCs and dilution-QC linearity, compare biological-sample RSD before\u002Fafter, not just QC RSD.\n\n### Edge extrapolation\n- **Trigger:** Samples injected before the first QC or after the last QC.\n- **Mechanism:** LOESS\u002Fspline interpolate between QCs but extrapolate beyond them, producing unstable correction factors.\n- **Fix:** Bracket samples with QCs at both ends; exclude conditioning injections.\n\n### TIC closure artifact\n- **Trigger:** One dominant or up-regulated feature under TIC\u002Fsum normalization.\n- **Mechanism:** The constant-sum constraint forces every other feature's normalized value down, manufacturing apparent coordinated down-regulation (Aitchison closure; spurious negative correlations).\n- **Fix:** Use PQN\u002FMSTUS or log-ratios; if \"many features moved together,\" suspect closure from one big mover before believing coordination.\n\n### ComBat under imbalance\n- **Trigger:** Biological groups unbalanced across batches. Risk scales with the *degree* of association, not just its presence -- report a chi-square test or Cramer's V on the batch x group table before deciding how worried to be. Near-total confounding (one group dominates a batch) is the regime Nygaard 2016 demonstrates; mild imbalance (e.g. 85\u002F15 vs 50\u002F50 across batches, not perfectly separated) did not reproduce the same false-positive inflation in a spot-check and can look deceptively safe -- absence of the effect at mild imbalance is not evidence it is absent at severe imbalance.\n- **Mechanism:** Empirical-Bayes shrinkage confounds class with batch; under near-total confounding it can fabricate thousands of false differences or, without the covariate, delete real ones (Nygaard 2016).\n- **Fix:** Prefer QC-anchored between-batch alignment (the pool has no group, so it cannot confound). Reserve ComBat for balanced designs and always pass the biological covariate via `mod=`. Randomize so it is never needed.\n\n### Wrong imputation mechanism\n- **Trigger:** kNN\u002FRF applied to below-LOD (MNAR) values.\n- **Mechanism:** MAR methods borrow abundance from detected samples, pulling the censored group's mean up and shrinking the very difference under test.\n- **Fix:** Diagnose mechanism per feature; QRILC\u002FGSimp for left-censored, RF\u002FkNN only for sporadic MAR.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|---|---|---|\n| QC RSD \u003C= 20-30% (15% gold) | Dunn 2011; Broadhurst 2018 | Reproducibility floor in the matrix-matched pool; 20% aspirational for LC-MS, 30% common |\n| D-ratio \u003C= 0.5 (0.2 excellent), robust\u002FMAD form | Broadhurst 2018 | Technical SD \u003C biological SD -- the honest, matrix-aware filter; MAD form because MS intensities are right-skewed |\n| Blank ratio >= 3-5x | community convention (Dunn lineage) | Features below 3-5x blank are dominated by background\u002Fcarryover, not biology |\n| Detection rate >= 50-80% (or 80% within any one group) | statTarget Frule=0.8; pmp filter_peaks_by_fraction | Reliable signal; \"within any group\" preserves on\u002Foff group-specific metabolites |\n| Dilution-QC correlation r >= 0.7-0.8 | community convention | Real metabolites scale with dilution; artefacts\u002Fin-source ions do not |\n| QCs >= 5-10% of injections, ~1 every 5-10 samples | Broadhurst 2018; mQACC 2022 | Must sample the drift curve densely enough to avoid LOESS extrapolation |\n\nThresholds are conventions, not laws: choose them a priori, report each one, and report how many features each filter removed (mQACC reporting standard).\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|---|---|---|\n| `could not find function \"statTarget\"` | No such entry point | Use `shiftCor()` (drift correction) and `statAnalysis()` (post-hoc stats) |\n| `mv_imputation` errors on `method='sm'` | Small-value method is `'sv'`, not `'sm'` | Use `method='sv'` (also valid: `knn`, `rf`, `bpca`, `mn`, `md`) |\n| QRILC output is malformed | `impute.QRILC` returns a list, not a matrix; expects features in rows | Index `[[1]]`; transpose so features are rows |\n| QRILC imputed values are negative | Called on raw (non-log) intensities -- QRILC's truncated-normal model is only valid on log-scale data | `log2()` before the call, `2^x` back-transform after (see Impute section); assert `min(imputed) >= 0` |\n| `QCRSC` output is all-NA for a batch | QC count in that batch is below `minQC`; pmp silently returns NA instead of erroring | Check `rowSums(!is.na(result)) == 0` (features in rows, pmp convention) immediately after every `QCRSC` call; below-`minQC` batches need the coarse median-of-QC fallback, not `QCRSC` |\n| MetaboAnalystR `Normalization` errors | `SanityCheckData(mSet)` not run first | Call `SanityCheckData` -> `ReplaceMin` -> `Normalization` in order |\n| Correction made data worse | Span overfit \u002F weak-in-QC features corrected \u002F order confounded with biology | Back off span, exclude weak-in-QC features, check randomization |\n| Effect vanished after drift correction | Run order confounded with group; trend absorbed the biology | Check the design; report drift and effect as inseparable if confounded |\n\n## References\n\n- Dunn WB, Broadhurst D, Begley P, et al. 2011. Procedures for large-scale metabolic profiling of serum and plasma using gas chromatography and liquid chromatography coupled to mass spectrometry. *Nature Protocols* 6:1060-1083.\n- Broadhurst D, Goodacre R, Reinke SN, et al. 2018. Guidelines and considerations for the use of system suitability and quality control samples in mass spectrometry assays applied in untargeted clinical metabolomic studies. *Metabolomics* 14:72.\n- Dieterle F, Ross A, Schlotterbeck G, Senn H. 2006. Probabilistic Quotient Normalization as Robust Method to Account for Dilution of Complex Biological Mixtures. Application in 1H NMR Metabonomics. *Analytical Chemistry* 78:4281-4290.\n- Fan S, Kind T, Cajka T, et al. 2019. Systematic Error Removal Using Random Forest for Normalizing Large-Scale Untargeted Lipidomics Data. *Analytical Chemistry* 91:3590-3596.\n- Brunius C, Shi L, Landberg R. 2016. Large-scale untargeted LC-MS metabolomics data correction using between-batch feature alignment and cluster-based within-batch signal intensity drift correction. *Metabolomics* 12:173.\n- Luan H, Ji F, Chen Y, Cai Z. 2018. statTarget: A streamlined tool for signal drift correction and interpretations of quantitative mass spectrometry-based omics data. *Analytica Chimica Acta* 1036:66-72.\n- Wei R, Wang J, Su M, et al. 2018. Missing Value Imputation Approach for Mass Spectrometry-based Metabolomics Data. *Scientific Reports* 8:663.\n- Wei R, Wang J, Jia E, et al. 2018. GSimp: A Gibbs sampler based left-censored missing value imputation approach for metabolomics studies. *PLoS Computational Biology* 14:e1005973.\n- Stekhoven DJ, Buhlmann P. 2012. MissForest -- non-parametric missing value imputation for mixed-type data. *Bioinformatics* 28:112-118.\n- Nygaard V, Rodland EA, Hovig E. 2016. Methods that remove batch effects while retaining group differences may lead to exaggerated confidence in downstream analyses. *Biostatistics* 17:29-39.\n- van den Berg RA, Hoefsloot HCJ, Westerhuis JA, et al. 2006. Centering, scaling, and transformations: improving the biological information content of metabolomics data. *BMC Genomics* 7:142.\n- Warrack BM, Hnatyshyn S, Ott KH, et al. 2009. Normalization strategies for metabonomic analysis of urine samples. *Journal of Chromatography B* 877:547-552.\n- Thonusin C, IglayReger HB, Soni T, et al. 2017. Evaluation of intensity drift correction strategies using MetaboDrift, a normalization tool for multi-batch metabolomics data. *Journal of Chromatography A* 1523:265-274.\n- Chamberlain CA, Rubio VY, Garrett TJ. 2019. Impact of matrix effects and ionization efficiency in non-quantitative untargeted metabolomics. *Metabolomics* 15:135.\n- Wehrens R, Hageman JA, van Eeuwijk F, et al. 2016. Improved batch correction in untargeted MS-based metabolomics. *Metabolomics* 12:88.\n\n## Related Skills\n\n- metabolomics\u002Fxcms-preprocessing - Generates the feature table this skill consumes\n- metabolomics\u002Fmsdial-preprocessing - Alternative feature-table source\n- metabolomics\u002Fstatistical-analysis - Transformation\u002Fscaling and downstream multivariate stats\n- experimental-design\u002Fbatch-design - Randomization and design that make correction valid\n- differential-expression\u002Fbatch-correction - ComBat\u002FSVA mechanics shared with transcriptomics\n","## Version Compatibility\n\nReference examples tested with: pmp 1.14+, statTarget 1.30+, imputeLCMD 2.1+, missForest 1.5+, sva 3.50+\n\nBefore using code patterns, verify installed versions match. If versions differ:\n- R: `packageVersion('\u003Cpkg>')` then `?function_name` to verify parameters\n\nValid drift correction requires QC injections that bracket the samples at both ends and sample the drift curve (~1 QC every 5-10 injections); conditioning injections must be excluded. Valid batch correction requires biological groups randomized across batches; a confounded design cannot be rescued by any algorithm.\n\nIf code throws ImportError, AttributeError, or TypeError, introspect the installed\npackage and adapt the example to match the actual API rather than retrying.\n\n# Metabolomics Normalization and QC\n\n**\"Normalize my metabolomics data and correct for batch effects\"** -> Filter junk features by QC quality, correct within-batch drift against injection order, normalize per-sample dilution, and impute by missingness mechanism -- each step verified against held-out QCs, not just QC clustering.\n- R drift correction: `QCRSC()` (pmp), `shiftCor()` (statTarget)\n- R normalization: `pqn_normalisation()` (pmp)\n- R imputation: `mv_imputation()` (pmp), `impute.QRILC()` (imputeLCMD), `missForest()` (missForest)\n\n## The Single Most Important Insight -- Normalization Is a Modeling Decision, Not a Cleanup Step\n\nEvery preprocessing step imposes an assumption about where the *unwanted* variance lives; if that assumption is wrong the result is not noisier, it is confidently wrong. Three corollaries reorganize the whole skill. (1) QC-based correction assumes the pooled QC's per-feature drift trajectory *is* the samples' trajectory -- false for subgroup-specific features (the pool dilutes them toward absence) and for features at different abundance in samples vs pool (suppression is concentration-dependent), so correcting them extrapolates from noise. (2) The order\u002Fbatch\u002Fbiology confound is information-theoretically unwinnable post hoc: if group is collinear with batch or injection order, no estimator can attribute the shared variance to one source -- it only redistributes it, wrongly. Randomization at the bench is the only real fix. (3) Over-correction is invisible to the metric everyone reports: \"QC RSD dropped \u002F QCs cluster tighter\" is exactly what a too-flexible model games (a cubic spline threading every QC drives QC RSD to ~0% while raising biological-sample RSD). Validate on held-out QCs and dilution-QC linearity, never on the metric the model optimized.\n\n## The Four Orthogonal Operations (Do Not Conflate)\n\n| Operation | Acts on | Removes | Methods |\n|---|---|---|---|\n| Drift \u002F signal correction | each feature, within a batch, vs injection order | longitudinal intensity decay\u002Frise (column fouling, sensitivity loss) | QC-RLSC (LOESS), QCRSC (spline), QC-RFSC (RF vs order), SERRF (RF across correlated features) |\n| Batch correction | each feature, across batches | step-changes between analytical batches | QC-anchored median\u002Freference alignment; ComBat (reserved, dangerous) |\n| Sample normalization | each sample (column) | dilution \u002F total-amount differences | PQN, MSTUS, TIC\u002Fsum, median, internal standard |\n| Transformation \u002F scaling | each feature (row) | mean-variance dependence; range dominance | log\u002Fglog; Pareto\u002Fauto -> defers to metabolomics\u002Fstatistical-analysis |\n\nTIC normalization does not handle drift, and -- because of closure -- can spread one feature's change across all others. Keep the axes separate.\n\n## Pipeline Order (and Why Order Matters)\n\n| # | Step | Why here | Tool |\n|---|---|---|---|\n| 0 | Exclude conditioning injections | Pre-equilibrium signal warps a LOESS edge and corrupts RSD\u002Fblank filters | manual (drop first ~8 QC) |\n| 1 | Blank filter -> detection-rate filter | Removes background\u002Fcontaminant and mostly-absent features before any model trains on them | `filter_peaks_by_blank`, `filter_peaks_by_fraction` (pmp) |\n| 2 | Within-batch drift correction | Flattens order-dependent trend per feature before cross-sample comparison | `QCRSC` (pmp), `shiftCor` (statTarget) |\n| 3 | QC RSD \u002F D-ratio filter | Drift correction *should* improve RSD; filter after so reproducibility reflects corrected data (report both stages) | `filter_peaks_by_rsd` (pmp), `dratio_filter` (structToolbox) |\n| 4 | Between-batch alignment | QC-anchored offsets removed after within-batch drift is flat | median-of-QC \u002F batchCorr |\n| 5 | Missing-value imputation | Filter aggressively first, then impute only the sparse residual holes by mechanism | `mv_imputation` (pmp), `impute.QRILC`, `missForest` |\n| 5a | -- QRILC's own log2\u002F2^x round-trip | `impute.QRILC` requires log-scale input; this is local to the call, not a promotion of step 7 | see Impute section below |\n| 6 | Sample normalization | Dilution correction on quality features, after junk removed | `pqn_normalisation` (pmp) |\n| 7 | Transformation + scaling | Defers to metabolomics\u002Fstatistical-analysis | `glog_transformation` (pmp) |\n\nDetection-rate filtering must precede imputation: never impute a feature that is 90% missing, which would fabricate 90% of it.\n\n## Decision Tree -- Sample Normalization by Matrix\n\n| Matrix \u002F situation | Use | Why |\n|---|---|---|\n| Urine \u002F variable-dilution biofluid | PQN or MSTUS (osmolality\u002FSG if measured) | Dilution varies wildly; PQN's median-quotient isolates the common dilution factor; MSTUS excludes drug\u002Fdiet xenobiotics that corrupt TIC |\n| Plasma \u002F serum | PQN or median (TIC only if no dominant peak) | Volume relatively constant; closure risk lower but still present |\n| Tissue \u002F cells | Per measured amount (mass, protein, cell count) at the bench | The confounder (input amount) is known -- more honest than any data-driven post-hoc method |\n| Targeted \u002F few analytes | Per-class internal standards | One IS cannot represent all chemical classes\u002FRT regions |\n| Global profile genuinely differs between groups | Avoid quantile normalization | It forces all samples to one distribution, erasing real distributional biology |\n| Creatinine for urine | Avoid as sole method | Fails under renal impairment \u002F muscle-mass differences (Warrack 2009) |\n\nWhen >50% of features move coherently (potent drug, gross pathology), the PQN median-quotient measures the biology, not dilution, and subtracts it out -- switch to a measured external quantity and check whether the normalization factor correlates with the phenotype.\n\n## Decision Tree -- Drift Correction Method\n\n| Situation | Do | Why |\n|---|---|---|\n| Smooth monotonic drift, frequent QCs, small\u002Fmedium study | QCRSC (spline) or QC-RLSC | Per-feature fit vs order; CV-select span to avoid overfit |\n| Non-smooth \u002F multi-pattern drift within a batch | QC-RFSC (statTarget) or batchCorr clusters | RF \u002F cluster-based captures non-monotonic trend |\n| Large cohort (>~500), complex multi-source error, want lowest RSD | SERRF | Borrows strength across correlated features (~5% RSD on >800-sample cohorts, Fan 2019) |\n| Sparse QCs (\u003C5-6 spanning the batch) | Coarse median-of-QC offset or no within-batch correction | LOESS\u002Fspline with too few QCs produces gaps\u002Fgarbage |\n| Feature weak\u002Fabsent in QCs | Exclude from correction | Correcting it extrapolates from noise |\n| No detectable drift in a feature | Do not correct it | Correcting a flat QC trajectory only adds the model's wiggle |\n| Run order confounded with biology | Do not drift-correct; fix design or caveat | A smooth function of order absorbs and subtracts the biological trend |\n\nFlexible ML methods (SERRF\u002FRF\u002Fadversarial) win on large complex cohorts but are *more* prone to learning-and-removing biology that tracks order\u002Fbatch. Always confirm QC RSD dropped AND biological-sample RSD did not rise.\n\n## Filter Features by QC Quality (RSD and D-ratio)\n\n**Goal:** Keep only reproducible features whose technical variance is small relative to biological variance.\n\n**Approach:** Compute per-feature QC RSD and the robust D-ratio (technical SD \u002F biological SD), then apply a boolean mask. Lead with D-ratio: CV alone is matrix-blind, scoring a precisely-measured-but-flat feature as good and a noisy-but-biologically-huge feature as bad.\n\n```r\nlibrary(matrixStats)\n\nrobust_dratio_filter \u003C- function(data, is_qc, dratio_max = 0.5, rsd_max = 0.3) {\n    qc \u003C- as.matrix(data[is_qc, ])\n    bio \u003C- as.matrix(data[!is_qc, ])\n    # MAD-based (robust) form, because MS intensities are right-skewed\n    sd_qc \u003C- colMads(qc, na.rm = TRUE)\n    sd_bio \u003C- colMads(bio, na.rm = TRUE)\n    dratio \u003C- sd_qc \u002F sd_bio\n    rsd \u003C- colSds(qc, na.rm = TRUE) \u002F colMeans(qc, na.rm = TRUE)\n    keep \u003C- dratio \u003C= dratio_max & rsd \u003C= rsd_max\n    keep[is.na(keep)] \u003C- FALSE\n    message(sprintf('D-ratio\u003C=%.2f & RSD\u003C=%.0f%%: kept %d \u002F %d features',\n                    dratio_max, rsd_max * 100, sum(keep), ncol(data)))\n    data[, keep]\n}\n```\n\n## Correct Within-Batch Drift (QC-RSC)\n\n**Goal:** Flatten per-feature, injection-order-dependent signal drift using the QC trajectory.\n\n**Approach:** Fit a QC-robust smoothing spline of intensity vs injection order per feature, interpolate at every sample position, and divide. pmp's `QCRSC` selects the spline smoothing by leave-one-out CV when `spar=0`, requires `minQC` QCs per batch, and excludes features too weak in QC automatically.\n\n```r\nlibrary(pmp)\n\n# df: features in ROWS, samples in COLUMNS (pmp convention)\ncorrected \u003C- QCRSC(df = feature_matrix, order = injection_order, batch = batch_id,\n                   classes = sample_class, spar = 0, log = TRUE,\n                   minQC = 5, qc_label = 'QC')\n# Verify correction worked on HELD-OUT QCs \u002F dilution linearity, not on QC clustering.\n# QCRSC does not error or warn when a batch has fewer QCs than `minQC` -- it silently returns\n# that batch's features as all-NA. Check immediately, per batch, before trusting the output:\nout_mat \u003C- if (methods::is(corrected, 'SummarizedExperiment')) SummarizedExperiment::assay(corrected) else corrected\nstopifnot(any(rowSums(!is.na(out_mat)) > 0))  # fails loudly if every feature came back NA\n```\n\nstatTarget alternative (`MLmethod='QCRFSC'` for RF, `'QCRLSC'` for LOESS; `QCspan=0` auto-GCV span applies to QCRLSC; inputs are two order-aligned CSVs):\n\n```r\nlibrary(statTarget)\nshiftCor(samPeno = 'meta.csv', samFile = 'peaks.csv', Frule = 0.8,\n         MLmethod = 'QCRFSC', ntree = 500, QCspan = 0, degree = 2,\n         imputeM = 'KNN', coCV = 30, plot = FALSE)\n```\n\n## Normalize Per-Sample Dilution (PQN)\n\n**Goal:** Remove per-sample global intensity differences (dilution, extraction efficiency) without subtracting genuine fold changes.\n\n**Approach:** Build a reference spectrum (median of QCs), compute per-feature sample\u002Freference quotients, take the median quotient as the dilution factor, and divide. The median is robust because it ignores the minority of genuinely-changed features.\n\n```r\nlibrary(pmp)\n# df: features in ROWS, samples in COLUMNS; reference built from QC samples\nnormalized \u003C- pqn_normalisation(df = feature_matrix, classes = sample_class,\n                                qc_label = 'QC')\n\n# Per-sample factor for the phenotype-correlation guardrail below: pqn_normalisation() does not\n# return it as a visible top-level result, but it computes and stores it. For a plain-matrix `df`\n# (as above), it lands in the flags attribute; for a SummarizedExperiment `df`, use colData()\n# instead. Verified: `normalized * pqn_factor == feature_matrix` to floating-point precision.\npqn_factor \u003C- attr(normalized, 'flags')[, 'pqn_coef']         # plain matrix input\n# pqn_factor \u003C- SummarizedExperiment::colData(normalized)$pqn_coef   # SummarizedExperiment input\n```\n\n## Impute by Missingness Mechanism\n\n**Goal:** Fill residual sparse holes with the method matched to *why* the value is missing.\n\n**Approach:** Diagnose the mechanism per feature -- missingness correlated with low abundance is MNAR (left-censored) and needs QRILC\u002FGSimp; sporadic missingness across the abundance range is MAR and needs RF\u002FkNN. Using a MAR method on MNAR zeros pulls the censored group's mean up and erases the on\u002Foff signal.\n\n```r\nlibrary(imputeLCMD)\nlibrary(missForest)\n\n# MNAR \u002F left-censored: impute.QRILC fits an unbounded truncated-normal and is only valid on\n# log-scale intensities -- called on raw intensities it silently draws NEGATIVE values (impossible\n# for a peak intensity). Always log2-transform immediately before the call and back-transform (2^x)\n# immediately after, even though the pipeline's own log\u002Fglog scaling step (#7) comes later --\n# this round-trip is local to QRILC and leaves the matrix on its original scale for step 6\u002F7.\nlog_mat \u003C- log2(feature_matrix_features_in_rows)\nqrilc_imputed \u003C- 2^(impute.QRILC(log_mat, tune.sigma = 1)[[1]])\n\n# MAR \u002F sporadic: iterative random-forest prediction (samples in ROWS, features in COLS)\nrf_imputed \u003C- missForest(sample_by_feature_matrix, maxiter = 10, ntree = 100)$ximp\n```\n\nHalf-min imputation collapses the imputed subset's variance to zero, understating SE and inflating false significance -- prefer QRILC\u002FGSimp, which draw a distribution of plausible low values. Re-run key results under >=2 imputation methods; if headline metabolites flip, the finding lives in the imputation.\n\n**Verify after every QRILC call:** `stopifnot(min(qrilc_imputed, na.rm = TRUE) >= 0)`. If this fails, the log2\u002F2^x round-trip above was skipped or a non-QRILC path fed it raw intensities.\n\n## Per-Method Failure Modes\n\n### QC-spline \u002F LOESS over-correction\n- **Trigger:** Span too small, too few QCs, or a cubic spline using each QC as a lock-point.\n- **Mechanism:** The fit threads the QCs perfectly, modeling inter-QC noise as drift and injecting it into samples.\n- **Symptom:** QC RSD drops toward 0% while biological-sample RSD rises and the number of significant features explodes.\n- **Fix:** CV-select the span, validate on held-out QCs and dilution-QC linearity, compare biological-sample RSD before\u002Fafter, not just QC RSD.\n\n### Edge extrapolation\n- **Trigger:** Samples injected before the first QC or after the last QC.\n- **Mechanism:** LOESS\u002Fspline interpolate between QCs but extrapolate beyond them, producing unstable correction factors.\n- **Fix:** Bracket samples with QCs at both ends; exclude conditioning injections.\n\n### TIC closure artifact\n- **Trigger:** One dominant or up-regulated feature under TIC\u002Fsum normalization.\n- **Mechanism:** The constant-sum constraint forces every other feature's normalized value down, manufacturing apparent coordinated down-regulation (Aitchison closure; spurious negative correlations).\n- **Fix:** Use PQN\u002FMSTUS or log-ratios; if \"many features moved together,\" suspect closure from one big mover before believing coordination.\n\n### ComBat under imbalance\n- **Trigger:** Biological groups unbalanced across batches. Risk scales with the *degree* of association, not just its presence -- report a chi-square test or Cramer's V on the batch x group table before deciding how worried to be. Near-total confounding (one group dominates a batch) is the regime Nygaard 2016 demonstrates; mild imbalance (e.g. 85\u002F15 vs 50\u002F50 across batches, not perfectly separated) did not reproduce the same false-positive inflation in a spot-check and can look deceptively safe -- absence of the effect at mild imbalance is not evidence it is absent at severe imbalance.\n- **Mechanism:** Empirical-Bayes shrinkage confounds class with batch; under near-total confounding it can fabricate thousands of false differences or, without the covariate, delete real ones (Nygaard 2016).\n- **Fix:** Prefer QC-anchored between-batch alignment (the pool has no group, so it cannot confound). Reserve ComBat for balanced designs and always pass the biological covariate via `mod=`. Randomize so it is never needed.\n\n### Wrong imputation mechanism\n- **Trigger:** kNN\u002FRF applied to below-LOD (MNAR) values.\n- **Mechanism:** MAR methods borrow abundance from detected samples, pulling the censored group's mean up and shrinking the very difference under test.\n- **Fix:** Diagnose mechanism per feature; QRILC\u002FGSimp for left-censored, RF\u002FkNN only for sporadic MAR.\n\n## Quantitative Thresholds\n\n| Threshold | Source | Rationale |\n|---|---|---|\n| QC RSD \u003C= 20-30% (15% gold) | Dunn 2011; Broadhurst 2018 | Reproducibility floor in the matrix-matched pool; 20% aspirational for LC-MS, 30% common |\n| D-ratio \u003C= 0.5 (0.2 excellent), robust\u002FMAD form | Broadhurst 2018 | Technical SD \u003C biological SD -- the honest, matrix-aware filter; MAD form because MS intensities are right-skewed |\n| Blank ratio >= 3-5x | community convention (Dunn lineage) | Features below 3-5x blank are dominated by background\u002Fcarryover, not biology |\n| Detection rate >= 50-80% (or 80% within any one group) | statTarget Frule=0.8; pmp filter_peaks_by_fraction | Reliable signal; \"within any group\" preserves on\u002Foff group-specific metabolites |\n| Dilution-QC correlation r >= 0.7-0.8 | community convention | Real metabolites scale with dilution; artefacts\u002Fin-source ions do not |\n| QCs >= 5-10% of injections, ~1 every 5-10 samples | Broadhurst 2018; mQACC 2022 | Must sample the drift curve densely enough to avoid LOESS extrapolation |\n\nThresholds are conventions, not laws: choose them a priori, report each one, and report how many features each filter removed (mQACC reporting standard).\n\n## Common Errors\n\n| Error \u002F symptom | Cause | Solution |\n|---|---|---|\n| `could not find function \"statTarget\"` | No such entry point | Use `shiftCor()` (drift correction) and `statAnalysis()` (post-hoc stats) |\n| `mv_imputation` errors on `method='sm'` | Small-value method is `'sv'`, not `'sm'` | Use `method='sv'` (also valid: `knn`, `rf`, `bpca`, `mn`, `md`) |\n| QRILC output is malformed | `impute.QRILC` returns a list, not a matrix; expects features in rows | Index `[[1]]`; transpose so features are rows |\n| QRILC imputed values are negative | Called on raw (non-log) intensities -- QRILC's truncated-normal model is only valid on log-scale data | `log2()` before the call, `2^x` back-transform after (see Impute section); assert `min(imputed) >= 0` |\n| `QCRSC` output is all-NA for a batch | QC count in that batch is below `minQC`; pmp silently returns NA instead of erroring | Check `rowSums(!is.na(result)) == 0` (features in rows, pmp convention) immediately after every `QCRSC` call; below-`minQC` batches need the coarse median-of-QC fallback, not `QCRSC` |\n| MetaboAnalystR `Normalization` errors | `SanityCheckData(mSet)` not run first | Call `SanityCheckData` -> `ReplaceMin` -> `Normalization` in order |\n| Correction made data worse | Span overfit \u002F weak-in-QC features corrected \u002F order confounded with biology | Back off span, exclude weak-in-QC features, check randomization |\n| Effect vanished after drift correction | Run order confounded with group; trend absorbed the biology | Check the design; report drift and effect as inseparable if confounded |\n\n## References\n\n- Dunn WB, Broadhurst D, Begley P, et al. 2011. Procedures for large-scale metabolic profiling of serum and plasma using gas chromatography and liquid chromatography coupled to mass spectrometry. *Nature Protocols* 6:1060-1083.\n- Broadhurst D, Goodacre R, Reinke SN, et al. 2018. Guidelines and considerations for the use of system suitability and quality control samples in mass spectrometry assays applied in untargeted clinical metabolomic studies. *Metabolomics* 14:72.\n- Dieterle F, Ross A, Schlotterbeck G, Senn H. 2006. Probabilistic Quotient Normalization as Robust Method to Account for Dilution of Complex Biological Mixtures. Application in 1H NMR Metabonomics. *Analytical Chemistry* 78:4281-4290.\n- Fan S, Kind T, Cajka T, et al. 2019. Systematic Error Removal Using Random Forest for Normalizing Large-Scale Untargeted Lipidomics Data. *Analytical Chemistry* 91:3590-3596.\n- Brunius C, Shi L, Landberg R. 2016. Large-scale untargeted LC-MS metabolomics data correction using between-batch feature alignment and cluster-based within-batch signal intensity drift correction. *Metabolomics* 12:173.\n- Luan H, Ji F, Chen Y, Cai Z. 2018. statTarget: A streamlined tool for signal drift correction and interpretations of quantitative mass spectrometry-based omics data. *Analytica Chimica Acta* 1036:66-72.\n- Wei R, Wang J, Su M, et al. 2018. Missing Value Imputation Approach for Mass Spectrometry-based Metabolomics Data. *Scientific Reports* 8:663.\n- Wei R, Wang J, Jia E, et al. 2018. GSimp: A Gibbs sampler based left-censored missing value imputation approach for metabolomics studies. *PLoS Computational Biology* 14:e1005973.\n- Stekhoven DJ, Buhlmann P. 2012. MissForest -- non-parametric missing value imputation for mixed-type data. *Bioinformatics* 28:112-118.\n- Nygaard V, Rodland EA, Hovig E. 2016. Methods that remove batch effects while retaining group differences may lead to exaggerated confidence in downstream analyses. *Biostatistics* 17:29-39.\n- van den Berg RA, Hoefsloot HCJ, Westerhuis JA, et al. 2006. Centering, scaling, and transformations: improving the biological information content of metabolomics data. *BMC Genomics* 7:142.\n- Warrack BM, Hnatyshyn S, Ott KH, et al. 2009. Normalization strategies for metabonomic analysis of urine samples. *Journal of Chromatography B* 877:547-552.\n- Thonusin C, IglayReger HB, Soni T, et al. 2017. Evaluation of intensity drift correction strategies using MetaboDrift, a normalization tool for multi-batch metabolomics data. *Journal of Chromatography A* 1523:265-274.\n- Chamberlain CA, Rubio VY, Garrett TJ. 2019. Impact of matrix effects and ionization efficiency in non-quantitative untargeted metabolomics. *Metabolomics* 15:135.\n- Wehrens R, Hageman JA, van Eeuwijk F, et al. 2016. Improved batch correction in untargeted MS-based metabolomics. *Metabolomics* 12:88.\n\n## Related Skills\n\n- metabolomics\u002Fxcms-preprocessing - Generates the feature table this skill consumes\n- metabolomics\u002Fmsdial-preprocessing - Alternative feature-table source\n- metabolomics\u002Fstatistical-analysis - Transformation\u002Fscaling and downstream multivariate stats\n- experimental-design\u002Fbatch-design - Randomization and design that make correction valid\n- differential-expression\u002Fbatch-correction - ComBat\u002FSVA mechanics shared with transcriptomics\n",{"name":5,"tool_type":24,"description":7,"primary_tool":25},"r","pmp","main","e0956dc9606356ab78468936b502e55a365282e2","specialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc",0,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists","https:\u002F\u002Fgithub.com\u002Fmrsonord2240","2026-10-12 03:19:04",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-metabolomics-normalization-qc",{"tool":39,"command":40},"bunx","bunx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-metabolomics-normalization-qc",{"tool":42,"command":43},"pnpm","pnpm dlx skills add mrsonord2240\u002Fopenscience-specialists --skill bio-metabolomics-normalization-qc","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002FSKILL.md",true,[47,53],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"examples\u002Fnormalize_data.R","OTHER","其他",7937,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002Fexamples\u002Fnormalize_data.R",{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"usage-guide.md","REFERENCE","参考文档",5825,"https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-normalization-qc\u002Fusage-guide.md",[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M7CW36A6QAGWFE2C008M1XPG","bio-workflows-metabolomics-pipeline","Orchestrates the untargeted LC-MS metabolomics pipeline end-to-end (xcms 4.x feature extraction, QC\u002Fdrift\u002Fnormalization, confidence-stratified annotation, permutation-validated statistics, background-aware pathway mapping), naming what each stage decides and where it silently fails. Use when running a full LC-MS metabolomics study from raw mzML to enriched pathways and needing the honest handoffs between stages. Each stage defers to its component skill for parameters and traps; for stable-isotope flux (a separate branch, not this untargeted flow) see metabolomics\u002Fisotope-tracing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-workflows-metabolomics-pipeline\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M7CW2Y18623NA2S1Y30FRQW1","bio-metabolomics-xcms-preprocessing","Programmatic untargeted LC-MS feature extraction in R with the modern xcms 4.x MsExperiment\u002FXcmsExperiment API, taking raw mzML to a feature table via CentWave peak detection, retention-time alignment, peak-density correspondence, gap-filling, CAMERA redundancy collapse, and built-in QC feature filtering. Use when converting centroided LC-MS runs into a features-by-samples matrix and deciding centWave\u002Fgrouping\u002Falignment parameters. For drift correction and QC\u002FCV filtering execution see metabolomics\u002Fnormalization-qc; for metabolite identification see metabolomics\u002Fmetabolite-annotation; for the MS-DIAL GUI alternative with MS2Dec deconvolution see metabolomics\u002Fmsdial-preprocessing; for downstream statistics see metabolomics\u002Fstatistical-analysis.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-xcms-preprocessing\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M7CW2M364HVWPNQEKE2WP4PP","bio-metabolomics-statistical-analysis","Decision-grade statistical analysis for metabolomics intensity tables. Covers transformation and scaling (Pareto vs unit-variance as a hidden hypothesis), unsupervised structure (PCA\u002FHCA for QC), permutation-validated PLS-DA\u002FOPLS-DA (R2 vs Q2, double CV, VIP as heuristic), univariate testing (Welch\u002FMann-Whitney\u002FANOVA\u002FLMM with covariate adjustment), and dependence-aware multiple testing. Use when testing which metabolites differ, building or validating a discriminant model, choosing a scaling, or correcting many correlated tests. For sample-wise normalization\u002Fdrift correction see metabolomics\u002Fnormalization-qc; for ML classifiers and selection-inside-CV leakage see machine-learning\u002Fbiomarker-discovery and machine-learning\u002Fmodel-validation; for pathway interpretation see metabolomics\u002Fpathway-mapping; for design\u002Fpower\u002Fmultiplicity regime see experimental-design\u002Fmultiple-testing.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-statistical-analysis\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M7CW2BCBF851WYE03Z8XPEDQ","bio-metabolomics-pathway-mapping","Maps metabolomics results to biological pathways via over-representation (ORA), metabolite-set enrichment (MSEA\u002FQEA), mummichog\u002FPSEA on raw m\u002Fz peaks, and network-diffusion enrichment (FELLA), with correct background-set construction and honest interpretive ceilings. Use when interpreting differential metabolites or an untargeted LC-MS feature table in pathway context, choosing ORA vs MSEA vs mummichog vs topology, or setting the reference\u002Fbackground set. For annotation confidence levels feeding ORA see metabolomics\u002Fmetabolite-annotation; for gene-set concepts see pathway-analysis\u002Fgo-enrichment and pathway-analysis\u002Fgsea; for joint gene+metabolite pathways see multi-omics-integration\u002Fmofa-integration.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-pathway-mapping\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":19},"01M7CW1SWVM0NYHVE6Q7MA3G7R","bio-metabolomics-msdial-preprocessing","Runs the MS-DIAL preprocessing workflow (peak picking, MS2Dec spectral deconvolution, alignment, gap-filling) and imports the alignment-result table into R or Python with honest filtering. Use when preprocessing LC-MS DDA\u002FDIA (SWATH) or GC-MS raw data with MS-DIAL, deciding MS-DIAL vs XCMS, configuring the MSDIALCUI console run, or parsing an MS-DIAL export into a clean feature matrix. For programmatic R peak detection and the feature-table-as-artifact framing see metabolomics\u002Fxcms-preprocessing; for lipid annotation mode see metabolomics\u002Flipidomics; for MSI-level confidence honesty see metabolomics\u002Fmetabolite-annotation; for drift correction and QC see metabolomics\u002Fnormalization-qc.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-msdial-preprocessing\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":19},"01M7CW1HG6R6AWNNR0SCX6612X","bio-metabolomics-metabolite-annotation","Turns untargeted LC-MS\u002FMS features (m\u002Fz, RT, MS\u002FMS) into confidence-stratified metabolite annotations using spectral-library matching (matchms), in-silico tools (SIRIUS\u002FCSI:FingerID, MetFrag) and molecular networking, and assigns a defensible MSI\u002FSchymanski confidence level to each. Use when naming detected features, scoring MS\u002FMS against a reference library, running SIRIUS, or deciding what confidence level an evidence set actually supports. For upstream feature extraction see metabolomics\u002Fxcms-preprocessing and metabolomics\u002Fmsdial-preprocessing; for downstream enrichment that must respect these levels see metabolomics\u002Fpathway-mapping; for lipid-specific structural annotation see metabolomics\u002Flipidomics.","https:\u002F\u002Fgithub.com\u002Fmrsonord2240\u002Fopenscience-specialists\u002Fblob\u002Fmain\u002Fspecialists\u002Funtargeted-metabolomics-analyst\u002Fversions\u002F1.0.0\u002Fpackage\u002Fskills\u002Fbio-metabolomics-metabolite-annotation\u002FSKILL.md",[],[]]