kevinkovalchik / RawTools

RawTools is an open-source and freely available package designed to perform scan data parsing and quantification, and quality control analysis of Thermo Orbitrap raw mass spectrometer files from data-dependent acquisition experiments.
Apache License 2.0
64 stars 19 forks source link

System.IndexOutOfRangeException: Index was outside the bounds of the array #64

Closed Nils342 closed 2 years ago

Nils342 commented 3 years ago

Describe the bug Index out of range exception appears when processing individual .Raw file

Description of raw file In other issues I saw a similar issue which appeared to arise due to the fact that the .raw file was generated through direct infusion using a nanomate. The current file is generated in a similar manner.

Command line arguments mono RawTools.exe -f /home/nils/Raw_files_for_RawTools/RES_20210630-NM4.raw -x

Command line output Please paste the entire output from the command line, if applicable (i.e. everything that appeared after you hit enter until things stopped working).

total scans in file: 319

Scans linked: 319

Orphan scans:

None!

All scans accounted for!

======================================================

Extracting reaction events: 100%                                                                                                                                                                           

Unhandled Exception:
System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at RawTools.Algorithms.ExtractData.Extract.MethodData (ThermoFisher.CommonCore.Data.Interfaces.IRawDataPlus rawFile, RawTools.Data.Containers.ScanIndex index) [0x000a4] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
  at RawTools.WorkFlows.WorkFlowsDDA.UniversalDDA (ThermoFisher.CommonCore.Data.Interfaces.IRawFileThreadManager rawFileThreadManager, RawTools.WorkFlows.WorkflowParameters parameters, RawTools.QC.QcDataCollection qcDataCollection) [0x000c8] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
  at RawTools.Program.Run (System.Collections.Generic.Dictionary`2[TKey,TValue] opts) [0x003d3] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
  at RawTools.Program.Main (System.String[] args) [0x000b3] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at RawTools.Algorithms.ExtractData.Extract.MethodData (ThermoFisher.CommonCore.Data.Interfaces.IRawDataPlus rawFile, RawTools.Data.Containers.ScanIndex index) [0x000a4] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
  at RawTools.WorkFlows.WorkFlowsDDA.UniversalDDA (ThermoFisher.CommonCore.Data.Interfaces.IRawFileThreadManager rawFileThreadManager, RawTools.WorkFlows.WorkflowParameters parameters, RawTools.QC.QcDataCollection qcDataCollection) [0x000c8] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
  at RawTools.Program.Run (System.Collections.Generic.Dictionary`2[TKey,TValue] opts) [0x003d3] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 
  at RawTools.Program.Main (System.String[] args) [0x000b3] in <c730371a78ae4258bcdd6e1d76ea91e3>:0 

Screenshots If applicable, add screenshots to help explain your problem.

Desktop & RawTools information:

Additional context I tried to upload the .Raw file as a compressed .zip file though for some reason I get the following error: Is not included in the list.

JonatanFernandez commented 2 years ago

Hello,

I am also getting a similar error, another out of bounds in the array index. Please find attached the screenshot with the error:

image

These are RAW files from a metabolomics experiment but I only wanted the TICs.. (even if I uncheck Parse matrix and Metrics I get the same error)

image

Best regards,

chrishuges commented 2 years ago

Hi,

What is the scan layout in your raw file (e.g. MS and MS/MS scans)? What is the instrument? You are also using the nanoMate?

Thanks, Chris

On Wed, Jan 19, 2022 at 1:47 AM Jonatan Fernández García < @.***> wrote:

Hello,

I am also getting a similar error, another out of bounds in the array index. Please find attached the screenshot with the error:

[image: image] https://user-images.githubusercontent.com/8473895/150105001-e470a428-cca7-4f69-a511-ac3ed2e6f9d5.png

These are RAW files from a metabolomics experiment but I only wanted the TICs.. (even if I uncheck Parse matrix and Metrics I get the same error)

[image: image] https://user-images.githubusercontent.com/8473895/150105546-58acec77-6871-4b86-b06c-91de139f4cb8.png

Best regards,

— Reply to this email directly, view it on GitHub https://github.com/kevinkovalchik/RawTools/issues/64#issuecomment-1016260460, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJGSWI33P34ZRUH674X2KLUW2CBTANCNFSM474HPYBQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

JonatanFernandez commented 2 years ago

Hi Chris,

The layout is only MS1, as in many Metabolomics experiments, were you only run MS/MS for a few samples of the whole batch. The instument is a Thermo Q Exactive... and no nanoMate. The RAW files should will be available in a public DB in a few months.. cannot share until then; but let me know if I can provide you any other info.

Best regards, Jonatan

chrishuges commented 2 years ago

So there are no MS2 scans in the file that is crashing? If so, that is the issue.

chrishuges commented 2 years ago

You mentioned you just wanted the TIC. If you select just 'MS1' and 'TIC' in the GUI it still throws the same error (no selection of other options)?

valli28 commented 2 years ago

We have the same issue, with raw files from a Thermo QQQ and an old QE. Some of our files contain only MS1 scans (we are a chromatography company) and RawTools fails to extract basepeak chromatograms, e.g. with the command: mono RawTools.exe -f FILENAME.raw -chro 1B. Any workaround/what is the cause for this behaviour?

We either get the Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. error or the

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. error.

I've only tested this on Linux, Ubuntu 20 so far. Any suggestions are welcome :)

Thanks Valli

chrishuges commented 2 years ago

Hi,

This is because there is only MS1 scans in the file. RawTools is looking for MS2 by default and doesn’t know what to do when there are none.

We could make an MS1 only mode that just spits out chromatograms, but I would need a file I could test with if someone is willing to provide one.

Thanks, Chris

On Thu, Apr 21, 2022 at 4:28 AM valli28 @.***> wrote:

We have the same issue, with raw files from a Thermo QQQ and an old QE. Some of our files contain only MS1 scans (we are a chromatography company) and RawTools fails to extract basepeak chromatograms, e.g. with the command: mono RawTools.exe -f FILENAME.raw -chro 1B. Any workaround/what is the cause for this behaviour?

We either get the Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. error or the

Unhandled Exception: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. error.

I've only tested this on Linux, Ubuntu 20 so far. Any suggestions are welcome :)

Thanks Valli

— Reply to this email directly, view it on GitHub https://github.com/kevinkovalchik/RawTools/issues/64#issuecomment-1105086895, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJGSWNYERC45JT2ZADNUZLVGE3V3ANCNFSM474HPYBQ . You are receiving this because you commented.Message ID: @.***>

JonatanFernandez commented 2 years ago

I have some files available. How would you like them to be transferred?

Best regards.

chrishuges commented 2 years ago

If you are able to just drop it on google drive or something similar, that would be easiest.

removed my email as I released a version with a fix below.

Thanks!

On Thu, Apr 21, 2022 at 8:19 AM Jonatan Fernández García < @.***> wrote:

I have some files available. How would you like them to be transferred?

Best regards.

— Reply to this email directly, view it on GitHub https://github.com/kevinkovalchik/RawTools/issues/64#issuecomment-1105367935, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJGSWONF4OKSGLH7C3AR33VGFWWFANCNFSM474HPYBQ . You are receiving this because you commented.Message ID: @.***>

chrishuges commented 2 years ago

Please try this pre-release to see if it fixes your issue.

You will use 'ms1 only mode' by using the -ms1 flag along with the -chro flag. Right now that is all that is supported. It works fine for me with files that contain MS2 scans, but I don't have any that only contain MS1 scans so I can't test this. The GUI version should also work if you want to test that as well.

An example command on Linux would be:

mono RawTools.exe -ms1 -f /path/to/your/file.raw -chro 1B

Using the GUI it should stop you from choosing anything you shouldn't. I will add some more error checking in the coming days if this version works. I can also add other feature outputs if desired. Please let me know.

chrishuges commented 2 years ago

I found a random metabolomics file online and it seems it still has some issues with this format. I will keep testing to figure out a solution.

chrishuges commented 2 years ago

OK I updated the files at the release link. This one works with files only containing MS1 scans based on my tests. Let me know if you have issues.

valli28 commented 2 years ago

Wow, thanks for being so responsive and proactive @chrishuges !! We are in vastly different timezones, it would seem, so this correspondence might take a while :D

I also tested the new version in this release link:

