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/plot_ms_data.py
View on GitHub#!/usr/bin/env python3
"""
Visualize MS Data
Quick plots for inspecting MS data and results:
spectrum single MS spectrum (peak/stick plot) by index or RT
tic total ion chromatogram
featuremap 2D feature map (RT vs m/z, sized/colored by intensity)
map2d 2D heatmap of MS1 signal (RT vs m/z)
Usage:
python plot_ms_data.py spectrum data.mzML --index 0 --out spec.png
python plot_ms_data.py tic data.mzML --out tic.png
python plot_ms_data.py featuremap features.featureXML --out fmap.png
python plot_ms_data.py map2d data.mzML --out map.png
"""
import argparse
import os
import sys
try:
import pyopenms as ms
import numpy as np
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
except ImportError:
print("Error: pyopenms/matplotlib not installed. Install with: uv pip install pyopenms matplotlib")
sys.exit(1)
def load_exp(path):
exp = ms.MSExperiment()
ms.FileHandler().loadExperiment(path, exp)
return exp
def plot_spectrum(args):
exp = load_exp(args.input)
if args.rt is not None:
spec = min((s for s in exp), key=lambda s: abs(s.getRT() - args.rt))
else:
spec = exp.getSpectrum(args.index)
mz, inten = spec.get_peaks()
plt.figure(figsize=(10, 5))
plt.vlines(mz, 0, inten, linewidth=0.8)
plt.xlabel("m/z")
plt.ylabel("Intensity")
plt.title(f"Spectrum (MS{spec.getMSLevel()}, RT={spec.getRT():.1f}s, {len(mz)} peaks)")
plt.tight_layout()
def plot_tic(args):
exp = load_exp(args.input)
rts, tic = [], []
for s in exp:
if s.getMSLevel() != 1:
continue
_, inten = s.get_peaks()
rts.append(s.getRT())
tic.append(float(inten.sum()) if len(inten) else 0.0)
plt.figure(figsize=(10, 5))
plt.plot(rts, tic, linewidth=1)
plt.xlabel("Retention time (s)")
plt.ylabel("Total ion current")
plt.title("Total Ion Chromatogram")
plt.tight_layout()
def plot_featuremap(args):
fm = ms.FeatureMap()
ms.FeatureXMLFile().load(args.input, fm)
df = fm.get_df()
plt.figure(figsize=(10, 6))
sizes = 10 + 40 * (df["intensity"] / df["intensity"].max())
sc = plt.scatter(df["rt"], df["mz"], s=sizes, c=np.log10(df["intensity"] + 1),
cmap="viridis", alpha=0.7)
plt.colorbar(sc, label="log10(intensity)")
plt.xlabel("Retention time (s)")
plt.ylabel("m/z")
plt.title(f"Feature map ({fm.size()} features)")
plt.tight_layout()
def plot_map2d(args):
exp = load_exp(args.input)
rts, mzs, ints = [], [], []
for s in exp:
if s.getMSLevel() != 1:
continue
mz, inten = s.get_peaks()
rt = s.getRT()
for m, it in zip(mz, inten):
rts.append(rt); mzs.append(m); ints.append(it)
plt.figure(figsize=(10, 6))
sc = plt.scatter(rts, mzs, c=np.log10(np.array(ints) + 1), s=2,
cmap="inferno", alpha=0.5)
plt.colorbar(sc, label="log10(intensity)")
plt.xlabel("Retention time (s)")
plt.ylabel("m/z")
plt.title("MS1 signal map")
plt.tight_layout()
PLOTS = {"spectrum": plot_spectrum, "tic": plot_tic,
"featuremap": plot_featuremap, "map2d": plot_map2d}
def main():
parser = argparse.ArgumentParser(description="Visualize MS data.")
parser.add_argument("kind", choices=list(PLOTS), help="Plot type")
parser.add_argument("input", help="Input file")
parser.add_argument("--index", type=int, default=0, help="Spectrum index (spectrum plot)")
parser.add_argument("--rt", type=float, help="Select spectrum nearest this RT (spectrum plot)")
parser.add_argument("--out", required=True, help="Output image path (PNG/PDF/SVG)")
args = parser.parse_args()
if not os.path.exists(args.input):
print(f"Error: file not found: {args.input}")
sys.exit(1)
PLOTS[args.kind](args)
plt.savefig(args.out, dpi=150)
print(f"Wrote {args.out}")
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 |