MatteoLacki / timspy

Other
16 stars 8 forks source link

ValueError: -1 is not in range #8

Open MichelMoser opened 4 months ago

MichelMoser commented 4 months ago

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 commented 4 months ago

Hi,

Please use opentimspy as described here https://github.com/michalsta/opentims. Unfortunately, timspy code suffers from bitrust and we think of simply getting rid of that branch of the project.

Mateusz Krzysztof Łącki

tel. +49 159 01681376

GitHub: MatteoLacki https://github.com/MatteoLacki

On Mon, May 27, 2024 at 2:16 PM MichelMoser @.***> wrote:

Dear @MatteoLacki https://github.com/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 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

— Reply to this email directly, view it on GitHub https://github.com/MatteoLacki/timspy/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA6H2AEIARFVDGH7JX5EKJDZEMPZRAVCNFSM6AAAAABILCWD62VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMYTSMBSGAZDSMQ . You are receiving this because you were mentioned.Message ID: @.***>