Skip to content
Back to skills

Metabolomics Quantification

ASecurity

Load when imputing missing values (min / median / KNN) and normalising (TIC / median / log)

  • 8 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 6, 2026
datapythongobashtestingapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 6, 2026

npx -y skills add lilinji/GeneTind-Life-Skills --skill metabolomics-quantification --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Metabolomics Quantification?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Metabolomics Quantification
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/lilinji-metabolomics-quantification/badge)](https://www.skillsdirectory.com/skills/lilinji-metabolomics-quantification)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
# AUTO-GENERATED header from skill.yaml — do not edit by hand.
# Edit skill.yaml, then run: python scripts/generate_skill_md.py <skill_dir>
name: metabolomics-quantification
description: Load when imputing missing values (min / median / KNN) and normalising (TIC / median / log)
  a feature × sample metabolomics CSV. Skip when only normalisation is needed (use metabolomics-normalization);
  the input is raw spectra (use metabolomics-xcms-preprocessing).
version: 0.5.0
author: OmicsClaw
license: MIT
emoji: 📏
tags:
- metabolomics
- quantification
- imputation
- normalization
- knn
- tic
requires:
- numpy
- pandas
- scikit-learn
---

# metabolomics-quantification

## When to use

The user has a feature × sample metabolomics intensity table and
wants missing-value imputation followed by normalisation, in a
single pass. Imputation: `min` (1/2 of column min), `median`
(per-column median), `knn` (sklearn KNNImputer). Normalisation:
`tic` (Total Ion Current per sample), `median` (per-sample
median), `log` (log2(x+1)).

Sample columns are auto-detected by name prefix `sample` /
`intensity`. For just normalisation use `metabolomics-normalization`;
for raw LC-MS use `metabolomics-xcms-preprocessing`.

## Inputs & Outputs

<!-- AUTO-GENERATED from skill.yaml (interface) — do not edit by hand. Regenerate: python scripts/generate_skill_md.py <skill_dir> -->

**Inputs**

- File types: `.csv`

**Outputs**

- `tables/quantified_features.csv`
- `report.md`
- `result.json`

## Flow

1. Load CSV (`--input <features.csv>`) or generate a demo (`--demo`).
2. Auto-detect sample columns via `c.startswith("sample") or c.startswith("intensity")` (`met_quantify.py:72-84`); raise `ValueError("Could not auto-detect sample columns in the input file.")` at `:174` if none found.
3. Impute missing values per `--impute` (`min` / `median` / `knn`); reject unknown method at `:187` with `ValueError("Unknown impute method: ...")`.
4. Normalise per `--normalize` (`tic` / `median` / `log`); reject unknown method at `:193`.
5. Write `tables/quantified_features.csv` (`met_quantify.py:294`) + `report.md` + `result.json`.

## Gotchas

- **Sample-column auto-detection is case-SENSITIVE prefix match.** `met_quantify.py:74-84` uses `c.startswith("sample") or c.startswith("intensity")`. `Sample_1` (capital S) does NOT match — pre-rename to lowercase or use `metabolomics-peak-detection`'s `--sample-prefix` (no equivalent flag here).
- **No sample columns ⇒ `ValueError`.** `met_quantify.py:174` raises `ValueError("Could not auto-detect sample columns in the input file.")` after both detection passes fail.
- **`--input` REQUIRED unless `--demo`.** `met_quantify.py:286` raises `ValueError("--input required when not using --demo")`.
- **`knn` imputation requires sklearn.** Available by default in OmicsClaw env. Imputes using `KNNImputer(n_neighbors=5)`.
- **`log` normalisation is `log2(x+1)`.** Zero → 0 (preserves zeros); negative values raise (silently propagate NaN). Pre-clip negatives upstream.
- **Imputation runs BEFORE normalisation.** This means `min` imputation uses unnormalised column min — re-running with a different `--normalize` does NOT change imputed-cell values. To get norm-aware imputation, run `metabolomics-normalization` standalone first, then use `--impute median` here on already-normalised data.

## Key CLI

```bash
# Demo
python omicsclaw.py run metabolomics-quantification --demo --output /tmp/quant_demo

# Real intensity table (default min impute + TIC normalize)
python omicsclaw.py run metabolomics-quantification \
  --input features.csv --output results/

# KNN impute + median normalize
python omicsclaw.py run metabolomics-quantification \
  --input features.csv --output results/ \
  --impute knn --normalize median

# log2(x+1) only
python omicsclaw.py run metabolomics-quantification \
  --input features.csv --output results/ \
  --impute median --normalize log
```

## See also

- `references/parameters.md` — every CLI flag
- `references/methodology.md` — imputation / normalisation method semantics
- `references/output_contract.md` — `tables/quantified_features.csv` schema
- Adjacent skills: `metabolomics-xcms-preprocessing` (upstream), `metabolomics-peak-detection` (upstream), `metabolomics-normalization` (parallel — normalisation only), `metabolomics-statistics` (downstream — multi-group testing), `metabolomics-de` (downstream — two-group DE)

Files in this skill

  • SKILL.md4.3 KB
  • met_quantify.py10 KB
  • references/methodology.md913 B
  • references/output_contract.md673 B
  • references/parameters.md279 B
  • skill.yaml1 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in data →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.