compomics / ms2pip

MS²PIP: Fast and accurate peptide spectrum prediction for multiple fragmentation methods, instruments, and labeling techniques.
https://ms2pip.readthedocs.io
Apache License 2.0
35 stars 18 forks source link

IndexError: Out of bounds on buffer access (axis 0) #223

Open vrkosk opened 3 months ago

vrkosk commented 3 months ago

I'm getting IndexError: Out of bounds on buffer access (axis 0) from ms2pip/core.py when called from MS2PIPFeatureGenerator in MS2Rescore. I'm not sure if the root cause is in MS2PIPFeatureGenerator or MS2PIP itself.

Full stack trace (filepaths edited a bit for clarity)

2024-05-20 13:36:22,179 INFO Processing spectra and peptides...
Traceback (most recent call last):
  File "MS2PIP_debug.py", line 25, in <module>
    main()
  File "MS2PIP_debug.py", line 20, in main
    fgen.add_features(psm_list)
  File "venv\Lib\site-packages\ms2rescore\feature_generators\ms2pip.py", line 194, in add_features
    ms2pip_results = correlate(
                     ^^^^^^^^^^
  File "venv\Lib\site-packages\ms2pip\core.py", line 194, in correlate
    results = ms2pip_parallelized.process_spectra(psm_list, spectrum_file, spectrum_id_pattern)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\ms2pip\core.py", line 557, in process_spectra
    results = self._execute_in_pool(psm_list, _process_spectra, args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\ms2pip\core.py", line 495, in _execute_in_pool
    results = [r.get() for r in mp_results]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\ms2pip\core.py", line 495, in <listcomp>
    results = [r.get() for r in mp_results]
               ^^^^^^^
  File "python\Lib\multiprocessing\pool.py", line 774, in get
    raise self._value
  File "python\Lib\multiprocessing\pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
                    ^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\ms2pip\core.py", line 801, in _process_spectra
    targets = ms2pip_pyx.get_targets(
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "ms2pip\\_cython_modules\\ms2pip_pyx.pyx", line 78, in ms2pip._cython_modules.ms2pip_pyx.get_targets
  File "ms2pip\\_cython_modules\\ms2pip_pyx.pyx", line 107, in ms2pip._cython_modules.ms2pip_pyx.get_targets_general
IndexError: Out of bounds on buffer access (axis 0)

Versions:

psm-utils                    0.8.2
ms2pip                       4.0.0.dev9
ms2rescore                   3.0.3

How to reproduce:

  1. Download the attached MS2PIP_debug.py.
  2. Download and unzip the attached F007590.zip. It contains two files: the MGF file for spectra and a TSV file that is a dump of the PSMList.
  3. Run the script: python MS2PIP_debug.py path/to/F007590_psm_list_utf8.tsv

The script just reads in the TSV file and uses MS2PIPFeatureGenerator with HCD2019. Adjust (or remove) model_dir accordingly. I'm getting the same stack trace with HCD2021, so it's probably model independent.

MS2PIP_debug.zip

F007590.zip