Combining imaging objects

117 views
Skip to first unread message

Matthew Smith

unread,
Nov 20, 2020, 10:47:27 AM11/20/20
to Cardinal MSI Help
Hi Kylie,

I am having some difficulty combining imaging objects onto a combined m/z axis. My general workflow is:
  • Read in individual imzML files
  • Process individual samples
    • Peakpick
    • peakAlign (30 ppm)
    • peakFilter (0.5)
  • Then generate a common m/z axis
    • I did this myself taking the m/z list of each sample and generating bins based on 30 ppm resolution using mean m/z of each bin forward
  • I then bin onto the common axis
    • peakBin (30 ppm, using common m/z axis from previous step as reference)
  • I then combine the objects once they are all binned to common m/z axis
Unfortunately when I compare the spectra from pre and post binning I am losing lots of information and I do not understand why. Equally when I try using mzBin I get replication of intensity values where there should be 0s.
What I am wanting is rows (m/z values) filled with 0s for m/z features not present in any of the pixels from the given sample (but is present in other samples), for effective combining of objects and downstream processing.

I have created a simplified version of the issue here (note in my dataset the ratio of expected empty rows is much lower):

set.seed(2020)
mse1 <- simulateImage(preset=4, npeaks=10, dim=c(3,3), sdnoise=0.1, peakdiff=1, representation="centroid")

mse2 <- simulateImage(preset=4, npeaks=10, dim=c(3,3), sdnoise=0.1, peakdiff=1, representation="centroid")

mse3 <- simulateImage(preset=4, npeaks=10, dim=c(3,3), sdnoise=0.1, peakdiff=1, representation="centroid")

mzAxis <- sort(c(mz(mse1), mz(mse2), mz(mse3)))

mse1_peakBin <- mse1 %>%
  peakBin(ref=mzAxis,
          tolerance=11,
          units="mz",
          type ="height",
          BPPARAM=SnowParam(workers=4, progressbar=TRUE)) %>%
  process()

mse1_mzBin <- mse1 %>%
  mzBin(ref=mzAxis,
        tolerance=11,
        #resolution=11,
        units="mz",
        fun=max) %>%
  process()


View(spectra(mse1))
View(spectra(mse1_peakBin))
View(spectra(mse1_mzBin))

Could you advice me how to fix this solution? I assume I am misusing the mzBin or peakBin somehow?

Matt










foellm...@gmail.com

unread,
Nov 24, 2020, 9:05:38 AM11/24/20
to Cardinal MSI Help
Hi Matt,

the peakBin works as follows: it takes spectra in profile mode and for each provided reference mz value searches a peak within the given tolerance (mz window), then either extract peak height or peak area from that peak and store this as intensity together with the mz value (--> result is centroided data). It seems you have used the centroided files as input for peakBin and not the original profile spectra, with the latter it should work and look better and it sounds like a solid preprocessing pipeline to me.

For your provided example, when you only have centroided data, instead of peakBin or mzBin use peakAlign to your common reference m/z list for all files, then coerce the obtained processed files into continuous format, combine the files and optionally perform peakFilter on the combined files.

I hope that helps,
Melanie
Reply all
Reply to author
Forward
0 new messages