kevinkovalchik / RawQuant

RawQuant is a Python package for extracting scan meta data and quantification values from Thermo .raw files.
MIT License
10 stars 2 forks source link

Precursor peak data #4

Closed chrishuges closed 6 years ago

chrishuges commented 6 years ago

RawQuant seems to fail while processing the precursor peak data in the new tune version for the Fusion. I have tested this using the RawFileReaderDevelopment version and the stable release from PyPI.

D:\chughes\quant-report\boxcar>python -m RawQuant parse -d D:\chughes\quant-report\boxcar\ -o 2 -mtx -mgf

Data file: D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw
Instrument: Orbitrap Fusion
Experiment MS order: 2

D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting MS2 retention times
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting MS2 precursor masses
100%|████████████████████████| 21729/21729 [00:00<00:00, 38043.40it/s]
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting MS2TrailerExtra
100%|█████████████████████████| 21729/21729 [00:02<00:00, 8779.67it/s]
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting precursor scan numbers
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting MS1TrailerExtra
100%|███████████████████████████| 1826/1826 [00:00<00:00, 8380.04it/s]
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting MS1LabelData
100%|████████████████████████████| 1826/1826 [00:03<00:00, 463.46it/s]
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting MS1 retention times
D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw: Extracting precursor peak data
  0%|                                       | 0/21729 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:\Users\ptx_user\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\ptx_user\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\ptx_user\AppData\Local\Programs\Python\Python36\lib\site-packages\RawQuant\__main__.py", line 718, in <module>
    data.ToDataFrame(method='parse', parse_order=o)
  File "C:\Users\ptx_user\AppData\Local\Programs\Python\Python36\lib\site-packages\RawQuant\RawQuant.py", line 1540, in ToDataFrame
    self.MS2PrecursorPeaks()
  File "C:\Users\ptx_user\AppData\Local\Programs\Python\Python36\lib\site-packages\RawQuant\RawQuant.py", line 1158, in MS2PrecursorPeaks
    PrecursorElution[scan] = (LeadingRT,TailingRT)
UnboundLocalError: local variable 'LeadingRT' referenced before assignment
Closing D:\chughes\quant-report\boxcar\ch_18May2018_HeLa-InSol_dda-it-box-iso_1.raw
kevinkovalchik commented 6 years ago

Is the error the same in the development and release versions?

kevinkovalchik commented 6 years ago

Okay, so we have been using the ScanEvent precursor mass to get at MSn precursors in MS1 scans. It turns out this is actually the center of the isolation window, so when the isolation window is offset, this number is no good for this purpose. We either need to account for this offset or simply use the monoisotopic M/Z from the TrailerExtra. The precursor mass is used in the "Extracting precursor peak data" step, which is why the error was being thrown.

kevinkovalchik commented 6 years ago

This has been addressed by using the monoisotopic M/Z from the TrailerExtra. This fixes the problem in the master branch. The RawFileReader branch is having some other problems, so is difficult to determine if the problem is fixed there as well. Will keep open until we can confirm this.

chrishuges commented 6 years ago

Ok so this is working for me in Windows 10 now, with boxcar files, as well as with those that use an isolation window offset. I am using the version from the master branch here (the PyPi version still does not work).

Will test on Linux later.

kevinkovalchik commented 6 years ago

The PyPI version hasn't been updated yet. Once we are sure the master branch is working properly I'll update that one.

kevinkovalchik commented 6 years ago

Also, note that the Rawfilereader branch still automatically tries to do boxcar. We're still having problems with boxcar in the new Tune software so testing the files in Linux won't work yet. I'll try to add a switch tomorrow to turn off the automatic boxcar function.

kevinkovalchik commented 6 years ago

Okay, I've added an extra argument to the RawFileReader branch so it won't automatically try to extract the multi-inject window data from boxcar files. The argument is -b. If you don't include this, it doesn't try to extract the window data.

Having this in hand, I've tested a few files which have an offset and the RawFileReader branch seems to be working fine in Windows, at least. Once we know this is also the case in Linux we can close the issue.