OK I updated the files at the release link. This one works with files only containing MS1 scans based on my tests. Let me know if you have issues.

This version works for our QE files, but when I try the same command for a .raw file from a QQQ, I get one of the same errors I mentioned in my previous comment.

We are more than happy to provide an example QQQ .raw file for you if you would be interested. I've uploaded it to a Google Drive folder here: [link removed as issue was solved]

I don't know whether I should have made this a seperate issue, as this is a different error message, but I thought it was the same error until now. I hope it's okay that I just comment for now.

The full error message is as follows:

~/workspace/RawTools/RawTools_204a/RawTools-2.0.4a$ mono RawTools.exe -ms1 -f /home/USER/workspace/RawTools/200fm_BSA_100_FS_01_220409050657.raw -chro 1B

Processing: /home/USER/workspace/RawTools/200fm_BSA_100_FS_01_220409050657.raw

Determing MS analysis order... Done!
Extracting scan indices: 100%                                                                                                                    
Checking for orphaned scans: 100%                                                                                                                

================ Scan indexing report ================

Total scans in file: 1301

Scans linked: 1301

Orphan scans:

None!

All scans accounted for!

======================================================

Extracting reaction events: 0%
Unhandled Exception:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <533173d24dae460899d2b10975534bb0>:0 
  at ThermoFisher.CommonCore.RawFileReader.StructWrappers.Scan.ScanEvent.ThermoFisher.CommonCore.Data.Interfaces.IScanEventBase.GetReaction (System.Int32 index) [0x00006] in <38096e861d444fd896cbda1ff335437f>:0 
  at RawTools.Algorithms.ExtractData.Extract.ScanEvents (ThermoFisher.CommonCore.Data.Interfaces.IRawDataPlus rawFile, RawTools.Data.Containers.ScanIndex index) [0x0005c] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
  at RawTools.WorkFlows.WorkFlowsSurveyScanOnly.UniversalMs1 (ThermoFisher.CommonCore.Data.Interfaces.IRawFileThreadManager rawFileThreadManager, RawTools.WorkFlows.WorkflowParameters parameters) [0x00098] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
  at RawTools.Program.Run (System.Collections.Generic.Dictionary`2[TKey,TValue] opts) [0x0054c] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
  at RawTools.Program.Main (System.String[] args) [0x000bc] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  at System.Collections.Generic.List`1[T].get_Item (System.Int32 index) [0x00009] in <533173d24dae460899d2b10975534bb0>:0 
  at ThermoFisher.CommonCore.RawFileReader.StructWrappers.Scan.ScanEvent.ThermoFisher.CommonCore.Data.Interfaces.IScanEventBase.GetReaction (System.Int32 index) [0x00006] in <38096e861d444fd896cbda1ff335437f>:0 
  at RawTools.Algorithms.ExtractData.Extract.ScanEvents (ThermoFisher.CommonCore.Data.Interfaces.IRawDataPlus rawFile, RawTools.Data.Containers.ScanIndex index) [0x0005c] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
  at RawTools.WorkFlows.WorkFlowsSurveyScanOnly.UniversalMs1 (ThermoFisher.CommonCore.Data.Interfaces.IRawFileThreadManager rawFileThreadManager, RawTools.WorkFlows.WorkflowParameters parameters) [0x00098] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
  at RawTools.Program.Run (System.Collections.Generic.Dictionary`2[TKey,TValue] opts) [0x0054c] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0 
  at RawTools.Program.Main (System.String[] args) [0x000bc] in <4e859c3ff5c04bb7a0c8291f59c0db7a>:0
chrishuges commented 2 years ago

Thank you for sharing your file, it was very helpful. The latest version posted here works for QQQ files in my hands. Please let me know if you have any issues.

Chris

valli28 commented 2 years ago

Hey @chrishuges

No problem, you are the one to thank for these quick responses. I tested your latest version you uploaded. All my QQQ .raw files work so far, with over 300 files tested so far!

Thank you very much!

Valli

chrishuges commented 2 years ago

OK great. I will push these changes in the next official release.

Closing this issue for now as it appears to be solved. If any of the other commenters still have issues, please let me know and we can re-open this.

he-hai commented 1 year ago

81