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/digest_protein.py

View on GitHub
#!/usr/bin/env python3
"""
In-Silico Protein Digestion

Digest protein sequences (FASTA or a single sequence) with a configurable
protease, producing theoretical peptides with masses and m/z. Useful for
targeted method design and search-space estimation.

Usage:
    python digest_protein.py proteins.fasta --out peptides.csv
    python digest_protein.py --sequence MKWVTFISLLLLFSSAYS --enzyme Trypsin --missed 2
    python digest_protein.py proteins.fasta --min-length 7 --max-length 40 --charges 1 2 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)

PROTON = 1.0072764665789


def read_fasta(path):
    entries = []
    fe = ms.FASTAFile()
    seqs = []
    fe.load(path, seqs)
    for s in seqs:
        entries.append((s.identifier, s.sequence))
    return entries


def digest(seq_str, enzyme, missed, min_len, max_len):
    dig = ms.ProteaseDigestion()
    dig.setEnzyme(enzyme)
    dig.setMissedCleavages(missed)
    out = []
    dig.digest(ms.AASequence.fromString(seq_str), out, min_len, max_len)
    return out


def main():
    parser = argparse.ArgumentParser(description="In-silico protein digestion.")
    parser.add_argument("fasta", nargs="?", help="FASTA file (optional if --sequence given)")
    parser.add_argument("--sequence", help="Single protein sequence")
    parser.add_argument("--enzyme", default="Trypsin", help="Protease (default Trypsin)")
    parser.add_argument("--missed", type=int, default=2, help="Max missed cleavages (default 2)")
    parser.add_argument("--min-length", type=int, default=6, help="Min peptide length (default 6)")
    parser.add_argument("--max-length", type=int, default=40, help="Max peptide length (default 40)")
    parser.add_argument("--charges", type=int, nargs="+", default=[1, 2], help="m/z charge states")
    parser.add_argument("--out", help="Output CSV of peptides")
    args = parser.parse_args()
    if any(z <= 0 for z in args.charges):
        parser.error("--charges must contain positive charge magnitudes")

    proteins = []
    if args.fasta:
        if not os.path.exists(args.fasta):
            print(f"Error: file not found: {args.fasta}")
            sys.exit(1)
        proteins = read_fasta(args.fasta)
    elif args.sequence:
        proteins = [("input", args.sequence)]
    else:
        parser.error("provide a FASTA file or --sequence")

    rows = []
    seen = set()
    for prot_id, seq in proteins:
        for pep in digest(seq, args.enzyme, args.missed, args.min_length, args.max_length):
            pep_str = pep.toString()
            key = (prot_id, pep_str)
            if key in seen:
                continue
            seen.add(key)
            mono = pep.getMonoWeight()
            row = {"protein": prot_id, "peptide": pep_str, "length": pep.size(),
                   "mono_mass": round(mono, 5)}
            for z in args.charges:
                row[f"mz_z{z}"] = round((mono + z * PROTON) / z, 5)
            rows.append(row)

    print(f"Proteins: {len(proteins)}  Unique peptides: {len(rows)}")
    for r in rows[:10]:
        print(f"  {r['peptide']}  ({r['length']} aa, {r['mono_mass']} Da)")
    if len(rows) > 10:
        print(f"  ... and {len(rows) - 10} more")

    if args.out:
        import csv
        with open(args.out, "w", newline="") as fh:
            w = csv.DictWriter(fh, fieldnames=list(rows[0].keys()) if rows else ["protein", "peptide"])
            w.writeheader()
            w.writerows(rows)
        print(f"Wrote {args.out}")


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