evanyeyeye / rainbow

Read chromatography and mass spectrometry binary files.
GNU General Public License v3.0
29 stars 15 forks source link

More naive questions pertaining to MS results #21

Closed yipy0005 closed 4 months ago

yipy0005 commented 5 months ago
          Hi, sorry but I have just a few more naive questions pertaining to the results.

I have tried to run this:

import rainbow as rb
datadir = rb.read("tests/inputs/green.D")
datafile = datadir.get_file("MSD1.MS")

For datafile.xlabels, there is an array of values from 0.04725 to 147.69308333333333. For datafile.ylabels, there is 1 value in the array, which is 204. And for datafile.data, there is an array of values from 146 to 70968.

If xlabelsare m/z values, then a mass of 0.04725 doesn't correspond to any fragment. Could I ask then, how should I understand the values of xlabels, ylabels and data?

Thank you!

Originally posted by @yipy0005 in https://github.com/evanyeyeye/rainbow/issues/20#issuecomment-2057132359

ekwan commented 5 months ago

From https://rainbow-api.readthedocs.io/en/latest/tutorial.html:

times = datafile.xlabels wavelengths = datafile.ylabels absorbances = datafile.data

If it's MS, then it's masses not wavelengths. Looks like your data is from a SIM experiment.

yipy0005 commented 4 months ago

Hi,

Yes, it's a SIM experiment. Is there any way I can process the datafile.xlabels, datafile.ylabels and datafile.data to provide a table of m/z vs intensity? 😊

ekwan commented 4 months ago

I think the best way to think of the rainbow output is as a data matrix. The x axis is time, the y axis is mass, and the values are ion counts. The labels are the row and column labels. So, you already have the table you want. If you need an explicit table, you can always use pandas to convert the numpy arrays to a dataframe and pass the labels to df.columns and df.index.

On Tue, Apr 16, 2024 at 12:51 AM Yip Yew Mun @.***> wrote:

Hi,

Yes, it's a SIM experiment. Is there any way I can process the datafile.xlabels, datafile.ylabels and datafile.data to provide a table of m/z vs intensity? 😊

— Reply to this email directly, view it on GitHub https://github.com/evanyeyeye/rainbow/issues/21#issuecomment-2058459020, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABOBNIT24TRWQ34R2O2M3ADY5TJ7NAVCNFSM6AAAAABGHTH33KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJYGQ2TSMBSGA . You are receiving this because you commented.Message ID: @.***>