ontodev / robot

ROBOT is an OBO Tool
http://robot.obolibrary.org
BSD 3-Clause "New" or "Revised" License
261 stars 74 forks source link

Need help migrating OORT dependencies to ROBOT #450

Closed matentzn closed 5 years ago

matentzn commented 5 years ago

I need some urgent assistance with the following. Check this class in an OWL ontology:

# Class: <http://purl.obolibrary.org/obo/HP_0100843> (obsolete Glioblastoma)

AnnotationAssertion(<http://purl.obolibrary.org/obo/IAO_0100001> <http://purl.obolibrary.org/obo/HP_0100843> "HP:0012174"^^xsd:string)
AnnotationAssertion(<http://www.geneontology.org/formats/oboInOwl#creation_date> <http://purl.obolibrary.org/obo/HP_0100843> "2011-06-09T06:47:23Z"^^xsd:string)
AnnotationAssertion(<http://www.geneontology.org/formats/oboInOwl#id> <http://purl.obolibrary.org/obo/HP_0100843> "HP:0100843"^^xsd:string)
AnnotationAssertion(rdfs:label <http://purl.obolibrary.org/obo/HP_0100843> "obsolete Glioblastoma"^^xsd:string)
AnnotationAssertion(owl:deprecated <http://purl.obolibrary.org/obo/HP_0100843> "true"^^xsd:boolean)

if I run OORT with this command:

ontology-release-runner --catalog-xml catalog-v001.xml --ignoreLock --no-subsets --skip-release-folder --outdir build --simple --skip-ontology-checks --allow-overwrite --no-reasoner $<

I get as a result and OBO file that contains the following class:

[Term]
id: HP:0100843
name: obsolete Glioblastoma
is_obsolete: true
replaced_by: HP:0012174
creation_date: 2011-06-09T06:47:23Z

If I run this with ROBOT:

$(ROBOT) convert --check false -i $(ONT).owl -f obo -o $(ONT).obo

This term disappears in the owl-axioms section of the OBO file for some reason, which we strip out from the obo file. In order to move forward with HP, MP, DPO, WBP and FYPO, I need to find a way to get these terms to show up in the obo file in exactly the same way as they did with OORT.

AFAICS, diffing the hp.obo generated by OORT and ROBOT, 80-90% of the difference comes from these obsolete terms.

@rctauber suggests, and I agree, that this could be due to two reasons: 1) the replaced_by (IAO_0100001) relation is not truly OBO, and therefore ignored (and pushed by the OWLAPI to the owl-axioms part of the ontology). 2) The entity on the other side of the annotation is not interpreted as a string, but as an IRI of sorts, making this an individual which catapults the class again out of OBO (less likely)

Either way; at this point, I don't care whether we need to add a nasty hack to solve this; but I really need help with this asap, or else I will be forced to put OORT back into ODK, and generate these files with OORT (which I really, really dont want).

@cmungall @jamesaoverton @dosumis

dosumis commented 5 years ago

@rctauber suggests, and I agree, that this could be due to two reasons: the replaced_by (IAO_0100001) relation is not truly OBO, and therefore ignored (and pushed by the OWLAPI to the owl-axioms part of the ontology).

@cmungall is this AP not part of the OBO to OWL translation in the OWL-API?

matentzn commented 5 years ago

Does anyone have any idea what could be done? Or who else we could ask?

cmungall commented 5 years ago

You have no class declaration in the original OWL, see http://owlcollab.github.io/oboformat/doc/obo-syntax.html#5.1

cmungall commented 5 years ago

I need to understand the broader context - why do you have a class with a missing declaration in the first place? Is this an example from an OWL file in the wild? We should figure out how this happened as there is information loss here that is going to lead to unwanted results one way or another.

I think OORT is a red herring here. It seems it is probably injecting something that directly or indirectly leads to the owl object being declared as a class.

It is odd that we don't get any owl-axioms in the header, but this would be an owlapi obo writer bug and not robot

matentzn commented 5 years ago

Oh my god this pointed me to the problem.. Thanks. Forget about it for now, need to investigate more. I was piping an already obo-ed file to be annotated and then to be exported again at obo - which seem to have caused the above issue. I will investigate tomorrow and report then. Thanks for the help :)

matentzn commented 5 years ago

(and the owl-axioms: we strip them out with regex by design)

matentzn commented 5 years ago

Yeah, so, after all, it was not a problem of the owl 2 obo conversion. The problem happened when I tried to robot annotate a file that was already in obo format with something:

$(ONT).obo: $(ONT)-simple-non-classified.obo #obo source
    $(ROBOT) annotate --input $< --ontology-iri $(URIBASE)/$@ --version-iri $(ONTBASE)/releases/$(TODAY) \
        convert --check false -f obo $(OBO_FORMAT_OPTIONS) -o $@

This makes some stuff that was correct in $(ONT)-simple-non-classified.obo suddenly be pushed into the owl-axioms section. This is not a high priority issue for me anymore; you can create a new one if you want to investigate further, or wait until someone else complains. Thank you all for the support and sorry for being not thorough enough in diagnosis :P