K-Dense-AI/scientific-agent-skills / skills/pyopenms
pyopenms
VerifiedProcesses mass spectrometry data with pyOpenMS. Supports proteomics and metabolomics workflows—feature detection, peptide/protein identification, label-free quantification, adduct/accurate-mass annotation, and complex LC-MS/MS pipelines. Supports extensive file formats and algorithms. For simple spectral comparison and small-molecule library matching use matchms.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.2 KB |
| references/data_structures.md | markdown | 5.3 KB |
| references/feature_detection.md | markdown | 5.9 KB |
| references/file_io.md | markdown | 3.9 KB |
| references/identification.md | markdown | 5.4 KB |
| references/metabolomics.md | markdown | 6.0 KB |
| references/signal_processing.md | markdown | 5.7 KB |
| scripts/_common.py | script | 1.0 KB |
| scripts/accurate_mass_search.py | script | 3.7 KB |
| scripts/align_link_quantify.py | script | 5.9 KB |
| scripts/consensus_to_matrix.py | script | 2.7 KB |
| scripts/convert_format.py | script | 3.3 KB |
| scripts/detect_adducts.py | script | 3.9 KB |
| scripts/detect_features_centroided.py | script | 3.3 KB |
| scripts/detect_features_metabo.py | script | 4.3 KB |
| scripts/digest_protein.py | script | 3.6 KB |
| scripts/export_gnps_sirius.py | script | 4.2 KB |
| scripts/extract_chromatograms.py | script | 3.9 KB |
| scripts/inspect_ms_data.py | script | 5.8 KB |
| scripts/mass_calculator.py | script | 3.5 KB |
| scripts/plot_ms_data.py | script | 3.9 KB |
| scripts/process_identifications.py | script | 6.4 KB |
| scripts/process_spectra.py | script | 4.8 KB |
| scripts/theoretical_spectrum.py | script | 3.1 KB |
scripts/detect_features_metabo.py
View on GitHub#!/usr/bin/env python3
"""
Untargeted Metabolomics Feature Detection
Run the standard OpenMS small-molecule feature-finding pipeline on centroided
LC-MS data:
MassTraceDetection -> ElutionPeakDetection -> FeatureFindingMetabo
Outputs a featureXML and (optionally) a CSV table of detected features.
This is the recommended entry point for untargeted metabolomics preprocessing.
Usage:
python detect_features_metabo.py sample.mzML
python detect_features_metabo.py sample.mzML --out-features feats.featureXML --out-csv feats.csv
python detect_features_metabo.py sample.mzML --ppm 5 --noise 5000 --charge-low 1 --charge-high 3
"""
import argparse
import os
import sys
try:
import pyopenms as ms
except ImportError:
print("Error: pyopenms not installed. Install with: uv pip install pyopenms")
sys.exit(1)
from _common import centroided_ms1
def detect_features(exp, ppm=10.0, noise=1000.0, charge_low=1, charge_high=3,
remove_single=True, iso_model="metabolites (5% RMS)", assume_centroided=False):
"""Run MTD -> EPD -> FFM. Returns a FeatureMap."""
exp = centroided_ms1(exp, assume_centroided)
# 1. Mass trace detection
mtd = ms.MassTraceDetection()
p = mtd.getDefaults()
p.setValue("mass_error_ppm", float(ppm))
p.setValue("noise_threshold_int", float(noise))
mtd.setParameters(p)
mass_traces = mtd.run(exp, 0)
# 2. Elution peak detection
epd = ms.ElutionPeakDetection()
p = epd.getDefaults()
p.setValue("width_filtering", "fixed")
epd.setParameters(p)
mt_split = epd.detectPeaks(mass_traces)
# 3. Feature assembly (isotope/charge resolution)
ffm = ms.FeatureFindingMetabo()
p = ffm.getDefaults()
p.setValue("isotope_filtering_model", iso_model)
p.setValue("remove_single_traces", "true" if remove_single else "false")
p.setValue("charge_lower_bound", int(charge_low))
p.setValue("charge_upper_bound", int(charge_high))
p.setValue("report_convex_hulls", "true")
ffm.setParameters(p)
fm = ms.FeatureMap()
ffm.run(mt_split, fm)
fm.setUniqueIds()
return fm, len(mass_traces)
def main():
parser = argparse.ArgumentParser(description="Untargeted metabolomics feature detection.")
parser.add_argument("input", help="Centroided mzML file")
parser.add_argument("--out-features", help="Output featureXML (default: <input>.featureXML)")
parser.add_argument("--out-csv", help="Optional CSV table of features")
parser.add_argument("--ppm", type=float, default=10.0, help="Mass trace m/z tolerance in ppm (default 10)")
parser.add_argument("--noise", type=float, default=1000.0, help="Noise intensity threshold (default 1000)")
parser.add_argument("--charge-low", type=int, default=1, help="Lower charge bound (default 1)")
parser.add_argument("--charge-high", type=int, default=3, help="Upper charge bound (default 3)")
parser.add_argument("--keep-singletons", action="store_true",
help="Keep single-trace features (default: remove)")
parser.add_argument("--iso-model", default="metabolites (5% RMS)",
help="Isotope filtering model (e.g. 'none', 'metabolites (5%% RMS)')")
parser.add_argument("--assume-centroided", action="store_true", help="Accept unknown MS1 spectrum type after independent verification")
args = parser.parse_args()
if not os.path.exists(args.input):
print(f"Error: file not found: {args.input}")
sys.exit(1)
exp = ms.MSExperiment()
ms.FileHandler().loadExperiment(args.input, exp)
print(f"Loaded {exp.getNrSpectra()} spectra from {args.input}")
fm, n_traces = detect_features(
exp, ppm=args.ppm, noise=args.noise,
charge_low=args.charge_low, charge_high=args.charge_high,
remove_single=not args.keep_singletons, iso_model=args.iso_model,
assume_centroided=args.assume_centroided,
)
print(f"Mass traces: {n_traces}")
fm.setPrimaryMSRunPath([os.path.abspath(args.input)])
print(f"Features detected: {fm.size()}")
out_features = args.out_features or os.path.splitext(args.input)[0] + ".featureXML"
ms.FeatureXMLFile().store(out_features, fm)
print(f"Wrote {out_features}")
if args.out_csv:
df = fm.get_df()
df.to_csv(args.out_csv, index=False)
print(f"Wrote {args.out_csv} ({len(df)} rows)")
if __name__ == "__main__":
main()
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |