Spectrum Normalization#

Another very basic mass spectrum processing step is normalization by base peak intensity (the maximum intensity of a mass spectrum).

Let’s first load the raw data.

 1from urllib.request import urlretrieve
 2import pyopenms as oms
 3import matplotlib.pyplot as plt
 4
 5gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
 6urlretrieve(
 7    gh + "/src/data/peakpicker_tutorial_1_baseline_filtered.mzML",
 8    "tutorial.mzML",
 9)
10exp = oms.MSExperiment()
11oms.MzMLFile().load("tutorial.mzML", exp)
12plt.bar(
13    exp.getSpectrum(0).get_peaks()[0],
14    exp.getSpectrum(0).get_peaks()[1],
15    snap=False,
16)

Now we apply the normalization.

 1normalizer = oms.Normalizer()
 2param = normalizer.getParameters()
 3param.setValue("method", "to_one")
 4normalizer.setParameters(param)
 5
 6normalizer.filterPeakMap(exp)
 7plt.bar(
 8    exp.getSpectrum(0).get_peaks()[0],
 9    exp.getSpectrum(0).get_peaks()[1],
10    snap=False,
11)

Another way of normalizing is by TIC (total ion count) of the mass spectrum, which scales intensities so they add up to \(1.0\) in each mass spectrum. Try it out for yourself by setting: param.setValue("method", "to_TIC").