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
- 脚本_api.py2.2 KB
- 其他.DS_Store6.0 KB
- 资产文件assets/content_calendar_template.md1.6 KB
- 脚本examples/example_step.py470 B
- 脚本peak_detect.py6.1 KB
- 参考文档references/brand_guidelines.md6.0 KB
- 参考文档references/content_frameworks.md10.3 KB
- 参考文档references/methodology.md397 B
- 参考文档references/output_contract.md502 B
- 参考文档references/parameters.md355 B
- 参考文档references/social_media_optimization.md8.9 KB
- 脚本scripts/brand_voice_analyzer.py6.5 KB
- 脚本scripts/seo_optimizer.py15.3 KB
- 脚本tests/test_api.py845 B
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_peaksexpects mz and rt plus sample/intensity columns.distanceandwidthare 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
demo-skill
A fixture skill for the skill environment tests. Use it for nothing else.
fake-domains
Test fixture for the golden deployment in tests/entry. Load never; it has no script.
replace-me-skill
Load when copying this directory to bootstrap a new OmicsClaw skill. Skip when an existing skill already covers the request.
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).
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).
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).