pyOpenMS

raw JSON →
3.5.0 verified Sat May 09 auth: no python

pyOpenMS is the Python wrapper for OpenMS, a C++ library for LC-MS data analysis and computational proteomics. Current version 3.5.0. Release cadence is approximately bi-annual.

pip install pyopenms
error ImportError: No module named pyopenms
cause Library not installed or installed in wrong environment.
fix
Run pip install pyopenms in your active Python environment. Ensure you are using Python 3.7+.
error OSError: libOpenMS.so: cannot open shared object file
cause Missing OpenMS C++ runtime libraries (on Linux/macOS).
fix
Install pyopenms via conda: conda install -c conda-forge pyopenms. This resolves shared library dependencies.
gotcha Library is large and can take a long time to install or import; first import may appear to hang.
fix Be patient; pre-built wheels are available on PyPI for many platforms. Use a virtual environment.
gotcha Some functions accept C++ types directly; passing Python lists of strings may fail silently or raise cryptic errors.
fix Use pyopenms types like StringList or std::vector wrappers when expected.

Load an mzML file and count MS2 spectra.

from pyopenms import MSExperiment, MZMLFile

exp = MSExperiment()
MZMLFile().load("input.mzML", exp)
print(f"Number of spectra: {exp.size()}")
ms2 = [s for s in exp if s.getMSLevel() == 2]
print(f"Number of MS2 spectra: {len(ms2)}")