{"id":21798,"library":"pyteomics","title":"Pyteomics","description":"Pyteomics is a Python framework for proteomics data analysis, providing parsers and tools for common mass spectrometry formats (mzML, mzXML, MGF, etc.) and sequence database handling. Current version 4.7.5 is stable with monthly releases.","status":"active","version":"4.7.5","language":"python","source_language":"en","source_url":"https://github.com/levitsky/pyteomics","tags":["proteomics","mass spectrometry","bioinformatics","mzml","mzxml"],"install":[{"cmd":"pip install pyteomics","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"MzML is not a class; use the mzml module functions (e.g., read, MzML as a reader context).","wrong":"from pyteomics.mzml import MzML","symbol":"MzML","correct":"from pyteomics import mzml"},{"note":"There is no ms1 module; use pyteomics.mass for mass calculations.","wrong":"from pyteomics.ms1 import MS1","symbol":"MS1","correct":"from pyteomics import mass"}],"quickstart":{"code":"from pyteomics import mzml\n\nwith mzml.MzML('example.mzML') as reader:\n    for spectrum in reader:\n        print(spectrum['m/z array'][:5])","lang":"python","description":"Read an mzML file and print first 5 m/z values of each spectrum."},"warnings":[{"fix":"Use 'with mzml.MzML('file') as reader:' pattern.","message":"In version 4.x, the API for mzML reader changed from pyteomics.mzml.MzML to context manager with 'with' statement. Old code using mzml.MzML('file') may break if not wrapped in 'with'.","severity":"breaking","affected_versions":">=4.0"},{"fix":"Use 'from pyteomics import mzml; for spec in mzml.read('file'):' instead.","message":"The 'pyteomics.mzml.MzML' class is deprecated in favor of 'pyteomics.mzml.read' for iteration.","severity":"deprecated","affected_versions":">=4.5"},{"fix":"Use 'reader[('scan', scan_number)]' or 'reader.by_id(scan_number)' to access by scan ID.","message":"Indexing spectra by scan number is not always sequential; use 'by_id' method rather than list index.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use 'from pyteomics import mzml' (not 'pyteomics.MzML' or 'pyteomics.mzML').","cause":"Wrong import path; pyteomics modules are lowercase with no leading underscore.","error":"ModuleNotFoundError: No module named 'pyteomics.mzml'"},{"fix":"Wrap in 'with mzml.MzML('file') as reader:'","cause":"Using 'mzml.MzML()' as a function instead of as a context manager.","error":"TypeError: 'MzML' object is not callable"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}