Metabolite cv ratio calculation
Curated, evidence-grounded skill and software-tool collections for scientific AI agents, generated by the AgenticScienceBuilder
npx -y skills add HolobiomicsLab/asb-skill-collections --skill metabolite-cv-ratio-calculationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 14 stars14 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when after normalizing a metabolomic feature matrix when you have both non-QC (study) samples and QC (quality-control) replicates in the same experiment. Use it to remove features that are poorly reproducible or show inconsistent signal across samples relative to instrument/technical variation.
The file declares its own license as CC-BY-4.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
8.0 KB, as published. Nobody here has run it
metabolite-cv-ratio-calculation
License: restricted — no clear open-source license detected for the underlying tool; verify licensing before commercial use or redistribution. <!-- asb-license-banner -->
Summary
Calculate and apply coefficient-of-variation (CV) ratios between sample and QC groups to filter metabolomic features by reproducibility. This skill identifies features with elevated variability in real samples relative to quality-control replicates, retaining only those exceeding a ratio threshold (typically CV_non-QC / CV_QC > 1.0).
When to use
Apply this skill after normalizing a metabolomic feature matrix when you have both non-QC (study) samples and QC (quality-control) replicates in the same experiment. Use it to remove features that are poorly reproducible or show inconsistent signal across samples relative to instrument/technical variation. This is especially valuable when you need to identify genuine biological signals amid high noise or batch effects typical of LC-MS/MS profiling.
When NOT to use
- Input is already a feature table filtered by other QC metrics (e.g., mass defect, missing value thresholds) — combine CV filtering into a unified QC pipeline rather than applying sequentially.
- Study design lacks QC replicates or has fewer than 3 QC samples per instrument run — CV calculation requires sufficient replication to estimate reproducibility reliably.
- Features are sparse or zero-inflated across samples — CV calculation may be unstable for rare features; consider imputation or alternative distributional assumptions first.
Inputs
- Normalized metabolomic feature abundance matrix (e.g., Urine_RP_NEG_norm.txt)
- Sample metadata identifying QC vs. non-QC sample group membership
- Feature annotations (m/z, retention time, metabolite name)
Outputs
- Filtered feature abundance matrix with retained features only
- CV ratio values (one per feature)
- Feature count summary (n_initial, n_retained, n_removed)
- CV ratio distribution statistics (mean, median, min, max, quantiles)
How to apply
Load the normalized feature abundance matrix (e.g., Urine_RP_NEG_norm.txt) and sample metadata identifying QC vs. non-QC sample groups into R. For each metabolomic feature, separately calculate the coefficient of variation (CV = standard deviation / mean) within the non-QC sample group and within the QC sample group. Compute the CV ratio as (CV_non-QC / CV_QC) for each feature. Apply a threshold filter, retaining only features where CV_ratio exceeds the default cutoff of 1.0; features below this threshold are likely noise or artifacts. Output the filtered feature table and generate summary statistics including count of features before and after filtering, mean/median CV ratio of retained features, and the full distribution of CV ratios to assess filtering stringency.
Related tools
- margheRita (Implements CV_ratio() function for coefficient-of-variation filtering of metabolomic features post-normalization) — https://github.com/emosca-cnr/margheRita
- R (Execution environment for CV calculation, ratio computation, and statistical filtering)
- notame (Alternative R package for non-targeted LC-MS preprocessing with built-in quality-control and feature-filtering workflows) — https://github.com/hanhineva-lab/notame
Examples
# In R with margheRita:
library(margheRita)
data_filtered <- CV_ratio(feature_matrix = urine_norm, sample_metadata = metadata, group_col = 'sample_type', qc_label = 'QC', threshold = 1.0)
Evaluation signals
- Feature count decreases from initial set (e.g., 539 → 303 metabolites), with count reduction proportional to CV ratio threshold stringency.
- Retained features have median CV ratio > 1.0 and distribution mean > 1.0 (e.g., median 1.1032 in the reference dataset), confirming biological signal enrichment.
- CV ratio histogram shows bimodal or right-skewed distribution with modal peak at or above threshold, indicating clear separation of high-variance (retained) from low-variance (removed) features.
- Removed features cluster at CV ratios ≤ 1.0, consistent with features whose variation in samples matches or is less than QC instrument noise.
- Subsequent statistical tests (e.g., ANOVA, Mann–Whitney U) on retained features show lower multiple-testing burden and higher effect sizes, validating improved signal-to-noise ratio.
Limitations
- CV ratio filtering is sensitive to outlier samples or QC replicates with anomalously high/low intensity; consider flagging or removing outliers before CV calculation.
- Threshold of CV_ratio > 1.0 is heuristic and may be too stringent (retaining few features) or too lenient (retaining noisy features) depending on sample complexity, ionization efficiency, and LC-MS instrument stability; consider adjusting based on downstream statistical power.
- Features with zero or near-zero mean abundance in either QC or non-QC groups will have undefined or inflated CV values; pre-filter features by minimum abundance or presence threshold.
- CV ratio does not account for biological covariance or clustering; features with high CV ratio may reflect genuine sample heterogeneity rather than true metabolite abundance differences.
Evidence
- [other] The CV_ratio() function retains only features with a CV ratio (non-QC samples / QC samples) exceeding the default threshold of 1, producing a distribution with median 1.1032 and resulting in 303 metabolites retained out of 539 initial features.: "The CV_ratio() function retains only features with a CV ratio (non-QC samples / QC samples) exceeding the default threshold of 1, producing a distribution with median 1.1032 and resulting in 303"
- [other] Calculate the coefficient of variation (CV) for each feature separately within the non-QC sample group and within the QC sample group.: "Calculate the coefficient of variation (CV) for each feature separately within the non-QC sample group and within the QC sample group."
- [other] Compute the CV ratio (CV_non-QC / CV_QC) for each feature. Apply the threshold filter, retaining only features where CV_ratio > 1.0.: "Compute the CV ratio (CV_non-QC / CV_QC) for each feature. Apply the threshold filter, retaining only features where CV_ratio > 1.0."
- [readme] filtering by coefficient of variation (samples vs QCs) and probabilistic quotient normalization: "filtering by coefficient of variation (samples vs QCs) and probabilistic quotient normalization"