AGENT SKILL

metabolomics-peak-detection

Load when running per-sample peak picking on a feature × intensity table via `scipy.signal.find_peaks` — emits per-(sample, feature) detected peaks with prominence and width. Skip when working with mz / RT raw scans (use metabolomics-xcms-preprocessing); only normalising / quantifying (use metabolomics-quantification).

License 许可
Apache-2.0
最近更新
2026-10-08
Stars
★ 161
Forks
27

01 前言 Front Matter

name
metabolomics-peak-detection
tags
[ "metabolomics", "peak-detection", "find-peaks", "xcms", "mzmine" ]
trigger
peak detection, feature detection, XCMS, MZmine, MS-DIAL, peak picking
description
Load when running per-sample peak picking on a feature × intensity table via `scipy.signal.find_peaks` — emits per-(sample, feature) detected peaks with prominence and width. Skip when working with mz / RT raw scans (use metabolomics-xcms-preprocessing); only normalising / quantifying (use metabolomics-quantification).

02 资源文件 14

03 SKILL.md 正文

metabolomics-peak-detection

When to use

Detect peaks on tabular sample signals ordered by retention time. This is not raw mzML peak extraction; run XCMS externally for that workflow.

Use from a step

import pandas as pd
from skills._sdk.notebook import load_skill, read_input, write_output
library = load_skill("metabolomics-peak-detection")
data = read_input('features.csv', reader=pd.read_csv)
result = library.detect_peaks(data)
write_output(result, 'tables/result.csv')

examples/example_step.py runs a seeded synthetic example through the step runner and writes a table and Figure. Computations return new DataFrames, leave the input unchanged and expose diagnostics through run_info(result). Plotting functions write no files.

API

<!-- api:begin generated from _api.py; regenerate with run.py api <skill dir> --write -->

detect_peaks(data, *, sample_cols=None, prominence=10000.0, height=None, distance=5)

Detect per-sample peaks after sorting rows by retention time.

:param data: DataFrame with mz, rt and numeric sample intensities. :param sample_cols: Explicit columns; None uses the CLI intensity/sample name detection. :param prominence: CLI default 10000; adjust to the intensity scale. :param height: CLI default None; optionally require a minimum peak height. :param distance: CLI default 5; minimum separation in sorted row positions, not seconds. :returns: A new peak DataFrame with diagnostics in attrs['run_info']. :raises ValueError: No sample columns match or peak parameters are invalid.

run_info(data, *, keep=True)

Read diagnostics attached to a returned table.

:param data: DataFrame returned by this library. :param keep: Default True; use False in the CLI to remove diagnostics. :returns: An independent dictionary describing the run. :raises ValueError: The table carries no run_info.

peaks_figure(data)

Plot detected peak intensity against retention time.

:param data: Peak table returned by detect_peaks. :returns: A matplotlib Figure. :raises KeyError: Required peak columns are absent.

<!-- api:end -->

Methods and parameters

scipy.signal.find_peaks uses prominence, optional height and a row-index distance after sorting by rt. Widths are measured at half prominence in row-index units.

Gotchas

  • detect_peaks expects mz and rt plus sample/intensity columns. distance and width are row positions, not seconds. NaNs follow scipy signal semantics and are not imputed. Empty outputs keep their CSV column schema.

Inputs and outputs

CSV input; tables/detected_peaks.csv, report.md and result.json. Demo mode also writes its synthetic input CSV at the output root. The function library returns objects; the CLI and step own file writes.

CLI

python skills/metabolomics/metabolomics-peak-detection/peak_detect.py --demo --output /tmp/metabolomics_peak_detection

See also

Dependencies

numpy, pandas, scipy, matplotlib

04 同仓库更多 Skills

TianGzlab
TianGzlab/OmicsClaw

demo-skill

A fixture skill for the skill environment tests. Use it for nothing else.

★ 161
TianGzlab
TianGzlab/OmicsClaw

fake-domains

Test fixture for the golden deployment in tests/entry. Load never; it has no script.

★ 161
TianGzlab
TianGzlab/OmicsClaw

replace-me-skill

Load when copying this directory to bootstrap a new OmicsClaw skill. Skip when an existing skill already covers the request.

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-velocity

Load when estimating RNA velocity on a spatial AnnData with `layers["spliced"]` + `layers["unspliced"]` via scVelo (stochastic / deterministic / dynamical) or veloVI (deep generative). Skip when input lacks the spliced/unspliced layers (must be quantified upstream by velocyto / kb-python / STARsolo); non-spatial scRNA velocity (use sc-velocity).

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-trajectory

Load when inferring pseudotime / lineage trajectories on a preprocessed spatial AnnData via DPT (default — diffusion pseudotime), CellRank (terminal-state + fate-probability), or Palantir (waypoint branch probabilities). Skip when the data has spliced/unspliced layers and you want velocity-driven dynamics (use spatial-velocity); non-spatial scRNA pseudotime (use sc-pseudotime).

★ 161
TianGzlab
TianGzlab/OmicsClaw

spatial-statistics

Load when running spatial autocorrelation / hotspot / co-occurrence / neighbourhood-enrichment / Ripley K stats on a clustered spatial AnnData via squidpy. Skip when ranking spatially variable genes (use spatial-genes); tissue domain detection (use spatial-domains).

★ 161