How to combine multiple MSI datasets acquired in centroid mode?

44 views
Skip to first unread message

yonghu...@gmail.com

unread,
Apr 10, 2024, 10:11:25 AMApr 10
to Cardinal MSI Help
Dear all,

I have several MSI datasets acquired with a Thermo MALDI-LTQ-Orbitrap XL in centroid mode. Please see the demo files here: https://drive.google.com/drive/folders/1FnLTYzeRl6Pupqe37iJON2jcWKW_W6e-

I have set the identical mass resolution and mass range when reading the files, however, the resulting mz values and number of mz values were still different among the MSI data, and as such I was unable to combine the files. 

Please see the demo code below:

library(Cardinal)
mse1 <- readMSIData(file = "Test/06_20_ven_cru_pos_rep1.imzML", 
                    resolution = 10,
                    units = "ppm"
                    mass.range = c(310, 890)
                    )
mse2 <- readMSIData(file = "Test/06_20_ner_cru_pos_rep1.imzML", 
                    resolution = 10,
                    units = "ppm",
                    mass.range = c(310, 890)
                    )
all.equal(mz(mse1), mz(mse2))

[1] "Numeric: lengths (19971, 19580) differ

What I did was to use the mean spectrum of one of the MSI data as a reference, and aligned all other MSI files to the reference. With this approach, I could successfully combine all MSI files.

Please see the demo code below: 

library(Cardinal)
#(1) Read files
path <- list.files("Test/", pattern = ".imzML", full.names=TRUE, recursive=TRUE)
mse <- vector(mode="list", length=length(path))
for(i in 1:length(path)){
  mse[[i]] <- readMSIData(file = path[i],
                          resolution = 10,
                          units = "ppm"
                          )
}

#(2) Set reference peaks, here I use the first MSI data
ref <- summarizeFeatures(mse[[1]], FUN="mean") %>%
  peakPick(method="mad",SNR=3) %>%
  peakAlign("mean", tolerance=15, units="ppm") %>%
  peakFilter() %>%
  process()

#(3) Align MSI data to the reference peaks
mse_aligned <- vector(mode="list", length=length(path))
for(i in 1:length(mse)){
  mse_aligned[[i]] <- mse[[i]] %>%
    normalize(method="tic") %>%
    peakBin(ref=mz(ref), tolerance=15, units="ppm") %>%
    process()
}

#(4) Combine aligned MSI data
MSIData <- do.call(Cardinal::cbind, mse_aligned)


I am wondering why readMSIData() function did not yield identical m/z values for raw centroid MSI datasets? Is this a bug? 

Are there alternative approaches to efficiently combine MSI datasets acquired in centroid mode?

Thank a lot.

Yonghui Dong

kbemis

unread,
Apr 10, 2024, 10:44:28 AMApr 10
to Cardinal MSI Help
It isn't exactly a bug. It is because if centroided peaks are stored in "processed" imzML, they still need to be aligned. readMSIData() attempts to align them (which is why the mass.range and resolution you provided gets ignored), but each dataset may be aligned slightly differently.

What you have works for now, and there isn't a substantially easier way to handle it in the current release version. This should get easier to handle in the new version coming next month.

-Kylie
Reply all
Reply to author
Forward
0 new messages