How to increase the number of reference peaks during MSI data processing?

78 views
Skip to first unread message

yonghu...@gmail.com

unread,
Nov 7, 2023, 7:21:00 AM11/7/23
to Cardinal MSI Help
Dear all,

I have difficulty on how to increase the number of reference peaks (or global peaklist) during data processing.

Below is my demo code:

ref <- mse_mean %>%
peakPick(method="mad", SNR=3) %>%
peakAlign(tolerance = 15, units = "ppm") %>%
process()


mse_mean is the mean spectrum across all spectra of the MSI dataset.

I found out that some of my targeted mass features were missing after peakAlignment.  For instance, you see that after peak peaking and alignment, the peak m/z 511 is dropped in the MSI data. I have tested on several different MSI datasetS, I always see some peaks with low intensities are missing.

I have tried to decrease the SNR in peakPick() function and played with the parameters in peakAlign() function, but I did not see much improvements. 

I guess it might due to the peakAlign() function, because it uses summarize() to calculate the mean spectrum, and then uses the local maxima of the mean spectrum as the reference. Such calculation is strict, which leads to the dropping of many minor peaks. 

Is there a way (or parameters) that could help to increase the number of reference peaks?

Thanks a lot for your help.

Yonghui

My session info:
--------------------------------------------------------------------------------------------------------------------------

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.2.1

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] Cardinal_3.3.3      S4Vectors_0.38.1    EBImage_4.42.0      BiocParallel_1.34.2 BiocGenerics_0.46.0 ProtGenerics_1.32.0

loaded via a namespace (and not attached):
 [1] Matrix_1.6-1      matter_2.3.18     compiler_4.3.1    Biobase_2.60.0    bitops_1.0-7      parallel_4.3.1    signal_0.7-7      png_0.1-8        
 [9] yaml_2.3.7        fastmap_1.1.1     lattice_0.21-8    biglm_0.9-2.1     knitr_1.43        htmlwidgets_1.6.2 MASS_7.3-60       snow_0.4-4      
[17] fftwtools_0.9-11  DBI_1.1.3         tiff_0.1-11       rlang_1.1.1       sp_2.0-0          xfun_0.40         viridisLite_0.4.2 cli_3.6.1        
[25] magrittr_2.0.3    digest_0.6.33     grid_4.3.1        locfit_1.5-9.8    rstudioapi_0.15.0 irlba_2.3.5.1     mclust_6.0.0      nlme_3.1-163    
[33] evaluate_0.21     codetools_0.2-19  abind_1.4-5       RCurl_1.98-1.12   rmarkdown_2.24    jpeg_0.1-10       tools_4.3.1       htmltools_0.5.6  


AfterAlignment.png
RawData.png

yonghu...@gmail.com

unread,
Nov 19, 2023, 10:17:09 AM11/19/23
to Cardinal MSI Help
Dear all,

I would like to share an update regarding my previous question.

After downgrading the packages Cardinal (from version 3.3.3 to 3.2.1) and matter (from version 2.3.18 to 2.2.20), I reprocessed the identical MSI dataset using the same parameters. The outcome was a significant increase - I observed 10 times more mass features.

I suspect there might be a bug in the latest Cardinal version. Has anyone else encountered a similar issue? I prefer to use the new version because the data processing sppeed is much faster.

Best regards,

Yonghui

kbemis

unread,
Nov 19, 2023, 10:36:35 AM11/19/23
to Cardinal MSI Help
The preprocessing methods have not changed in the current version. Importing imzML has been updated though. Can you confirm if the dataset is the same when first loaded or is there a different number of mass features initially?

yonghu...@gmail.com

unread,
Nov 22, 2023, 10:17:08 AM11/22/23
to Cardinal MSI Help
Dear Kylie,

I confirm that the dataset is identical. I have also tested on the MALDI imaging data obtained from mouse urinary bladder tissue (https://www.ebi.ac.uk/pride/archive/projects/PXD001283). The number of reference peaks are also different between the two cardinal versions. 

Below is my script:

mse <- readMSIData("HR2MSI.imzML", mass.range=c(400,1000), resolution=10, units="ppm")
mse_mean <- summarizeFeatures(mse, FUN="mean")

ref <- mse_mean %>%
  peakPick(method="mad",SNR=4) %>%
  peakAlign("mean", tolerance=20, units="ppm") %>%
  peakFilter() %>%
  process()
ref

Result for Cardinal version 3.3.3 and matter version 2.3.18:

An object of class 'MSProcessedImagingExperiment'

  <309 feature, 1 pixel> imaging dataset

    imageData(1): intensity

    featureData(2): count freq

    pixelData(1): FUN

    processing complete(3): peakPick peakAlign mzFilter

    processing pending(0):

    run(1): 1

    raster dimensions: 1 x 1

    coord(2): x = 1..1, y = 1..1

    mass range: 403.0434 to 994.1133 

    centroided: TRUE 


Result for Cardinal version 3.2.1 and matter version 2.2.20:

An object of class 'MSProcessedImagingExperiment'

  <404 feature, 1 pixel> imaging dataset

    imageData(1): intensity

    featureData(2): count freq

    pixelData(1): FUN

    processing complete(3): peakPick peakAlign mzFilter

    processing pending(0):

    run(1): 1

    raster dimensions: 1 x 1

    coord(2): x = 1..1, y = 1..1

    mass range: 403.0417 to 995.1131 

    centroided: TRUE 


The resulting number of reference peaks are quite different.

Thanks a lot for your help.

Best regards,

Yonghui

kbemis

unread,
Nov 22, 2023, 3:27:01 PM11/22/23
to Cardinal MSI Help
Thanks. Looks like this was an unintended side-effect to changes in how the default reference peaks are detected in the mean spectrum.

I've reverted a change in 3.4.3 that filtered out low-intensity peaks from the reference peaks, so the reference peak list should be larger again.

Some differences may remain due to changes in how the peak boundaries are calculated. (The newer method is more conservative to avoid overlapping peak boundaries.)
Reply all
Reply to author
Forward
0 new messages