obophenotype / upheno

The Unified Phenotype Ontology (uPheno) integrates multiple phenotype ontologies into a unified cross-species phenotype ontology.
https://obophenotype.github.io/upheno/
Creative Commons Zero v1.0 Universal
76 stars 17 forks source link

upheno.owl cannot be parsed with Pronto #919

Open Zethson opened 1 year ago

Zethson commented 1 year ago
Traceback (most recent call last):
  File "/home/zeth/PycharmProjects/bionty/ree.py", line 3, in <module>
    test = Ontology("upheno.owl")
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/ontology.py", line 283, in __init__
    cls(self).parse_from(_handle)  # type: ignore
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/rdfxml.py", line 95, in parse_from
    self.process_imports(
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/base.py", line 70, in process_imports
    return dict(pool.map(lambda i: (i, process(i)), imports))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/base.py", line 70, in <lambda>
    return dict(pool.map(lambda i: (i, process(i)), imports))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/base.py", line 49, in process_import
    return Ontology(url, max(import_depth - 1, -1), timeout)
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/ontology.py", line 283, in __init__
    cls(self).parse_from(_handle)  # type: ignore
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/rdfxml.py", line 95, in parse_from
    self.process_imports(
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/base.py", line 70, in process_imports
    return dict(pool.map(lambda i: (i, process(i)), imports))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/base.py", line 70, in <lambda>
    return dict(pool.map(lambda i: (i, process(i)), imports))
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/parsers/base.py", line 49, in process_import
    return Ontology(url, max(import_depth - 1, -1), timeout)
  File "/home/zeth/miniconda3/envs/bionty/lib/python3.10/site-packages/pronto/ontology.py", line 286, in __init__
    raise ValueError(f"could not find a parser to parse {handle!r}")
ValueError: could not find a parser to parse 'http://purl.obolibrary.org/obo/upheno/upheno_root_alignments.owl'

https://github.com/althonos/pronto is the defacto standard for accessing ontologies in Python. I was using the latest upheno.owl from this repository. Attempting to read it with Pronto also triggered hundreds of warnings.

matentzn commented 1 year ago

https://github.com/althonos/pronto is the defacto standard for accessing ontologies in Python

While I love pronto and its developer @althonos, this is a bit of a misunderstanding - the defacto standard for accessing ontologies in python does not really exist (maybe the "defacto" part, as many people use pronto, but "standard" certainly not, as it is very lossy and does not cover half of the contents of ontologies like uPheno); there is no single python implementation that covers all ontologies. OAK attempts to unify all ontology parsers under one hood, but its still struggling with complex OWL axioms such as the ones in uPheno.

The reference implementation for all ontologies is OWL API, and ROBOT is the (OWLAPI based) tool we use to process our ontologies to make sure they are parseable etc.

That said, which URL do you use to obtain uPheno? we can contemplate to create a simple OBO release for users like yourself, where we drop all the non-OBO conformant axioms..

althonos commented 1 year ago

I second this. pronto is mostly focused on reading Open Biomedial Ontologies, either in OBO format (.obo) or after they have been converted to OWL/XML (.owl), using a reverse-translation that is mostly incomplete (hence the hundred of warnings, which say that pronto doesn't support the parsing of certain constructs, not that the OWL file is broken).

serjoshua commented 1 year ago

I just want to add that loading UPHENO in OLS is having issues. In summary, there is also a failure importing http://purl.obolibrary.org/obo/upheno/upheno_root_alignments.owl.

Linking this to https://github.com/EBISPOT/ols4/issues/453 for reference.

matentzn commented 1 year ago

Thanks @serjoshua, @udp and me are working on migrating upheno as we speak to a newer version, which will take care of this issue