larsyunker / PythoMS

A series of python scripts which aid in the processing and interpretation of mass spectrometric data (formerly Mass-Spec-Python-Tools)
MIT License
34 stars 10 forks source link

Does isotope pattern overlay work on tandem mass spectrometric methods? E.g. neutral loss scan? #25

Open michelleting opened 5 years ago

michelleting commented 5 years ago

I tried this scrip on a neutral loss scan but I got this error message. Would it be a mzml issue since tandem MS method can involve multiple functions?

C:\Users\User\AppData\Local\Programs\Python\Python37\python.exe "C:/Users/User/Documents/GitHub/PythoMS/isotope pattern overlay_MT_data.py"
Data was read from PSI-MS, please cite DOI: 10.1093/database/bat009
Using figure preset "pub"
Traceback (most recent call last):
  File "C:/Users/User/Documents/GitHub/PythoMS/isotope pattern overlay_MT_data.py", line 244, in <module>
    mzml = mzML(spectrum, verbose=False)
  File "C:\Users\User\Documents\GitHub\PythoMS\pythoms\mzml.py", line 422, in __init__
    self.nscans = int(self.tree.getElementsByTagName('spectrumList')[0].getAttribute('count'))  # number of spectra
IndexError: list index out of range

Process finished with exit code 1
michelleting commented 5 years ago

I realized I could copy and paste the spectrum list of NLS to Excel and then run the script with xlsx instead of raw. or mzm. file. I shall update this if it works.

michelleting commented 5 years ago

ok. It worked! Quick question: What does column offset do (line30)? I understand skiplines (line29) and when you paste the spectrum list on Excel, the first column is the m/z values and the second column is the intensity. So I kept 'column_offset = 1' which is the number originally from the script, the png below is what I got and the offset didn't seem to affect the png figure.

MT-NLS-function-2 (Sheet1) C61H51IP3Pd

If users want to generate an isotope pattern overlay figure from a neutral loss scan experiment, they can save the spectrum list on an Excel file instead of using the .raw file or the .mzml file. I'd assume product ion scan data can be done in this way as well.

larsyunker commented 5 years ago

column_offset is for retrieving x,y data from columns that aren't the first and second column. (The same thing as skiplines, but along columns rather than rows.

Could you attach (or send me) the mzML file that you were having difficulty with? I'd like to dig a bit deeper and see what the issue was. Maybe I can modify the code to not have to go through spectrum binner to accomplish this.

Another thing you may want to try is setting 'simtype' to 'gaussian'. This might make a simulated isotope pattern which does a better job of visually matching the observed spectrum.