Smoothing#

In many applications, mass spectrometric data should be smoothed first before further analysis

 1from urllib.request import urlretrieve
 2import pyopenms as oms
 3
 4gh = "https://raw.githubusercontent.com/OpenMS/pyopenms-docs/master"
 5urlretrieve(
 6    gh + "/src/data/peakpicker_tutorial_1_baseline_filtered.mzML",
 7    "tutorial.mzML",
 8)
 9
10exp = oms.MSExperiment()
11gf = oms.GaussFilter()
12param = gf.getParameters()
13param.setValue("gaussian_width", 1.0)  # needs wider width
14gf.setParameters(param)
15
16oms.MzMLFile().load("tutorial.mzML", exp)
17gf.filterExperiment(exp)
18oms.MzMLFile().store("tutorial.smoothed.mzML", exp)

We can now load our data into TOPPView to observe the effect of the smoothing, which becomes apparent when we overlay the two files (drag onto each other) and then zoom into a given mass range using Ctrl-G and select \(4030\) to \(4045\):

../_images/smoothing.png

In the screenshot above we see the original data (red) and the smoothed data (black), indicating that the smoothing does clean up noise in the data significantly and will prepare the data for downstream processing, such as peak-picking.