psims: A Unified API for Proteomics Standards Initiative Standardized Formats
Have you ever struggled with writing Proteomics Standards Initiative standardized formats for mass spectrometry? Look no further than psims! Psims is a cutting-edge prototype that introduces a unified API for writing standardized formats such as mzML, mzIdentML, and mzMLb. In this article, we will explore the capabilities and benefits of psims and how it simplifies the process of working with these formats.
Simplifying Format Writing with psims
With psims, you no longer need to worry about the intricacies of writing mzML, mzIdentML, or mzMLb formats from scratch. This powerful API abstracts away the complexities, providing a straightforward and declarative approach to format writing. Whether you are a researcher or a developer, psims empowers you to focus on the core of your work, accelerating your progress in proteomics research.
Easy Installation and Setup
Getting started with psims is a breeze. Simply use pip or conda to install psims into your environment, and you are ready to go. The psims documentation provides clear instructions on installation using these package managers, ensuring a seamless setup experience.
Usage Example: Writing mzML
Let’s take a look at a minimal example of writing an mzML file using psims. In this example, we’ll load data and write it to an mzML file:
“`python
from psims.mzml.writer import MzMLWriter
Load the data to write
scans = get_scan_data()
with MzMLWriter(open(“out.mzML”, ‘wb’), close=True) as out:
# Add default controlled vocabularies
out.controlled_vocabularies()
# Open the run and spectrum list sections
with out.run(id=”my_analysis”):
spectrum_count = len(scans) + sum([len(products) for _, products in scans])
with out.spectrum_list(count=spectrum_count):
for scan, products in scans:
# Write Precursor scan
out.write_spectrum(
scan.mz_array, scan.intensity_array,
id=scan.id, params=[
“MS1 Spectrum”,
{“ms level”: 1},
{“total ion current”: sum(scan.intensity_array)}
])
# Write MSn scans
for prod in products:
out.write_spectrum(
prod.mz_array, prod.intensity_array,
id=prod.id, params=[
“MSn Spectrum”,
{“ms level”: 2},
{“total ion current”: sum(prod.intensity_array)}
],
# Include precursor information
precursor_information={
“mz”: prod.precursor_mz,
“intensity”: prod.precursor_intensity,
“charge”: prod.precursor_charge,
“scan_id”: prod.precursor_scan_id,
“activation”: [“beam-type collisional dissociation”, {“collision energy”: 25}],
“isolation_window”: [prod.precursor_mz – 1, prod.precursor_mz, prod.precursor_mz + 1]
})
“`
Citing psims
If you use psims in an academic project, it is important to acknowledge its contribution. Please cite the following paper:
Klein, J. A., & Zaia, J. (2018). psims - A declarative writer for mzML and mzIdentML for Python. Molecular & Cellular Proteomics, mcp.RP118.001070. [https://doi.org/10.1074/mcp.RP118.001070]
Conclusion
With psims, writing Proteomics Standards Initiative standardized formats for mass spectrometry has never been easier. This powerful API streamlines the process, saving you valuable time and effort. Explore the documentation, experiment with the examples, and see how psims can enhance your proteomics research. Feel free to reach out with any questions you may have, and let’s revolutionize the way we work with standardized formats together.
References
- psims Documentation
- psims Repository
- Klein, J. A., & Zaia, J. (2018). psims – A declarative writer for mzML and mzIdentML for Python. Molecular & Cellular Proteomics, mcp.RP118.001070. [https://doi.org/10.1074/mcp.RP118.001070]
Leave a Reply