-
Notifications
You must be signed in to change notification settings - Fork 8
String entries in STAR field cause ValueError when retrieving any ChebiEntity #20
Copy link
Copy link
Open
Description
It appears that, in the most recent releases of the CheBI database, the "STAR" field contains strings (e.g., "MetaboLights") in addition to integers. This generates a ValueError in _parsers.py (see below for the traceback).
Interestingly, when running the same command a 2nd time, the error does not appear.
Python 3.8.8 (default, Apr 13 2021, 12:59:45)
[Clang 10.0.0 ] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from importlib.metadata import version
>>> version("libchebipy")
'1.0.8'
>>> from libchebipy import ChebiEntity
>>> chebi_comb = ChebiEntity("CHEBI:68481")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/abaryshnikova/Lab/Utils/Packages/miniconda3/envs/yeastphenome_gcp/lib/python3.8/site-packages/libchebipy/_chebi_entity.py", line 30, in __init__
if self.get_name() is None:
File "/Users/abaryshnikova/Lab/Utils/Packages/miniconda3/envs/yeastphenome_gcp/lib/python3.8/site-packages/libchebipy/_chebi_entity.py", line 93, in get_name
name = parsers.get_name(self.__chebi_id)
File "/Users/abaryshnikova/Lab/Utils/Packages/miniconda3/envs/yeastphenome_gcp/lib/python3.8/site-packages/libchebipy/_parsers.py", line 242, in get_name
__parse_compounds()
File "/Users/abaryshnikova/Lab/Utils/Packages/miniconda3/envs/yeastphenome_gcp/lib/python3.8/site-packages/libchebipy/_parsers.py", line 320, in __parse_compounds
else int(tokens[9 if len(tokens) > 9 else 8])
ValueError: invalid literal for int() with base 10: 'MetaboLights'
>>> chebi_comb = ChebiEntity("CHEBI:68481")
>>>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels