omicverse-bulk-metabol-preprocessing
Installation
SKILL.md
OmicVerse Bulk Metabolomics Preprocessing
Goal
Take a metabolomics peak table (NMR or LC-MS; MetaboAnalyst CSV, generic wide CSV, or m/z/RT-coded LC-MS table) into an AnnData and run the canonical clean-up chain — load → impute → sample-normalize → feature-transform — plus optional MS-specific drift / batch / sample-outlier correction. The output is an analysis-ready AnnData with obs['group'] populated, raw intensities preserved as a layer, and the matrix in the right scale for the downstream skill (univariate stats vs. multivariate model).
Stay focused on preprocessing. Univariate differential / anova is a thin add-on shown for completeness; multivariate (PLS-DA, OPLS-DA), pathway enrichment (MSEA), biomarker selection, DGCA, and multi-omics MOFA are separate downstream skills.
Quick Workflow
- Pick the loader by file format and pass
group_col— every downstream test readsadata.obs['group']. - Impute missing values; method depends on the missingness mechanism (MAR →
knn; MNAR / left-censored LC-MS →qrilc). - Normalize each sample row to remove dilution effects — PQN is canonical.
- Transform each feature column for variance stabilization (
log), and Pareto-scale on top only when a multivariate model will consume the matrix. - For LC-MS with QC pools and injection order: run
drift_correct(LOESS-on-QC) →serrf(RF on QC) →ov.bulk.batch_correction(ComBat on residual batch shifts), in that order. - Run
sample_qcon the corrected real samples to flag outliers; inspect manually before removing. - Validate that
adata.obs['group']exists, no NaNs remain inadata.X, andrawmatrix is preserved in a layer.