biolink / biolink-model-toolkit

A collection of useful python functions for looking up information and working with the Biolink Model
https://biolink.github.io/biolink-model-toolkit/
BSD 3-Clause "New" or "Revised" License
20 stars 10 forks source link

Error in get_descendents with curies #154

Open cbizon opened 8 months ago

cbizon commented 8 months ago

v. 1.1.2

If I lookup descendents of noncoding RNA product it works:

tk.get_descendants("noncoding RNA product")
['noncoding RNA product', 'microRNA', 'siRNA']

But if I use the curie form (which came from a response to tk.get_descendents(...,formatted=True)) then it fails:

tk.get_descendants("biolink:NoncodingRNAProduct")
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pydev/pydevconsole.py", line 364, in runcode
    coro = func()
           ^^^^^^
  File "<input>", line 1, in <module>
  File "/opt/anaconda3/envs/redistpf/lib/python3.12/site-packages/bmt/toolkit.py", line 739, in get_descendants
    raise ValueError("not a valid biolink component")
cbizon commented 8 months ago

The types and predicates that I found that have this problem are:

Error with type: biolink:NoncodingRNAProduct
Error with type: biolink:MicroRNA
Error with type: biolink:SiRNA
Error with predicate: biolink:gene_fusion_with
Error with predicate: biolink:genetic_neighborhood_of

I think that on the type side it's not happy when there are consecutive capital letters and on the predicate side when there are underscores in the non-curie name of the predicate. That latter case should probably be changed in the model as well...?