kuwisdelu / Cardinal

Mass spectrometry imaging toolbox
http://www.cardinalmsi.org
36 stars 14 forks source link

mzBin error: when binned mz list range greater than image data mz range #20

Closed MASHUOA closed 4 months ago

MASHUOA commented 3 years ago

Target mz list: m.z intensities 1 100.0728 1.000000e+02 2 100.3728 6.850653e-03 3 100.4121 1.080176e-05 4 100.6063 1.259239e-04

imdata mz range

imdata An object of class 'MSContinuousImagingExperiment' <28936 feature, 6618 pixel> imaging dataset imageData(1): intensity featureData(0): pixelData(3): 3DPositionX 3DPositionY 3DPositionZ metadata(11): ibd binary type universally unique identifier ... files name processing complete(1): mzBin processing pending(0): run(1): 72hr_01_210408_trim raster dimensions: 82 x 106 x 1 coord(3): x = 1..82, y = 1..106, z = 0..0 mass range: 100.3728 to 997.7062 centroided: NA

if we run:

imdata <- imdata %>%
       mzBin(Target_mz_list$m.z, resolution=10, units="ppm") %>% process()

then error message: processing [mzBin] ... first error: bin limits must be positive

It seems like the bin limits were calculated from the other adjacent mz features surrounding the target mz. and even if the mz tolerance is within the reasonable range, it still gives a c(-inf, mz+tolerance) limits.