biopragmatics / biolexica

📘 Generate and apply coherent biomedical lexical indices for NER and NEN
MIT License
2 stars 0 forks source link

Error while running lexical match script #15

Closed pfabry closed 7 months ago

pfabry commented 8 months ago

When running the lexical match script described here: https://github.com/biopragmatics/biolexica/tree/main/lexica/obo#readme I've encountered the following error:

KeyError                                  Traceback (most recent call last)
Cell In[13], line 26
     24 for graph in data['graphs']:
     25     for node in sorted(graph['nodes'], key=lambda n: n['id']):
---> 26         if node['type'] == "PROPERTY":
     27             continue
     28         uri = node['id']

KeyError: 'type'

It seems that when loading the json file, the script can't create a dictionnary for the nodes. It happened for now with just one file (gallont.json) while another file (lsdao.json) has been processed without any problem. Both files have been generated with ROBOT convert function.

cthoyt commented 7 months ago

Hi @pfabry, this script was written under the impression that all valid OBO Graph JSON files contain a type in each node. This script is meant as an example that can be adapted for purpose, but I will add an update that removes this check completely (there aren't so many properties to worry about)