-
Notifications
You must be signed in to change notification settings - Fork 2
Centroid_algorithms
MS scans are recorded as a continuous trace where each ion is visualised as a Gaussian peak. MS peak widths are related to the mass analyser resolving power. Accurate masses are obtained via centroid algorithms that will detect in every scans all peaks and calculate for each peak, its position (centre or apex) and maximum intensity. Centroid algorithms allow transforming a profile spectrum to a centroid spectrum where only the position and intensity of each peak is recorded. This permit not only to decrease the size of the file by a factor 10 to 100 but also to obtain an accurate and precise measurement of the position of every peak. Centroid datasets are usually processed by the MS software and are the typical MS bar plots.
The doCentroid method allows transforming a profile dataset to a centroid dataset. doCentroid takes, as parameters, the dataset to process and a method to detect the peaks and calculate keys figure of merits (FOM). Multiple methods can be implemented. At present the possible method is
This algorithm will detect every local maximum, where a local maximum is any data point whose intensity is higher or equal to the intensities of its n closest neighbours on each side. The accurate masses are obtained by fitting the peak maxima and its two neighbours to a polynomial of degree 2. The peak position and intensity are calculated via the parameters of the polynomial.
Example with the CETOFMS urine dataset
For this example, we will use the centroid and profile mzML files. Two Finnee objects are created: myFnnPrf using the profile mzML file and myFnnCtr using the centroid mzML file.
- First, we will compare the BPP from both datasets. We can use
myFnnCtr.Datasets{1}.BPP.plot, However, this does not allow to compare two set of data. In this case, the best way is to extract the BPP data and plot them on the same graph.
BPP_ctr = myFnnCtr.Datasets{1}.BPP.Data;
BPP_prf = myFnnPrf.Datasets{1}.BPP.Data;
plot(BPP_ctr(:,1), BPP_ctr(:,2), 'k')
hold on
plot(BPP_prf(:,1), BPP_prf(:,2), 'r')
hold off
legend('centroid data', 'profile data')

As it can be seen no differences can be observed between the centroid and profile datasets in the base peak profile.
- For a better evaluation, we can compare the scans at a particular time, for example, et 7.2 min,
sptra_ctr7p2 = myFnnCtr.Datasets{1}.getSpectra(7.2).Data;
sptra_prf7p2 = myFnnPrf.Datasets{1}.getSpectra(7.2).Data;
While the MS profile scan at 7.2 mins contains 60512x2 values, the MS centroid scan only contains 2312x2 values. Profile scans are classical continuous plot but the centroid scans should be a discrete representation. In Matlab, the stem representation is ideal for centroid scan.
plot(sptra_prf7p2(:,1), sptra_prf7p2 (:,2), 'k')
hold on
stem(sptra_ctr7p2(:,1), sptra_ctr7p2 (:,2), 'r', 'Marker', 'none')
legend('profile data', 'centroid data')
hold off
legend('centroid data', 'profile data')

As it can bee seen Finnee allows to compare very easily profile and centroid scans (in this case obtain by Bruker). This is very important because poorly separated MS peaks also occur and some algorithms perform poorly in those cases.

- By running the 'LocalMax:n' method we calculate the centroid scansfrom the profile dataset. The Value of n should be between 1 and 3 and is run by:
myFnnPrf = myFnnPrf.doCentroid(1, 'localmax:2');
And we can now compare the centroid dataset obtained by the 'localmax' algorithm.
sptra_ctr7p2 = myFnnCtr.Datasets{1}.getSpectra(7.2).Data;
sptra_prf7p2 = myFnnPrf.Datasets{1}.getSpectra(7.2).Data;
sptra_ctrNew = myFnnPrf.Datasets{2}.getSpectra(7.2).Data;
Note that the new dataset, created by the centroid algorithm is stored in the myFnnPrf object. An unlimited number of datasets can be created within the same object allowing to verify any data transformation.
plot(sptra_prf7p2(:,1), sptra_prf7p2 (:,2), 'k')
hold on
stem(sptra_ctr7p2(:,1), sptra_ctr7p2 (:,2), 'r', 'Marker', 'none')
stem(sptra_ctrNew(:,1), sptra_ctrNew (:,2), 'b', 'Marker', 'none')
hold off
legend('profile data', 'centroid data', 'centroid from localMax')

Up : Basic operation with Dataset
Next : Pure ion profiles and peak list
Previous : Baseline and noise correction
Related to: