From 38f16f70c0e5c0cae4cbf253f2482781be408185 Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Wed, 8 Jun 2022 21:40:02 +0300 Subject: [PATCH] Experimental pipeline for extracting classification mismatches Experimental pipeline for extracting classification mismatches with SPARQL --- src/ontology/mondo-ingest.Makefile | 23 +++++++++++++ .../mondo-ordo-unsupported-subclass.sparql | 34 +++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/sparql/mondo-ordo-unsupported-subclass.sparql diff --git a/src/ontology/mondo-ingest.Makefile b/src/ontology/mondo-ingest.Makefile index a9017aaa5..5cc4caf5f 100644 --- a/src/ontology/mondo-ingest.Makefile +++ b/src/ontology/mondo-ingest.Makefile @@ -213,3 +213,26 @@ deploy-mondo-ingest: @test $(GHVERSION) ls -alt $(DEPLOY_ASSETS_MONDO_INGEST) gh release create $(GHVERSION) --notes "TBD." --title "$(GHVERSION)" --draft $(DEPLOY_ASSETS_MONDO_INGEST) + +tmp/mondo-ingest.owl: + wget https://github.com/monarch-initiative/mondo-ingest/releases/latest/download/mondo-ingest.owl -O $@ + +tmp/mondo.owl: + wget http://purl.obolibrary.org/obo/mondo.owl -O $@ + +tmp/mondo.sssom.tsv: + wget http://purl.obolibrary.org/obo/mondo/mappings/mondo.sssom.tsv -O $@ + +tmp/mondo.sssom.ttl: tmp/mondo.sssom.tsv + sssom convert $< -O rdf -o $@ + +# Merge Mondo, precise mappings and mondo-ingest into one coherent whole for the purpose of querying. + +tmp/merged.owl: tmp/mondo.owl tmp/mondo-ingest.owl tmp/mondo.sssom.ttl + $(ROBOT) merge -i tmp/mondo.owl -i tmp/mondo-ingest.owl -i tmp/mondo.sssom.ttl -o $@ + +$(REPORTDIR)/mondo_ordo_unsupported_subclass.tsv: ../sparql/mondo-ordo-unsupported-subclass.sparql + $(ROBOT) query -i tmp/merged.owl --query $< $@ + +.PHONY: mondo-ordo-subclass +mondo-ordo-subclass: $(REPORTDIR)/mondo_ordo_unsupported_subclass.tsv \ No newline at end of file diff --git a/src/sparql/mondo-ordo-unsupported-subclass.sparql b/src/sparql/mondo-ordo-unsupported-subclass.sparql new file mode 100644 index 000000000..aa188ffe5 --- /dev/null +++ b/src/sparql/mondo-ordo-unsupported-subclass.sparql @@ -0,0 +1,34 @@ +PREFIX skos: +PREFIX rdf: +prefix IAO: +prefix rdfs: +prefix oboInOwl: +prefix def: +prefix owl: +PREFIX xsd: + +SELECT distinct ?sub_o1 ?sub_o2 ?super_o1 ?super_o2 ?sub #?source + +WHERE +{ + ?sub_o1 rdfs:subClassOf* ; + rdfs:subClassOf ?super_o1 . + ?sub_o2 a owl:Class ; + rdfs:subClassOf* ; + rdfs:subClassOf ?super_o2 . + ?sub_o1 skos:exactMatch ?sub_o2 . + ?super_o1 skos:exactMatch ?super_o2 . + ?xref_anno a owl:Axiom ; + owl:annotatedSource ?sub_o1 ; + owl:annotatedProperty rdfs:subClassOf ; + owl:annotatedTarget ?super_o1 ; + oboInOwl:source ?source . + + FILTER(STRSTARTS(str(?source), "Orphanet:")) + + FILTER NOT EXISTS { + ?sub_o2 rdfs:subClassOf ?super_o2 . + } + # FILTER(regex(str(?sub),"Orpha")) + FILTER( !isBlank(?sub_o1) && !isBlank(?sub_o2) && !isBlank(?super_o1) && !isBlank(?super_o2)) +} LIMIT 20