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/mass_calculator.py
View on GitHub#!/usr/bin/env python3
"""
Mass & Chemistry Calculator
Compute masses and isotope distributions for peptides (amino-acid sequences),
empirical formulas, or both. Reports monoisotopic and average mass, m/z for a
range of charge states, the molecular formula, and the theoretical isotope
pattern.
Usage:
python mass_calculator.py --peptide DFPIANGER
python mass_calculator.py --peptide "PEPTIDEM(Oxidation)K" --charges 1 2 3
python mass_calculator.py --formula C6H12O6 --isotopes 5
python mass_calculator.py --peptide DFPIANGER --isotopes 6 --csv iso.csv
"""
import argparse
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 report_isotopes(formula, n, csv=None):
gen = ms.CoarseIsotopePatternGenerator(n)
dist = formula.getIsotopeDistribution(gen)
print(f"\nIsotope pattern (top {n}):")
rows = []
for iso in dist.getContainer():
mz = iso.getMZ()
prob = iso.getIntensity()
print(f" neutral mass {mz:.4f} Da rel.abundance {prob*100:6.2f}%")
rows.append((mz, prob))
if csv:
import csv as csvmod
with open(csv, "w", newline="") as fh:
w = csvmod.writer(fh)
w.writerow(["mass", "rel_abundance"])
w.writerows(rows)
print(f"Wrote {csv}")
def main():
parser = argparse.ArgumentParser(description="Compute masses and isotope distributions.")
parser.add_argument("--peptide", help="Amino-acid sequence (TPP/OpenMS mod syntax allowed)")
parser.add_argument("--formula", help="Empirical formula, e.g. C6H12O6")
parser.add_argument("--charges", type=int, nargs="+", default=[1, 2, 3],
help="Charge states for m/z (default 1 2 3)")
parser.add_argument("--isotopes", type=int, default=0, help="Number of isotope peaks to report")
parser.add_argument("--negative", action="store_true", help="Report negative-mode m/z")
parser.add_argument("--csv", help="Write isotope pattern to CSV")
args = parser.parse_args()
if any(z <= 0 for z in args.charges):
parser.error("--charges must contain positive charge magnitudes")
if not args.peptide and not args.formula:
parser.error("provide --peptide and/or --formula")
sign = -1 if args.negative else 1
if args.peptide:
seq = ms.AASequence.fromString(args.peptide)
formula = seq.getFormula()
mono = seq.getMonoWeight()
avg = seq.getAverageWeight()
print(f"Peptide: {seq.toString()}")
print(f"Formula: {formula.toString()}")
print(f"Monoisotopic mass: {mono:.5f}")
print(f"Average mass: {avg:.5f}")
for z in args.charges:
mz = (mono + sign * z * PROTON) / z
print(f" [M{'+' if not args.negative else '-'}{z}H]{'+' if not args.negative else '-'} m/z = {mz:.5f} (z={z})")
if args.isotopes:
report_isotopes(formula, args.isotopes, args.csv if not args.formula else None)
if args.formula:
formula = ms.EmpiricalFormula(args.formula)
print(f"\nFormula: {formula.toString()}")
print(f"Monoisotopic mass: {formula.getMonoWeight():.5f}")
print(f"Average mass: {formula.getAverageWeight():.5f}")
for z in args.charges:
mz = (formula.getMonoWeight() + sign * z * PROTON) / z
print(f" m/z = {mz:.5f} (z={z})")
if args.isotopes:
report_isotopes(formula, args.isotopes, args.csv)
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 |