I am having some difficulty combining imaging objects onto a combined m/z axis. My general workflow is:
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?