Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: undeclared synonym type with version 2.5.7 #229

Open
ireneisdoomed opened this issue Jul 31, 2024 · 0 comments
Open

ValueError: undeclared synonym type with version 2.5.7 #229

ireneisdoomed opened this issue Jul 31, 2024 · 0 comments

Comments

@ireneisdoomed
Copy link

Observed behaviour
Version 2.5.7 is not capable of loading my OWL file, while 2.5.3 does.

Background
I am one of the developers of Ontoma, a tool that processes the EFO ontology OWL file using pronto.
We are having issues upgrading from version 2.5.3 to 2.5.7, the latest one. Every time I try loading the OWL file, I get this error:
ValueError: undeclared synonym type: http://purl.obolibrary.org/obo/mondo#ABBREVIATION.

Steps to reproduce

  1. Download EFO OWL file from https://github.com/EBISPOT/efo/releases/download/v3.68.0/efo_otar_slim.owl
  2. Install pronto 2.5.7 with pip install pronto==2.5.7
  3. Start iPython session
  4. Import and try to load the ontology
import pronto
ont = pronto.Ontology("efo_otar_slim.owl")
  1. See error

This is not a problem with the ontology, I've tried loading previous versions with the same result.
In fact, it loads just fine when I use an older version of pronto:

  1. Uninstall pronto 2.5.7 and install 2.5.3 pip install pronto==2.5.3
  2. Start iPython session
  3. Import and try to load the ontology
import pronto
ont = pronto.Ontology("efo_otar_slim.owl")

Full traceback is here:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[41], line 1
----> 1 ont = pronto.Ontology("efo_otar_slim.owl")

File /usr/local/lib/python3.11/site-packages/pronto/ontology.py:283, in Ontology.__init__(self, handle, import_depth, timeout, threads)
    281 for cls in BaseParser.__subclasses__():
    282     if cls.can_parse(typing.cast(str, self.path), buffer):
--> 283         cls(self).parse_from(_handle)  # type: ignore
    284         break
    285 else:

File /usr/local/lib/python3.11/site-packages/pronto/parsers/rdfxml.py:119, in RdfXMLParser.parse_from(self, handle, threads)
    117         self._extract_term(class_, curies)
    118     for axiom in tree.iterfind(_NS["owl"]["Axiom"]):
--> 119         self._process_axiom(axiom, curies)
    121 # Update lineage cache with symmetric of `subClassOf`
    122 self.symmetrize_lineage()

File /usr/local/lib/python3.11/site-packages/pronto/parsers/rdfxml.py:822, in RdfXMLParser._process_axiom(self, elem, curies)
    816     type_ = elem_type.text
    818 try:
    819     # recover existing synonym on the entity if there's one already
    820     synonym = next(
    821         s._data()
--> 822         for s in entity.synonyms
    823         if s.description == elem_target.text
    824         and s.scope == _SYNONYMS[property]
    825     )
    826     # update synonym type of existing synonym if we got one
    827     if type_ is not None:

File /usr/local/lib/python3.11/site-packages/pronto/entity/__init__.py:465, in Entity.synonyms(self)
    463 """`frozenset` of `Synonym`: A set of synonyms for this entity."""
    464 ontology, termdata = self._ontology(), self._data()
--> 465 return frozenset(Synonym(ontology, s) for s in termdata.synonyms)

File /usr/local/lib/python3.11/site-packages/pronto/entity/__init__.py:465, in <genexpr>(.0)
    463 """`frozenset` of `Synonym`: A set of synonyms for this entity."""
    464 ontology, termdata = self._ontology(), self._data()
--> 465 return frozenset(Synonym(ontology, s) for s in termdata.synonyms)

File /usr/local/lib/python3.11/site-packages/pronto/synonym.py:133, in Synonym.__init__(self, ontology, syndata)
    131 if syndata.type is not None:
    132     if not any(t.id == syndata.type for t in ontology.synonym_types()):
--> 133         raise ValueError(f"undeclared synonym type: {syndata.type}")
    134 self._data = weakref.ref(syndata)
    135 self.__ontology = ontology

ValueError: undeclared synonym type: http://purl.obolibrary.org/obo/mondo#ABBREVIATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant