Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/ontology/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# More information: https://github.com/INCATools/ontology-development-kit/

# Fingerprint of the configuration file when this Makefile was last generated
CONFIG_HASH= 99af76b7f2328471bf0bb6570a80b7c7424e15a85ba9754da8106283b744a2b2
CONFIG_HASH= 95caacb33d47877b4b17c9330f52ac6d80d553c7c3d33b0175b8d1be6c800bbc


# ----------------------------------------
Expand Down Expand Up @@ -154,7 +154,7 @@ custom_robot_plugins:


.PHONY: extra_robot_plugins
extra_robot_plugins:
extra_robot_plugins: $(ROBOT_PLUGINS_DIRECTORY)/upheno.jar


# Install all ROBOT plugins to the runtime plugins directory
Expand All @@ -174,6 +174,9 @@ $(ROBOT_PLUGINS_DIRECTORY)/%.jar:

# Specific rules for supplementary plugins defined in configuration

$(ROBOT_PLUGINS_DIRECTORY)/upheno.jar:
curl -L -o $@ https://github.com/monarch-initiative/monarch-robot-plugins/releases/latest/download/monarch-robot-extensions.jar


# ----------------------------------------
# Release assets
Expand Down Expand Up @@ -1105,4 +1108,4 @@ Updating the repository:
endef
export data

include zp.Makefile
include zp.Makefile
8 changes: 6 additions & 2 deletions src/ontology/zapp/zp-zapp-manual.tsv
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
ID LABEL
ID LABEL
ID Preferred label Label submitter Exact synonym Synonym submitter
ID A skos:preferredLabel >AI dc:contributor A oboInOwl:exactSynonym >AI dc:contributor
ZP:0000711 microencephaly orcid:0000-0002-4142-7153
ZP:0000711 undersized brain orcid:0000-0002-4142-7153
ZP:0003410 macroencephaly orcid:0000-0002-4142-7153
ZP:0003410 oversized brain orcid:0000-0002-4142-7153
4 changes: 4 additions & 0 deletions src/ontology/zp-odk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ pattern_pipelines_group:
dosdp_tools_options: "--obo-prefixes=true --restrict-axioms-to=logical"
ontology: tmp/zp-edit-merged-reasoned.owl
robot_java_args: '-Xmx8G'
robot_plugins:
plugins:
- name: upheno
mirror_from: https://github.com/monarch-initiative/monarch-robot-plugins/releases/latest/download/monarch-robot-extensions.jar
allow_equivalents: asserted-only
documentation:
documentation_system: mkdocs
47 changes: 33 additions & 14 deletions src/ontology/zp.Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -257,24 +257,43 @@ qc:
### ZP ZAPP #################
#############################################

.PHONY: qc-zapp
qc-zapp: zp-zapp.owl tmp/zp-zapp.csv
@echo
@echo "Checking count of entities in ZAPP subset..."
../scripts/zapp_check_subset_count.sh
@echo
mkdir -p $(REPORTDIR)/zapp
$(ROBOT) verify -i $< --queries ../sparql/multiple-labels-violation.sparql -O $(REPORTDIR)/zapp


tmp/zp-zapp-manual.owl: zapp/zp-zapp-manual.tsv
$(ROBOT) template --template $< --output $@
$(ROBOT) template \
--prefix 'orcid: https://orcid.org/' \
--template $< \
--output $@

tmp/zp-zapp.csv: zp.owl ../sparql/zp_zapp_terms.sparql
$(ROBOT) query -f csv -i $< --use-graphs true --query ../sparql/zp_zapp_terms.sparql $@

ANNOTATION_PROPERTIES_ZAPP = rdfs:label IAO:0000115 OMO:0002000 oboInOwl:hasDbXref oboInOwl:hasExactSynonym oboInOwl:hasRelatedSynonym oboInOwl:hasBroadSynonym oboInOwl:hasNarrowSynonym

zp-zapp.owl: zp.owl tmp/zp-zapp.csv tmp/zp-zapp-manual.owl tmp/definitions-matches.owl
$(ROBOT) merge -i zp.owl \
remove -T tmp/zp-zapp.csv --select complement \
remove $(foreach p, $(ANNOTATION_PROPERTIES_ZAPP), --term $(p)) \
--term-file tmp/zp-zapp.csv \
--select complement \
remove --term rdfs:label --select "ZP:*" \
merge -i tmp/zp-zapp-manual.owl \
zp-zapp.owl: zp.owl tmp/zp-zapp.csv tmp/zp-zapp-manual.owl tmp/definitions-matches.owl ../sparql/drop-zfin-labels.ru
$(ROBOT) merge -i $< \
upheno:extract-upheno-relations \
--term-file=tmp/zp-zapp.csv \
--relation UPHENO:0000003 \
merge -i tmp/definitions-matches.owl \
filter \
--term UPHENO:0000003 \
--term-file=tmp/zp-zapp.csv \
--select annotations \
merge -i tmp/zp-zapp-manual.owl \
query \
--update ../sparql/drop-zfin-labels.ru \
--update ../sparql/promote-manual-zapp-labels.ru \
$(SHARED_ROBOT_COMMANDS) \
annotate --link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
--ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
--output $@.tmp.owl && mv $@.tmp.owl $@
annotate \
--annotation dc:description 'A subset of the Zebrafish Phenotype Ontology for use in the ZAPP project.' \
--link-annotation http://purl.org/dc/elements/1.1/type http://purl.obolibrary.org/obo/IAO_8000001 \
--link-annotation http://purl.obolibrary.org/obo/IAO_0000700 http://purl.obolibrary.org/obo/ZP_0000000 \
--ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
--output $@
13 changes: 13 additions & 0 deletions src/scripts/zapp_check_subset_count.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ZAPP_GRAPH_TERMS=$(grep 'owl:Class rdf:about="http://purl.obolibrary.org/obo/ZP_' zp-zapp.owl | sort | uniq)
ZAPP_GRAPH_COUNT=$(echo "$ZAPP_GRAPH_TERMS" | wc -l)

ZAPP_CSV_TERMS=$(grep 'ZP_' ../ontology/tmp/zp-zapp.csv | sort | uniq)
ZAPP_CSV_COUNT=$(echo "$ZAPP_CSV_TERMS" | wc -l)

echo "Expected number of ZAPP terms from CSV: $ZAPP_CSV_COUNT"
echo "Actual number of ZAPP terms in graph: $ZAPP_GRAPH_COUNT"

if [ $ZAPP_GRAPH_COUNT -ne $ZAPP_CSV_COUNT ]
then
exit 1
fi
30 changes: 30 additions & 0 deletions src/sparql/drop-zfin-labels.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PREFIX iao: <http://purl.obolibrary.org/obo/IAO_>
PREFIX infores: <https://w3id.org/biolink/infores/>
PREFIX obo: <http://purl.obolibrary.org/obo/>
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

DELETE {
?entity rdfs:label ?zfinLabel .
?entity obo:IAO_0000115 ?zfinDefinition .
}

INSERT {
[
a owl:Axiom ;
owl:annotatedSource ?entity ;
owl:annotatedProperty oboInOwl:hasExactSynonym ;
owl:annotatedTarget ?zfinLabel ;
oboInOwl:source infores:zfin
]
}

WHERE {
?entity a owl:Class .
?entity rdfs:label ?zfinLabel .
?entity obo:IAO_0000115 ?zfinDefinition .
FILTER(isIRI(?entity) && regex(str(?entity), "ZP_"))
FILTER(STRENDS(?zfinLabel, ", abnormal"))
FILTER(STRSTARTS(?zfinDefinition, "Abnormal(ly)"))
}
25 changes: 25 additions & 0 deletions src/sparql/multiple-labels-violation.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?entity ?label ?source WHERE {
{
SELECT ?entity WHERE {
?entity a owl:Class .
?entity rdfs:label ?_label .
}
GROUP BY ?entity
HAVING(COUNT(?_label) > 1)
}
?entity rdfs:label ?label .
OPTIONAL {
[
a owl:Axiom ;
owl:annotatedSource ?entity ;
owl:annotatedProperty rdfs:label ;
owl:annotatedTarget ?label ;
oboInOwl:source ?source
]
}
}
ORDER BY ?cls
40 changes: 40 additions & 0 deletions src/sparql/promote-manual-zapp-labels.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
PREFIX oboInOwl: <http://www.geneontology.org/formats/oboInOwl#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>

DELETE {
?entity rdfs:label ?originalLabel .
?originalLabelAxiom owl:annotatedProperty rdfs:label .

?entity skos:preferredLabel ?zappLabel .
?zappLabelAxiom owl:annotatedProperty skos:preferredLabel .
}

INSERT {
?entity oboInOwl:exactSynonym ?originalLabel .
?originalLabelAxiom owl:annotatedProperty oboInOwl:exactSynonym .

?entity rdfs:label ?zappLabel .
?zappLabelAxiom owl:annotatedProperty rdfs:label .
}

WHERE {
?entity a owl:Class .
?entity skos:preferredLabel ?zappLabel .
?entity rdfs:label ?originalLabel .

?zappLabelAxiom
a owl:Axiom ;
owl:annotatedSource ?entity ;
owl:annotatedProperty skos:preferredLabel ;
owl:annotatedTarget ?zappLabel .

?originalLabelAxiom
a owl:Axiom ;
owl:annotatedSource ?entity ;
owl:annotatedProperty rdfs:label ;
owl:annotatedTarget ?originalLabel .

FILTER(isIRI(?entity) && regex(str(?entity), "ZP_"))
}
25 changes: 19 additions & 6 deletions src/sparql/zp_zapp_terms.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX oio: <http://www.geneontology.org/formats/oboInOwl#>

SELECT DISTINCT ?class WHERE {
?class a owl:Class .

VALUES ?source {
<http://purl.obolibrary.org/obo/upheno/patterns/abnormalAnatomicalEntity.yaml>
<http://purl.obolibrary.org/obo/upheno/patterns/abnormalHasExtraPartsOfTypeAnatomicalEntityInLocation.yaml>
Expand Down Expand Up @@ -174,8 +172,23 @@ SELECT DISTINCT ?class WHERE {
<http://purl.obolibrary.org/obo/upheno/patterns-dev/wrinkledAnatomicalEntity.yaml>
}

# Reified label axiom
?axiom a owl:Axiom ;
owl:annotatedSource ?class ;
oio:source ?source .
{
?class a owl:Class .

# Reified label axiom
?axiom a owl:Axiom ;
owl:annotatedSource ?class ;
oio:source ?source .
}
UNION
{
?class a owl:Class .

FILTER(
isIRI(?class) &&
(?class = <http://purl.obolibrary.org/ZP_0000000>) ||
(STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/ZFA_")) ||
(STRSTARTS(str(?class), "http://purl.obolibrary.org/obo/GO_"))
)
}
}
Loading