Skip to content

K-Dense-AI/scientific-agent-skills / skills/pyopenms

pyopenms

Verified

Processes 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.

scripts/detect_features_centroided.py

View on GitHub
#!/usr/bin/env python3
"""
Peptide/Centroided Feature Detection

Detect features in centroided (peak-picked) LC-MS data using
FeatureFinderAlgorithmPicked -- the modern replacement for the removed
FeatureFinderCentroided. Suited to peptide/proteomics data with defined
isotope patterns and charge states.

Outputs a featureXML and optionally a CSV table.

Usage:
    python detect_features_centroided.py centroided.mzML
    python detect_features_centroided.py data.mzML --out-csv feats.csv --charge-low 2 --charge-high 5
"""

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, mz_tol_da=0.004, charge_low=1, charge_high=4, min_spectra=7, assume_centroided=False):
    exp = centroided_ms1(exp, assume_centroided)
    ff = ms.FeatureFinderAlgorithmPicked()
    params = ff.getDefaults()
    params.setValue("mass_trace:mz_tolerance", float(mz_tol_da))
    params.setValue("mass_trace:min_spectra", int(min_spectra))
    params.setValue("isotopic_pattern:charge_low", int(charge_low))
    params.setValue("isotopic_pattern:charge_high", int(charge_high))
    ff.setParameters(params)

    features = ms.FeatureMap()
    seeds = ms.FeatureMap()
    ff.run(exp, features, params, seeds)
    features.setUniqueIds()
    return features


def main():
    parser = argparse.ArgumentParser(description="Centroided/peptide 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("--mz-tol-da", type=float, default=0.004, help="Absolute m/z tolerance in Th (OpenMS Da option; default 0.004)")
    parser.add_argument("--assume-centroided", action="store_true", help="Accept unknown MS1 spectrum type after independent verification")
    parser.add_argument("--charge-low", type=int, default=1, help="Lower charge bound (default 1)")
    parser.add_argument("--charge-high", type=int, default=4, help="Upper charge bound (default 4)")
    parser.add_argument("--min-spectra", type=int, default=7, help="Min scans per feature (default 7)")
    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 = detect_features(exp, mz_tol_da=args.mz_tol_da, charge_low=args.charge_low,
                         charge_high=args.charge_high, min_spectra=args.min_spectra,
                         assume_centroided=args.assume_centroided)
    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()
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
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: 198kUpdated Claude CodeCodexVerifiedInstall
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: 119kUpdated Claude CodeCodexVerifiedInstall
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: 118kUpdated Claude CodeCodexVerifiedInstall