Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General m/z distribution. #6

Open
ranabanik opened this issue Oct 13, 2021 · 2 comments
Open

General m/z distribution. #6

ranabanik opened this issue Oct 13, 2021 · 2 comments

Comments

@ranabanik
Copy link

ranabanik commented Oct 13, 2021

Hello Markus,
It may be difficult for me to explain this as an amateur MSI data analyst. But I will try:

len(np.unique(imze.parser.getspectrum(1)[0])),  \
len(np.unique(imze.parser.getspectrum(10)[0])), \
len(np.unique(imze.parser.getspectrum(10000)[0])), \
len(np.unique(imze.parser.getspectrum(19000)[0])), \
len(np.unique(imze.parser.getspectrum(19818)[0]))

>> (27240, 36755, 23331, 27176, 22426)

len(np.unique(imze.mzValues))

>> 29888

Different spectrum/specID has different numbers of unique m/z values. Though total mzvalues are the same throughout the imze image.

My question is how do I get 2D spatial images for a given or fixed m/z value on different sections/slices of spinal image. According to the data I am working with the m/z values seem to be restricted/ranged within 506~2000 for MALDI-ToF imaging for all slices of the spine.

Thanks a lot.

@mjoppich
Copy link
Owner

Ah, I was already wondering what you guys wanted to do with IMS, coming rather from the MRI field 😃

Indeed, pIMZ assumes that all spectra (in all slides) do have a common mz-range. This makes the life in the analysis much easier, but obviously does not meet reality of the machines.

However, there are several means implemented to circumvent this problem. First, you can call peaks (to_called_peaks), second, you can interpolate your signal (interpolate_data). Otherwise, most IMS machines offer to export raw- or binned spectra when exporting to imzML.

You can contact me at joppich at bio.ifi.lmu.de any time, but beware that in Europe the teaching season just started 😉

@ranabanik
Copy link
Author

Thanks, Markus, I have mailed you.
And about to_called_peaks following this here.

sp2_called, sp2_called_masses = imze.to_called_peaks(np.array([[avg_region_spectrum]]), 
                                                     imze.mzValues, 
                                                     resolution=4)

But I think there is size mismatch with errors:

  File "/home/banikr2/PycharmProjects/pIMZ/pIMZ/imzml.py", line 1015, in to_called_peaks
    assert(len(masses) == region.shape[2])

get_avg_spectrum generates 1D tuple, where to_called_peaks expects region to be a 3D matrix.
I will try calculating avg spectrum over the pixels/scans.

But how to resolve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants