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/export_gnps_sirius.py
View on GitHub#!/usr/bin/env python3
"""
Export for GNPS (FBMN) and SIRIUS
Generate the input files required by downstream annotation tools:
gnps Feature-Based Molecular Networking: writes an MGF of MS2 spectra
(from a consensusXML linked across samples) plus the GNPS
quantification table.
sirius Writes a SIRIUS .ms file (and compound-info TSV) from mzML +
featureXML input for formula/structure elucidation.
Usage:
python export_gnps_sirius.py gnps study.consensusXML --mzml s1.mzML s2.mzML --out-prefix gnps_out
python export_gnps_sirius.py sirius sample.mzML --featurexml sample.featureXML --out sample.ms
"""
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)
def export_gnps(args):
cm = ms.ConsensusMap()
ms.ConsensusXMLFile().load(args.consensus, cm)
print(f"Loaded {cm.size()} consensus features")
mgf_out = f"{args.out_prefix}.mgf"
quant_out = f"{args.out_prefix}_quant.txt"
mapped = [pid for feature in cm for pid in feature.getPeptideIdentifications()
if pid.metaValueExists("map_index") and pid.metaValueExists("spectrum_index")]
if not mapped:
raise ValueError("GNPS export needs MS2 feature annotations (map_index and spectrum_index); plain linked MS1 features are insufficient.")
on_disk = {}
for pid in mapped:
i = int(pid.getMetaValue("map_index"))
if not 0 <= i < len(args.mzml):
raise ValueError("GNPS map_index is outside the supplied mzML list; preserve sample order.")
if i not in on_disk:
run = ms.OnDiscMSExperiment()
if not run.openFile(args.mzml[i]):
raise ValueError("GNPS requires readable indexed mzML files")
on_disk[i] = run
j = int(pid.getMetaValue("spectrum_index"))
if not 0 <= j < on_disk[i].getNrSpectra() or on_disk[i].getSpectrum(j).getMSLevel() != 2:
raise ValueError("GNPS spectrum_index must address an MS2 spectrum in its source map")
ms.GNPSMGFFile().store(args.consensus, args.mzml, mgf_out)
print(f"Wrote {mgf_out}")
ms.GNPSQuantificationFile().store(cm, quant_out)
print(f"Wrote {quant_out}")
print("Upload both to GNPS Feature-Based Molecular Networking.")
def export_sirius(args):
out_ms = args.out or os.path.splitext(args.input)[0] + ".ms"
out_info = args.compound_info or os.path.splitext(out_ms)[0] + "_compounds.tsv"
exporter = ms.SiriusExportAlgorithm()
feature_files = [args.featurexml] if args.featurexml else []
try:
exporter.run([args.input], feature_files, out_ms, out_info)
except RuntimeError as e:
if "SourceFile" in str(e):
print("Error: the mzML lacks proper SourceFile annotation required by SIRIUS export.")
print("This is normal for synthetic/hand-built mzML. Re-export the file through")
print("a suitable converter and verify source format/native-ID metadata before retrying.")
print("Do not fabricate instrument provenance; vendor conversion alone is not a guarantee.")
sys.exit(2)
raise
print(f"Wrote {out_ms}")
print(f"Wrote {out_info}")
print("Run SIRIUS on the .ms file for formula/structure elucidation.")
def main():
parser = argparse.ArgumentParser(description="Export for GNPS FBMN or SIRIUS.")
sub = parser.add_subparsers(dest="mode", required=True)
g = sub.add_parser("gnps", help="Export GNPS FBMN inputs")
g.add_argument("consensus", help="consensusXML linked across samples")
g.add_argument("--mzml", nargs="+", required=True, help="Source mzML files (with MS2)")
g.add_argument("--out-prefix", default="gnps_export", help="Output prefix")
s = sub.add_parser("sirius", help="Export SIRIUS .ms file")
s.add_argument("input", help="mzML file (with MS2)")
s.add_argument("--featurexml", help="Optional featureXML to group spectra")
s.add_argument("--out", help="Output .ms path")
s.add_argument("--compound-info", help="Output compound-info TSV path")
args = parser.parse_args()
if args.mode == "gnps":
export_gnps(args)
else:
export_sirius(args)
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 |