From 0bf4fd650895256b3f51069ee0771dd07eaae023 Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Sun, 7 Apr 2024 19:48:28 +0300 Subject: [PATCH 1/5] Add pipeline to add uPheno relations more directly --- .github/workflows/qc.yml | 10 +++--- .gitignore | 3 +- src/ontology/Makefile | 7 +++-- src/ontology/phenio-odk.yaml | 6 ++++ src/ontology/phenio.Makefile | 59 +++++++++--------------------------- 5 files changed, 33 insertions(+), 52 deletions(-) diff --git a/.github/workflows/qc.yml b/.github/workflows/qc.yml index 268f5be..d5e641e 100644 --- a/.github/workflows/qc.yml +++ b/.github/workflows/qc.yml @@ -5,10 +5,10 @@ name: CI # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the main branch - # push: - # branches: [ main ] - # pull_request: - # branches: [ main ] + push: + branches: [ main ] + pull_request: + branches: [ main ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -29,5 +29,5 @@ jobs: - name: Run ontology QC checks env: DEFAULT_BRANCH: main - run: cd src/ontology && make ROBOT_ENV='ROBOT_JAVA_ARGS=-Xmx6G' test IMP=false PAT=false MIR=false + run: cd src/ontology && make ROBOT_ENV='ROBOT_JAVA_ARGS=-Xmx6G' test IMP=false PAT=false diff --git a/.gitignore b/.gitignore index b2f2d32..fa00605 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ src/patterns/data/**/*.txt src/patterns/pattern_owl_seed.txt src/patterns/all_pattern_terms.txt -src/ontology/components/*.owl \ No newline at end of file +src/ontology/components/*.owl +src/ontology/debug.log diff --git a/src/ontology/Makefile b/src/ontology/Makefile index 0cce16c..93dd056 100644 --- a/src/ontology/Makefile +++ b/src/ontology/Makefile @@ -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= ff6f93caf8c93bf6c4c5c663944a984e193688503d790d719a90a5de2d147045 +CONFIG_HASH= a885d51b8ca7abe5f5f1f62ea05de8d036cffc2816cfc791eb9c06350d4d14d6 # ---------------------------------------- @@ -121,7 +121,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 @@ -141,6 +141,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/download/v0.0.1/monarch-robot-extensions-0.0.1.jar + # ---------------------------------------- # Release assets diff --git a/src/ontology/phenio-odk.yaml b/src/ontology/phenio-odk.yaml index e889d98..f7da735 100644 --- a/src/ontology/phenio-odk.yaml +++ b/src/ontology/phenio-odk.yaml @@ -163,3 +163,9 @@ robot_report: documentation: documentation_system: mkdocs + +robot_plugins: + plugins: + - name: upheno + mirror_from: https://github.com/monarch-initiative/monarch-robot-plugins/releases/download/v0.0.1/monarch-robot-extensions-0.0.1.jar + diff --git a/src/ontology/phenio.Makefile b/src/ontology/phenio.Makefile index 22a8359..da06d09 100644 --- a/src/ontology/phenio.Makefile +++ b/src/ontology/phenio.Makefile @@ -26,43 +26,22 @@ $(TMPDIR)/$(ONT)-full-unreasoned.owl: $(SRC) $(OTHER_SRC) $(EXPLAIN_OUT_PATH): $(TMPDIR)/$(ONT)-full-unreasoned.owl $(ROBOT) explain -i $< -M unsatisfiability --unsatisfiable random:10 --explanation $@ -$(TMPDIR)/$(ONT)-full.owl: $(TMPDIR)/$(ONT)-full-unreasoned.owl - #$(ROBOT) reason --input $< \ - # --reasoner ELK --equivalent-classes-allowed all --exclude-tautologies structural \ - # relax \ - # reduce -r ELK \ - # $(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@ - $(ROBOT) relax --input $< \ - $(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@.tmp.owl && mv $@.tmp.owl $@ - -$(SUBQ_QUERY_RESULT_PATH): $(TMPDIR)/$(ONT)-full.owl - #echo "Finding subq patterns based on $(SUBQ_QUERY_PATH)..." - $(ROBOT) query --input $< --tdb true --format 'owl' --query $(SUBQ_QUERY_PATH) $@ - -$(UPDATE_QUERY_PATH): $(SUBQ_QUERY_RESULT_PATH) - #echo "Creating update query..." - awk -v RS= 'NR==1' $(SUBQ_QUERY_PATH) > $@ - tail -n +3 $<| sed -e '/./!Q' -e 's/@prefix/PREFIX/g' -e 's/.$$//' >> $@ - printf '\nINSERT DATA\n{' >> $@ - sed -n '/rdfs:subClassOf/,$$p' $< >> $@ - printf '\n}' >> $@ - grep subClassOf $@ | wc -l - -$(ONT)-full.owl: $(TMPDIR)/$(ONT)-full.owl $(UPDATE_QUERY_PATH) - #echo "Running update query for subq patterns..." - $(ROBOT) query --input $< --format 'owl' --update $(UPDATE_QUERY_PATH) --temporary-file 'true' annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output $@ - #echo "Completed update with subq patterns." - ### Merge Biolink Model categories $(BLMODEL): wget $(BLMODEL_URL) -O $@ -$(ONT).owl: $(ONT)-full.owl $(BLMODEL) - $(ROBOT) merge --input $< --input $(BLMODEL) \ - query --update $(BLQUERY) \ - unmerge --input $(BLMODEL) \ - annotate --ontology-iri $(URIBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \ - convert -o $@.tmp.owl && mv $@.tmp.owl $@ +$(ONT)-full.owl: $(TMPDIR)/$(ONT)-full-unreasoned.owl | all_robot_plugins + $(ROBOT) merge --input $< \ + upheno:extract-upheno-relations --root-phenotype UPHENO:0001001 --relation UPHENO:0000003 --relation UPHENO:0000001 \ + relax \ + merge --input $(BLMODEL) \ + query --update $(BLQUERY) \ + unmerge --input $(BLMODEL) \ + annotate --ontology-iri $(URIBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \ + convert -o $@.tmp.owl && mv $@.tmp.owl $@ + +tmp/diff.txt: $(ONT).owl $(ONT)-old.owl + $(ROBOT) diff --left $< --right $(word 2,$^) --format txt -o $@ ### Get full entailment with relation-graph ### First, make a minimal version @@ -91,17 +70,9 @@ $(ONT)-relation-graph.tsv: $(MINIMAL_PATH) --obo-prefixes true \ --verbose true -# base-plus. No externally imported axioms, but reasoning is performed. -$(ONT)-base-plus.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES) - $(ROBOT_RELEASE_IMPORT_MODE) \ - reason --reasoner ELK --equivalent-classes-allowed all --exclude-tautologies structural \ - relax \ - reduce -r ELK \ - remove --base-iri $(URIBASE)/PHENIO --axioms external --preserve-structure false --trim false \ - $(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 $@ +$(ROBOT_PLUGINS_DIRECTORY)/upheno.jar: + mkdir -p $(ROBOT_PLUGINS_DIRECTORY) + curl -L -o $@ https://github.com/monarch-initiative/monarch-robot-plugins/releases/download/v0.0.1/monarch-robot-extensions-0.0.1.jar # test artifact. A small subset of the ontology for testing purposes # Note this does include categories. From ecc0a2a36a299eb698876960990a24ccbead2cbf Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Mon, 8 Apr 2024 13:18:01 +0300 Subject: [PATCH 2/5] Remove QC updates from odk refresh --- .github/workflows/qc.yml | 10 +++++----- src/ontology/Makefile | 2 +- src/ontology/phenio-odk.yaml | 3 +++ src/scripts/update_repo.sh | 4 ++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/qc.yml b/.github/workflows/qc.yml index d5e641e..268f5be 100644 --- a/.github/workflows/qc.yml +++ b/.github/workflows/qc.yml @@ -5,10 +5,10 @@ name: CI # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the main branch - push: - branches: [ main ] - pull_request: - branches: [ main ] + # push: + # branches: [ main ] + # pull_request: + # branches: [ main ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: @@ -29,5 +29,5 @@ jobs: - name: Run ontology QC checks env: DEFAULT_BRANCH: main - run: cd src/ontology && make ROBOT_ENV='ROBOT_JAVA_ARGS=-Xmx6G' test IMP=false PAT=false + run: cd src/ontology && make ROBOT_ENV='ROBOT_JAVA_ARGS=-Xmx6G' test IMP=false PAT=false MIR=false diff --git a/src/ontology/Makefile b/src/ontology/Makefile index 93dd056..7b8bc7b 100644 --- a/src/ontology/Makefile +++ b/src/ontology/Makefile @@ -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= a885d51b8ca7abe5f5f1f62ea05de8d036cffc2816cfc791eb9c06350d4d14d6 +CONFIG_HASH= d04794e4f2a13e74047bcdc86aa00e4c1f720b60b2a5afb72fab7e40a2195e1b # ---------------------------------------- diff --git a/src/ontology/phenio-odk.yaml b/src/ontology/phenio-odk.yaml index f7da735..ea6d800 100644 --- a/src/ontology/phenio-odk.yaml +++ b/src/ontology/phenio-odk.yaml @@ -164,6 +164,9 @@ robot_report: documentation: documentation_system: mkdocs +workflows: + - docs + robot_plugins: plugins: - name: upheno diff --git a/src/scripts/update_repo.sh b/src/scripts/update_repo.sh index 941b891..1fc84f2 100644 --- a/src/scripts/update_repo.sh +++ b/src/scripts/update_repo.sh @@ -26,7 +26,7 @@ cp target/$OID/src/ontology/run.sh $SRCDIR/ontology/ cp -r target/$OID/src/sparql/* $SRCDIR/sparql/ mkdir -p $ROOTDIR/.github mkdir -p $ROOTDIR/.github/workflows -cp target/$OID/.github/workflows/qc.yml $ROOTDIR/.github/workflows/qc.yml + @@ -36,5 +36,5 @@ cp target/$OID/.github/workflows/docs.yml $ROOTDIR/.github/workflows/docs.yml cp -n target/$OID/mkdocs.yaml $ROOTDIR/ echo "WARNING: These files should be manually migrated: mkdocs.yaml, .gitignore, src/ontology/catalog.xml (if you added a new import or component)" - +echo "WARNING: Your QC workflows have not been updated automatically. Please update the ODK version number(s) in .github/workflows/qc.yml." echo "Ontology repository update successfully completed." \ No newline at end of file From 79b6ae8d3575c632013b33b0b5195ce6b44aa126 Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Mon, 8 Apr 2024 13:19:47 +0300 Subject: [PATCH 3/5] Update phenio.Makefile --- src/ontology/phenio.Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ontology/phenio.Makefile b/src/ontology/phenio.Makefile index da06d09..2dcf144 100644 --- a/src/ontology/phenio.Makefile +++ b/src/ontology/phenio.Makefile @@ -30,6 +30,11 @@ $(EXPLAIN_OUT_PATH): $(TMPDIR)/$(ONT)-full-unreasoned.owl $(BLMODEL): wget $(BLMODEL_URL) -O $@ +### Download ROBOT plugin for upheno +$(ROBOT_PLUGINS_DIRECTORY)/upheno.jar: + mkdir -p $(ROBOT_PLUGINS_DIRECTORY) + curl -L -o $@ https://github.com/monarch-initiative/monarch-robot-plugins/releases/download/v0.0.1/monarch-robot-extensions-0.0.1.jar + $(ONT)-full.owl: $(TMPDIR)/$(ONT)-full-unreasoned.owl | all_robot_plugins $(ROBOT) merge --input $< \ upheno:extract-upheno-relations --root-phenotype UPHENO:0001001 --relation UPHENO:0000003 --relation UPHENO:0000001 \ @@ -70,10 +75,6 @@ $(ONT)-relation-graph.tsv: $(MINIMAL_PATH) --obo-prefixes true \ --verbose true -$(ROBOT_PLUGINS_DIRECTORY)/upheno.jar: - mkdir -p $(ROBOT_PLUGINS_DIRECTORY) - curl -L -o $@ https://github.com/monarch-initiative/monarch-robot-plugins/releases/download/v0.0.1/monarch-robot-extensions-0.0.1.jar - # test artifact. A small subset of the ontology for testing purposes # Note this does include categories. $(ONT)-test.owl: $(ONT).owl From 789956ddcd7425060dadea88a6588879a58a6dfc Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Wed, 10 Apr 2024 12:48:16 +0300 Subject: [PATCH 4/5] Update Makefile --- src/ontology/phenio.Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ontology/phenio.Makefile b/src/ontology/phenio.Makefile index 2dcf144..09076c4 100644 --- a/src/ontology/phenio.Makefile +++ b/src/ontology/phenio.Makefile @@ -37,11 +37,11 @@ $(ROBOT_PLUGINS_DIRECTORY)/upheno.jar: $(ONT)-full.owl: $(TMPDIR)/$(ONT)-full-unreasoned.owl | all_robot_plugins $(ROBOT) merge --input $< \ - upheno:extract-upheno-relations --root-phenotype UPHENO:0001001 --relation UPHENO:0000003 --relation UPHENO:0000001 \ relax \ merge --input $(BLMODEL) \ query --update $(BLQUERY) \ unmerge --input $(BLMODEL) \ + upheno:extract-upheno-relations --term UPHENO:0001001 --relation UPHENO:0000003 --relation UPHENO:0000001 \ annotate --ontology-iri $(URIBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \ convert -o $@.tmp.owl && mv $@.tmp.owl $@ From 91bb2ab77306e4de76e92114d6d40ece89d64853 Mon Sep 17 00:00:00 2001 From: Nico Matentzoglu Date: Wed, 10 Apr 2024 16:21:12 +0300 Subject: [PATCH 5/5] Update --- src/ontology/Makefile | 4 ++-- src/ontology/phenio-odk.yaml | 2 +- src/ontology/phenio.Makefile | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ontology/Makefile b/src/ontology/Makefile index 7b8bc7b..f2b801d 100644 --- a/src/ontology/Makefile +++ b/src/ontology/Makefile @@ -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= d04794e4f2a13e74047bcdc86aa00e4c1f720b60b2a5afb72fab7e40a2195e1b +CONFIG_HASH= e6c8433a2061b8c344c045ae57324b457c3c5c0b221faaaec4373a8c55c52c2b # ---------------------------------------- @@ -142,7 +142,7 @@ $(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/download/v0.0.1/monarch-robot-extensions-0.0.1.jar + curl -L -o $@ https://github.com/monarch-initiative/monarch-robot-plugins/releases/latest/download/monarch-robot-extensions.jar # ---------------------------------------- diff --git a/src/ontology/phenio-odk.yaml b/src/ontology/phenio-odk.yaml index ea6d800..7ea3b46 100644 --- a/src/ontology/phenio-odk.yaml +++ b/src/ontology/phenio-odk.yaml @@ -170,5 +170,5 @@ workflows: robot_plugins: plugins: - name: upheno - mirror_from: https://github.com/monarch-initiative/monarch-robot-plugins/releases/download/v0.0.1/monarch-robot-extensions-0.0.1.jar + mirror_from: https://github.com/monarch-initiative/monarch-robot-plugins/releases/latest/download/monarch-robot-extensions.jar diff --git a/src/ontology/phenio.Makefile b/src/ontology/phenio.Makefile index 09076c4..4e83d97 100644 --- a/src/ontology/phenio.Makefile +++ b/src/ontology/phenio.Makefile @@ -41,7 +41,7 @@ $(ONT)-full.owl: $(TMPDIR)/$(ONT)-full-unreasoned.owl | all_robot_plugins merge --input $(BLMODEL) \ query --update $(BLQUERY) \ unmerge --input $(BLMODEL) \ - upheno:extract-upheno-relations --term UPHENO:0001001 --relation UPHENO:0000003 --relation UPHENO:0000001 \ + upheno:extract-upheno-relations --root-phenotype UPHENO:0001001 --relation UPHENO:0000003 --relation UPHENO:0000001 \ annotate --ontology-iri $(URIBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \ convert -o $@.tmp.owl && mv $@.tmp.owl $@