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

Reading with pronto leads to ValueError: identifier already in use: is_a (Relationship('is_a', name='is a')) #35

Open
Zethson opened this issue Feb 21, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@Zethson
Copy link

Zethson commented Feb 21, 2023

Describe the bug

ValueError: identifier already in use: is_a (Relationship('is_a', name='is a'))

To Reproduce

  1. Use https://github.com/althonos/pronto to create an Ontology using the latest phenio owl file
  2. Ontology(phenio.owl") -> errors out

Expected behavior

No errors

Version

2022-12-13

Additional context

Pretty much every ontology works with pronto so I think that this is an issue on your end.

@Zethson Zethson added the bug Something isn't working label Feb 21, 2023
@caufieldjh
Copy link
Member

caufieldjh commented Feb 21, 2023

Hi @Zethson, thanks for your issue.
Could you provide a bit more context about this error - e.g., are you getting any other errors in parsing phenio?
Could you also see if pronto is able to parse phenio as OBO instead of OWL after transforming with robot:

robot convert -i phenio.owl -o phenio.obo

@matentzn
Copy link
Member

FYI I would have bet all my money that Phenio does not parse with PRONTO, and I am pretty sure many other ontologies don't - PRONTO has a super restrictive object model which covers only a subset of OWL..

We could try to use this ticket as an invitation to further simplify phenio by stripping out certain complexities which just cause problems though..

@caufieldjh
Copy link
Member

Yes, it reminded me of this - althonos/pronto#159
So there's definitely something in phenio that Pronto doesn't like, and it's probably multiple somethings, but part of the issue is how far upstream those issues originate.

@Zethson
Copy link
Author

Zethson commented Feb 22, 2023

Hi @Zethson, thanks for your issue. Could you provide a bit more context about this error - e.g., are you getting any other errors in parsing phenio?

Yeah, the error in the title + above. Besides that just a few warnings.

Could you also see if pronto is able to parse phenio as OBO instead of OWL after transforming with robot:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOf(Arrays.java:3745)
	at java.base/java.lang.AbstractStringBuilder.ensureCapacityInternal(AbstractStringBuilder.java:172)
	at java.base/java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:538)
	at java.base/java.lang.StringBuffer.append(StringBuffer.java:317)
	at java.base/java.io.StringWriter.write(StringWriter.java:106)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.write(FunctionalSyntaxObjectRenderer.java:341)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.writeFullIRI(FunctionalSyntaxObjectRenderer.java:369)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.write(FunctionalSyntaxObjectRenderer.java:364)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.visit(FunctionalSyntaxObjectRenderer.java:1431)
	at org.semanticweb.owlapi.model.IRI.accept(IRI.java:413)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.visit(FunctionalSyntaxObjectRenderer.java:1318)
	at uk.ac.manchester.cs.owl.owlapi.OWLNamedIndividualImpl.accept(OWLNamedIndividualImpl.java:141)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.visit(FunctionalSyntaxObjectRenderer.java:979)
	at uk.ac.manchester.cs.owl.owlapi.OWLObjectPropertyAssertionAxiomImpl.accept(OWLObjectPropertyAssertionAxiomImpl.java:120)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.writeEntity2(FunctionalSyntaxObjectRenderer.java:524)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.writeEntities(FunctionalSyntaxObjectRenderer.java:476)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.writeSortedEntities(FunctionalSyntaxObjectRenderer.java:431)
	at org.semanticweb.owlapi.functional.renderer.FunctionalSyntaxObjectRenderer.visit(FunctionalSyntaxObjectRenderer.java:416)
	at uk.ac.manchester.cs.owl.owlapi.OWLImmutableOntologyImpl.accept(OWLImmutableOntologyImpl.java:1039)
	at uk.ac.manchester.cs.owl.owlapi.concurrent.ConcurrentOWLOntologyImpl.accept(ConcurrentOWLOntologyImpl.java:399)
	at org.semanticweb.owlapi.functional.renderer.OWLFunctionalSyntaxRenderer.render(OWLFunctionalSyntaxRenderer.java:38)
	at org.obolibrary.obo2owl.OwlStringTools.translate(OwlStringTools.java:81)
	at org.obolibrary.obo2owl.OWLAPIOwl2Obo.tr(OWLAPIOwl2Obo.java:325)
	at org.obolibrary.obo2owl.OWLAPIOwl2Obo.convert(OWLAPIOwl2Obo.java:290)
	at org.semanticweb.owlapi.oboformat.OBOFormatRenderer.render(OBOFormatRenderer.java:55)
	at org.semanticweb.owlapi.oboformat.OBOFormatStorer.storeOntology(OBOFormatStorer.java:42)
	at org.semanticweb.owlapi.util.AbstractOWLStorer.store(AbstractOWLStorer.java:99)
	at org.semanticweb.owlapi.util.AbstractOWLStorer.storeOntology(AbstractOWLStorer.java:64)
	at uk.ac.manchester.cs.owl.owlapi.OWLOntologyManagerImpl.saveOntology(OWLOntologyManagerImpl.java:1527)
	at org.obolibrary.robot.IOHelper.saveOntologyFile(IOHelper.java:1752)
	at org.obolibrary.robot.IOHelper.saveOntology(IOHelper.java:866)
	at org.obolibrary.robot.CommandLineHelper.maybeSaveOutput(CommandLineHelper.java:667)

I am afraid that I don't have enough memory. Could somebody else test that?

@matentzn
Copy link
Member

Did you try setting ROBOT_JAVA_ARGS (http://robot.obolibrary.org/global#java-options)?

You could try to use, instead the phenio.json file: https://github.com/monarch-initiative/phenio/releases/tag/2022-12-13

I think pronto supports obographs json.

@Zethson
Copy link
Author

Zethson commented Feb 26, 2023

I am afraid that the json breaks as well:

>>> from pronto import Ontology
>>> ree = Ontology("phenio.json")
<stdin>:1: UnicodeWarning: unsound encoding, assuming utf-8 (99% confidence)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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/obojson.py", line 19, in parse_from
    doc = fastobo.load_graph(handle).compact_ids()
ValueError: graphs[0].nodes[155410].meta.basicPropertyValues[10]: missing field `val` at line 4424695 column 12

@Zethson
Copy link
Author

Zethson commented Feb 26, 2023

I couldn't even convert it with a 16GB heap space limit. I don't have more RAM.

@matentzn
Copy link
Member

I am afraid there won't be any fast solutions - pronto is just too restrictive for this task (obviously, the fact that the obographs json is not parseable is worrying, but we rely mostly on the OWL version for our own purposes). Can you describe what you want to use Phenio for? It may be better to use KG-Phenio (a knowledge graph variant of the ontology) which is shipped as a simple table..

@caufieldjh
Copy link
Member

For the record, these are errors I know are present in the most recent owl version of phenio:

line 3684: <rdfs:comment></rdfs:comment>.
line 3702: <rdfs:comment></rdfs:comment>.
line 16790720: <rdfs:comment></rdfs:comment>.
line 17483611: <oboInOwl:hasNarrowSynonym></oboInOwl:hasNarrowSynonym>.
line 17491178: <oboInOwl:hasRelatedSynonym></oboInOwl:hasRelatedSynonym>.
line 17491194: <oboInOwl:hasRelatedSynonym></oboInOwl:hasRelatedSynonym>.

All are instances of missing value, so they propagate to JSON serializations, too.
The workaround is to remove the lines with something like sed - not a pretty solution, but it works.
Pronto may be producing other errors, of course, since it's very sensitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants