Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: -1 is not in range #8

Open
MichelMoser opened this issue May 27, 2024 · 1 comment
Open

ValueError: -1 is not in range #8

MichelMoser opened this issue May 27, 2024 · 1 comment

Comments

@MichelMoser
Copy link

Dear @MatteoLacki ,

I would like to use timspy to dig into TIMS-TOF data and extract features.

Unfortunately, i run into some issues while loading data. It looks like there is a problem to determine the max_frame number.

Does anyone else experience this error?
Any hints in how to resolve this would be highly appreciated.

Thank you,
Michel

script:

import pathlib
from pprint import pprint

from timspy.df import TimsPyDF

path = pathlib.Path('/mnt/NFS/homes/momi/DATA/DIA_NN/EQAE4-Tox_R1_project/3325_Abrin_pure_DIA_Slot2-10_1_10-3-2023_14-10-44.d')
print(path)

D = TimsPyDF(path) # get data handle

print(len(D))

error:

python timspy_test.py 
/mnt/NFS/homes/momi/DATA/DIA_NN/EQAE4-Tox_R1_project/3325_Abrin_pure_DIA_Slot2-10_1_10-3-2023_14-10-44.d
Traceback (most recent call last):
  File "/home/momi/miniconda3/envs/timspy/lib/python3.9/site-packages/pandas/core/indexes/range.py", line 413, in get_loc
    return self._range.index(new_key)
ValueError: -1 is not in range

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/momi/tools/timsdata/examples/py/timspy_test.py", line 10, in <module>
    D = TimsPyDF(path) # get data handle
  File "/home/momi/miniconda3/envs/timspy/lib/python3.9/site-packages/timspy/df.py", line 24, in __init__
    self.frames_no = self.max_frame-self.min_frame+1
  File "/home/momi/miniconda3/envs/timspy/lib/python3.9/site-packages/opentimspy/opentims.py", line 137, in max_frame
    return self.frames["Id"][-1]
  File "/home/momi/miniconda3/envs/timspy/lib/python3.9/site-packages/pandas/core/series.py", line 1112, in __getitem__
    return self._get_value(key)
  File "/home/momi/miniconda3/envs/timspy/lib/python3.9/site-packages/pandas/core/series.py", line 1228, in _get_value
    loc = self.index.get_loc(label)
  File "/home/momi/miniconda3/envs/timspy/lib/python3.9/site-packages/pandas/core/indexes/range.py", line 415, in get_loc
    raise KeyError(key) from err
KeyError: -1


@MatteoLacki
Copy link
Owner

MatteoLacki commented May 27, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants