A mass spectrometry package for Julia
MassJ.jl is a general-purpose Julia package for loading, processing, and analysing mass spectrometry data. It is designed to slot into the rest of the Julia ecosystem (Plots.jl, Statistics, DataFrames) rather than to replicate the feature surface of pipelines like OpenMS or pyteomics.
- Read & write open formats — mzML (incl. indexed-mzML), mzXML, MGF, MSP, imzML, plain TXT. mzML output is PSI 1.1.0 schema-validated and accepted by MaxQuant and other downstream tools.
- Signal processing — Savitzky-Golay smoothing, centroiding (SNRA, template-based peak detection), baseline correction (TopHat, LOESS, IPSA).
- Isotopes & deconvolution — chemical-formula parsing, exact/average/ nominal masses, isotopic distribution simulation, UniDec-style charge-state deconvolution.
- Energy-resolved yields — purpose-built pipeline for UVPD / action spectroscopy / CID breakdown: locate peaks, integrate per scan, propagate proper per-scan errors, normalize by TIC and/or photon flux, plot with uncertainty ribbons.
- Native plots — Plots.jl recipes for spectra, chromatograms, and yield curves out of the box.
julia> ]
pkg> add MassJusing MassJ, Plots
scans = load("input.mzML") # → MSrun (a Vector{MSscan} + file metadata)
avg = average(scans, Level(1)) # average all MS1 spectra
clean = baseline_correction(smooth(avg)) # SG smooth + TopHat baseline
plot(clean) # one-line plot
# Save back (indexed mzML by default; MaxQuant-compatible)
save(clean, "processed.mzML")A more substantial workflow — energy-resolved yields for action-spectroscopy data:
peaks = [Peak(110.5, "fragment_a"; tol = 0.5),
Peak(500.05, "precursor"; ppm = 5.0)]
yc = yields("data/UVPD/", peaks; x0 = 3.0, step = 0.1,
xlabel = "photon energy (eV)")
yc = yc |> normalize_tic |> y -> normalize_flux(y, "flux.txt")
plot(yc) # ribbons show per-scan SEM
write_csv(yc, "yields.csv")Full documentation is at ajgiuliani.github.io/MassJ.jl. The manual covers each format, the processing pipeline, the yields workflow, and the reference API.
| Format | Read | Write |
|---|---|---|
| mzML | ✅ | ✅ (indexed) |
| mzXML | ✅ | ✅ |
| MGF | ✅ | — |
| MSP | ✅ | — |
| imzML | ✅ | — |
| TXT | ✅ | — |
If you use MassJ in published work, please cite it via the CITATION.cff metadata at the repository root.
The deconvolution and isotopic-distribution routines are independent re-implementations of published algorithms — please also cite the original work:
- IsoSpec (isotopic distributions): Łącki, M. K.; Startek, M.; Valkenborg, D.; Gambin, A. IsoSpec: Hyperfast Fine Structure Calculator. Anal. Chem. 2017, 89, 3272. Project
- UniDec (charge/mass deconvolution): Marty, M. T.; Baldwin, A. J.; Marklund, E. G.; Hochberg, G. K. A.; Benesch, J. L. P.; Robinson, C. V. Bayesian Deconvolution of Mass and Ion Mobility Spectra: From Binary Interactions to Polydisperse Ensembles. Anal. Chem. 2015, 87, 4370. DOI: 10.1021/acs.analchem.5b00140. Project
- MzXML.jl — older mzXML loader
- julia_mzML_imzML — mzML files loader
- MassSpec.jl — assorted MS utilities
Issues and pull requests are welcome — see CONTRIBUTING.md for the workflow.
GPL-3.0-or-later, see LICENSE.
