-
Notifications
You must be signed in to change notification settings - Fork 29
/
Makefile
971 lines (739 loc) · 41.4 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
# ----------------------------------------
# Makefile for uberon
# Generated using ontology-development-kit
# ODK Version: v1.4.3
# ----------------------------------------
# IMPORTANT: DO NOT EDIT THIS FILE. To override default make goals, use uberon.Makefile instead
# ----------------------------------------
# More information: https://github.com/INCATools/ontology-development-kit/
# ----------------------------------------
# Standard Constants
# ----------------------------------------
# these can be overwritten on the command line
OBOBASE= http://purl.obolibrary.org/obo
URIBASE= http://purl.obolibrary.org/obo
ONT= uberon
ONTBASE= http://purl.obolibrary.org/obo/uberon
EDIT_FORMAT= obo
SRC = $(ONT)-edit.$(EDIT_FORMAT)
MAKE_FAST= $(MAKE) IMP=false PAT=false COMP=false MIR=false
CATALOG= catalog-v001.xml
ROBOT= robot --catalog $(CATALOG)
OWLTOOLS_MEMORY= 20G
OWLTOOLS= OWLTOOLS_MEMORY=$(OWLTOOLS_MEMORY) owltools --use-catalog
RELEASEDIR= ../..
REPORTDIR= reports
TEMPLATEDIR= ../templates
TMPDIR= tmp
MIRRORDIR= mirror
IMPORTDIR= imports
SUBSETDIR= subsets
SCRIPTSDIR= ../scripts
UPDATEREPODIR= target
SPARQLDIR = ../sparql
COMPONENTSDIR = components
ROBOT_PROFILE = profile.txt
REPORT_FAIL_ON = ERROR
REPORT_LABEL =
REPORT_PROFILE_OPTS = --profile $(ROBOT_PROFILE)
OBO_FORMAT_OPTIONS =
SPARQL_VALIDATION_CHECKS = equivalent-classes owldef-self-reference illegal-annotation-property taxon-range orcid-contributor obsolete-replaced_by xrefs-mesh-pattern label-synonym-polysemy id-format
SPARQL_EXPORTS = basic-report
ODK_VERSION_MAKEFILE = v1.4.3
TODAY ?= $(shell date +%Y-%m-%d)
OBODATE ?= $(shell date +'%d:%m:%Y %H:%M')
VERSION= $(TODAY)
ANNOTATE_ONTOLOGY_VERSION = annotate -V $(ONTBASE)/releases/$(VERSION)/$@ --annotation owl:versionInfo $(VERSION)
ANNOTATE_CONVERT_FILE = annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) convert -f ofn --output [email protected] && mv [email protected] $@
OTHER_SRC = $(PATTERNDIR)/definitions.owl $(COMPONENTSDIR)/mappings.owl $(COMPONENTSDIR)/in-subset.owl $(COMPONENTSDIR)/hra_subset.owl $(COMPONENTSDIR)/vasculature_class.owl $(COMPONENTSDIR)/hra_depiction_3d_images.owl
ONTOLOGYTERMS = $(TMPDIR)/ontologyterms.txt
EDIT_PREPROCESSED = $(TMPDIR)/$(ONT)-preprocess.owl
PATTERNDIR= ../patterns
PATTERN_TESTER= dosdp validate -i
DOSDPT= dosdp-tools
PATTERN_RELEASE_FILES= $(PATTERNDIR)/definitions.owl $(PATTERNDIR)/pattern.owl
FORMATS = $(sort owl obo json owl)
FORMATS_INCL_TSV = $(sort $(FORMATS) tsv)
RELEASE_ARTEFACTS = $(sort $(ONT)-base $(ONT)-full $(ONT)-simple $(ONT)-basic basic composite-metazoan composite-metazoan-basic composite-vertebrate composite-vertebrate-basic common-anatomy )
# ----------------------------------------
# Top-level targets
# ----------------------------------------
.PHONY: .FORCE
.PHONY: all
all: all_odk
.PHONY: all_odk
all_odk: odkversion test all_assets
.PHONY: test
test: odkversion dosdp_validation reason_test sparql_test robot_reports $(REPORTDIR)/validate_profile_owl2dl_$(ONT).owl.txt
echo "Finished running all tests successfully."
.PHONY: release_diff
release_diff: $(REPORTDIR)/release-diff.md
.PHONY: reason_test
reason_test: $(EDIT_PREPROCESSED)
$(ROBOT) reason --input $< --reasoner ELK --equivalent-classes-allowed asserted-only \
--exclude-tautologies structural --output test.owl && rm test.owl
.PHONY: odkversion
odkversion:
echo "ODK Makefile version: $(ODK_VERSION_MAKEFILE) (this is the version of the ODK with which this Makefile was generated, \
not the version of the ODK you are running)" &&\
echo "ROBOT version (ODK): " && $(ROBOT) --version
$(TMPDIR) $(REPORTDIR) $(MIRRORDIR) $(IMPORTDIR) $(COMPONENTSDIR) $(SUBSETDIR):
mkdir -p $@
# ----------------------------------------
# Release assets
# ----------------------------------------
MAIN_PRODUCTS = $(sort $(foreach r,$(RELEASE_ARTEFACTS), $(r)) $(ONT))
MAIN_GZIPPED =
MAIN_FILES = $(foreach n,$(MAIN_PRODUCTS), $(foreach f,$(FORMATS), $(n).$(f))) $(MAIN_GZIPPED)
SRCMERGED = $(TMPDIR)/merged-$(SRC)
.PHONY: all_main
all_main: $(MAIN_FILES)
# ----------------------------------------
# Import assets
# ----------------------------------------
IMPORTS = pr cl go envo ro bspo chebi pato bfo ncbitaxon ncbitaxondisjoints nbo orcidio omo
IMPORT_ROOTS = $(IMPORTDIR)/merged_import
IMPORT_OWL_FILES = $(foreach n,$(IMPORT_ROOTS), $(n).owl)
IMPORT_FILES = $(IMPORT_OWL_FILES)
.PHONY: all_imports
all_imports: $(IMPORT_FILES)
# ----------------------------------------
# Subset assets
# ----------------------------------------
SUBSETS = appendicular-minimal circulatory-minimal cranial-minimal cumbo digestive-minimal excretory-minimal human-view immune-minimal life-stages-composite life-stages-core life-stages-minimal merged-partonomy metazoan-view mouse-view musculoskeletal-minimal nephron-minimal nervous-minimal pulmonary-minimal renal-minimal reproductive-minimal sensory-minimal xenopus-view amniote-basic euarchontoglires-basic
SUBSET_ROOTS = $(patsubst %, $(SUBSETDIR)/%, $(SUBSETS))
SUBSET_FILES = $(foreach n,$(SUBSET_ROOTS), $(foreach f,$(FORMATS_INCL_TSV), $(n).$(f)))
.PHONY: all_subsets
all_subsets: $(SUBSET_FILES)
# ----------------------------------------
# Mapping assets
# ----------------------------------------
MAPPINGS =
MAPPING_FILES = $(patsubst %, $(MAPPINGDIR)/%.sssom.tsv, $(MAPPINGS))
.PHONY: all_mappings
all_mappings: $(MAPPING_FILES)
# ----------------------------------------
# QC Reports & Utilities
# ----------------------------------------
OBO_REPORT = $(SRC)-obo-report
REPORTS = $(OBO_REPORT)
REPORT_FILES = $(patsubst %, $(REPORTDIR)/%.tsv, $(REPORTS))
.PHONY: robot_reports
robot_reports: $(REPORT_FILES)
.PHONY: all_reports
all_reports: custom_reports robot_reports
# ----------------------------------------
# ROBOT OWL Profile checking
# ----------------------------------------
# The merge step is necessary to avoid undeclared entity violations.
$(REPORTDIR)/validate_profile_owl2dl_%.txt: % | $(REPORTDIR) $(TMPDIR)
$(ROBOT) merge -i $< convert -f ofn -o $(TMPDIR)/validate.ofn
$(ROBOT) validate-profile --profile DL -i $(TMPDIR)/validate.ofn -o $@ || { cat $@ && exit 1; }
.PRECIOUS: $(REPORTDIR)/validate_profile_owl2dl_%.txt
validate_profile_%: $(REPORTDIR)/validate_profile_owl2dl_%.txt
echo "$* profile validation completed."
# ----------------------------------------
# Sparql queries: Q/C
# ----------------------------------------
# these live in the ../sparql directory, and have suffix -violation.sparql
# adding the name here will make the violation check live.
SPARQL_VALIDATION_QUERIES = $(foreach V,$(SPARQL_VALIDATION_CHECKS),$(SPARQLDIR)/$(V)-violation.sparql)
sparql_test: $(EDIT_PREPROCESSED) catalog-v001.xml | $(REPORTDIR)
ifneq ($(SPARQL_VALIDATION_QUERIES),)
$(ROBOT) verify --catalog catalog-v001.xml -i $(EDIT_PREPROCESSED) --queries $(SPARQL_VALIDATION_QUERIES) -O $(REPORTDIR)
endif
# ----------------------------------------
# ROBOT report
# ----------------------------------------
$(REPORTDIR)/$(SRC)-obo-report.tsv: $(SRCMERGED) | $(REPORTDIR)
$(ROBOT) report -i $< $(REPORT_LABEL) $(REPORT_PROFILE_OPTS) --fail-on $(REPORT_FAIL_ON) --print 5 -o $@
$(REPORTDIR)/%-obo-report.tsv: % | $(REPORTDIR)
$(ROBOT) report -i $< $(REPORT_LABEL) $(REPORT_PROFILE_OPTS) --fail-on $(REPORT_FAIL_ON) --print 5 -o $@
# ----------------------------------------
# Release assets
# ----------------------------------------
ASSETS = \
$(IMPORT_FILES) \
$(MAIN_FILES) \
$(PATTERN_RELEASE_FILES) \
$(REPORT_FILES) \
$(SUBSET_FILES) \
$(MAPPING_FILES)
RELEASE_ASSETS = \
$(MAIN_FILES) \
$(SUBSET_FILES)
.PHONY: all_assets
all_assets: $(ASSETS)
.PHONY: show_assets
show_assets:
echo $(ASSETS)
du -sh $(ASSETS)
check_rdfxml_%: %
@check-rdfxml $<
.PHONY: check_rdfxml_assets
check_rdfxml_assets: $(foreach product,$(MAIN_PRODUCTS),check_rdfxml_$(product).owl)
# ----------------------------------------
# Release Management
# ----------------------------------------
KEEPRELATIONS=keeprelations.txt
CLEANFILES=$(MAIN_FILES) $(SRCMERGED) $(EDIT_PREPROCESSED)
# This should be executed by the release manager whenever time comes to make a release.
# It will ensure that all assets/files are fresh, and will copy to release folder
.PHONY: prepare_release
prepare_release: all_odk
rsync -R $(RELEASE_ASSETS) $(RELEASEDIR) &&\
mkdir -p $(RELEASEDIR)/patterns && cp -rf $(PATTERN_RELEASE_FILES) $(RELEASEDIR)/patterns &&\
rm -f $(CLEANFILES) &&\
echo "Release files are now in $(RELEASEDIR) - now you should commit, push and make a release \
on your git hosting site such as GitHub or GitLab"
.PHONY: prepare_initial_release
prepare_initial_release: all_assets
rsync -R $(RELEASE_ASSETS) $(RELEASEDIR) &&\
mkdir -p $(RELEASEDIR)/patterns && cp -rf $(PATTERN_RELEASE_FILES) $(RELEASEDIR)/patterns &&\
rm -f $(patsubst %, ./%, $(CLEANFILES)) &&\
cd $(RELEASEDIR) && git add $(RELEASE_ASSETS)
.PHONY: prepare_release_fast
prepare_release_fast:
$(MAKE) prepare_release IMP=false PAT=false MIR=false COMP=false
CURRENT_RELEASE=$(ONTBASE).owl
$(TMPDIR)/current-release.owl:
wget $(CURRENT_RELEASE) -O $@
$(REPORTDIR)/release-diff.md: $(ONT).owl $(TMPDIR)/current-release.owl
$(ROBOT) diff --labels true --left $(TMPDIR)/current-release.owl --right $(ONT).owl -f markdown -o $@
# ------------------------
# Imports: Seeding system
# ------------------------
# seed.txt contains all referenced entities
IMPORTSEED=$(TMPDIR)/seed.txt
PRESEED=$(TMPDIR)/pre_seed.txt
$(SRCMERGED): $(EDIT_PREPROCESSED) $(OTHER_SRC)
$(ROBOT) remove --input $< --select imports --trim false \
merge $(patsubst %, -i %, $(OTHER_SRC)) -o $@
$(EDIT_PREPROCESSED): $(SRC)
$(ROBOT) convert --input $< --format ofn --output $@
$(PRESEED): $(SRCMERGED)
$(ROBOT) query -f csv -i $< --query ../sparql/terms.sparql [email protected] &&\
cat [email protected] | sort | uniq > $@
SIMPLESEED=$(TMPDIR)/simple_seed.txt
$(SIMPLESEED): $(SRCMERGED) $(ONTOLOGYTERMS)
$(ROBOT) query -f csv -i $< --query ../sparql/simple-seed.sparql [email protected] &&\
cat [email protected] $(ONTOLOGYTERMS) | sort | uniq > $@ &&\
echo "http://www.geneontology.org/formats/oboInOwl#SubsetProperty" >> $@ &&\
echo "http://www.geneontology.org/formats/oboInOwl#SynonymTypeProperty" >> $@
ALLSEED = $(PRESEED) $(TMPDIR)/all_pattern_terms.txt \
$(IMPORTSEED): $(ALLSEED) | $(TMPDIR)
if [ $(IMP) = true ]; then cat $(ALLSEED) | sort | uniq > $@; fi
ANNOTATION_PROPERTIES=rdfs:label IAO:0000115
# ----------------------------------------
# Import modules
# ----------------------------------------
# Most ontologies are modularly constructed using portions of other ontologies
# These live in the imports/ folder
# This pattern uses ROBOT to generate an import module
# Should be able to drop this if robot can just take a big messy list of terms as input.
$(IMPORTDIR)/%_terms_combined.txt: $(IMPORTSEED) $(IMPORTDIR)/%_terms.txt
if [ $(IMP) = true ]; then cat $^ | grep -v ^# | sort | uniq > $@; fi
ALL_TERMS_COMBINED = $(patsubst %, $(IMPORTDIR)/%_terms_combined.txt, $(IMPORTS))
$(IMPORTDIR)/merged_terms_combined.txt: $(ALL_TERMS_COMBINED)
if [ $(IMP) = true ]; then cat $^ | grep -v ^# | sort | uniq > $@; fi
$(IMPORTDIR)/merged_import.owl: $(MIRRORDIR)/merged.owl $(IMPORTDIR)/merged_terms_combined.txt
if [ $(IMP) = true ]; then $(ROBOT) merge -i $< \
remove --select "<http://www.informatics.jax.org/marker/MGI:*>" remove --select "<http://purl.obolibrary.org/obo/OBA_*>" remove --select "<http://purl.obolibrary.org/obo/ENVO_*>" remove --select "<http://purl.obolibrary.org/obo/OBI_*>" remove --select "<http://purl.obolibrary.org/obo/GOCHE_*>" remove --select "<http://www.genenames.org/cgi-bin/gene_symbol_report*>" \
extract -T $(IMPORTDIR)/merged_terms_combined.txt --force true --copy-ontology-annotations true --individuals exclude --method BOT \
query --update ../sparql/inject-subset-declaration.ru --update ../sparql/inject-synonymtype-declaration.ru --update ../sparql/postprocess-module.ru \
$(ANNOTATE_CONVERT_FILE); fi
$(IMPORTDIR)/%_import.owl: $(MIRRORDIR)/merged.owl $(IMPORTDIR)/%_terms_combined.txt
if [ $(IMP) = true ]; then $(ROBOT) query -i $< --update ../sparql/preprocess-module.ru \
extract -T $(IMPORTDIR)/$*_terms_combined.txt --force true --copy-ontology-annotations true --individuals exclude --method BOT \
query --update ../sparql/inject-subset-declaration.ru --update ../sparql/inject-synonymtype-declaration.ru --update ../sparql/postprocess-module.ru \
$(ANNOTATE_CONVERT_FILE); fi
.PRECIOUS: $(IMPORTDIR)/%_import.owl
## Module for ontology: omo
$(IMPORTDIR)/omo_import.owl: $(MIRRORDIR)/merged.owl $(IMPORTDIR)/omo_terms_combined.txt
if [ $(IMP) = true ]; then $(ROBOT) merge -i $< query --update ../sparql/preprocess-module.ru --update ../sparql/inject-subset-declaration.ru --update ../sparql/inject-synonymtype-declaration.ru --update ../sparql/postprocess-module.ru \
$(ANNOTATE_CONVERT_FILE); fi
.PHONY: refresh-imports
refresh-imports:
$(MAKE) IMP=true MIR=true PAT=false IMP_LARGE=true all_imports -B
.PHONY: no-mirror-refresh-imports
no-mirror-refresh-imports:
$(MAKE) IMP=true MIR=false PAT=false IMP_LARGE=true all_imports -B
.PHONY: refresh-imports-excluding-large
refresh-imports-excluding-large:
$(MAKE) IMP=true MIR=true PAT=false IMP_LARGE=false all_imports -B
.PHONY: refresh-%
refresh-%:
$(MAKE) IMP=true IMP_LARGE=true MIR=true PAT=false $(IMPORTDIR)/$*_import.owl -B
.PHONY: no-mirror-refresh-%
no-mirror-refresh-%:
$(MAKE) IMP=true IMP_LARGE=true MIR=false PAT=false $(IMPORTDIR)/$*_import.owl -B
# ----------------------------------------
# Components
# ----------------------------------------
# Some ontologies contain external and internal components. A component is included in the ontology in its entirety.
COMP=true # Global parameter to bypass component generation
.PHONY: all_components
all_components: $(OTHER_SRC)
.PHONY: recreate-components
recreate-components:
$(MAKE) COMP=true IMP=false MIR=true PAT=true IMP_LARGE=false all_components -B
.PHONY: no-mirror-recreate-components
no-mirror-recreate-components:
$(MAKE) COMP=true IMP=false MIR=false PAT=true IMP_LARGE=false all_components -B
.PHONY: recreate-%
recreate-%:
$(MAKE) COMP=true IMP=false IMP_LARGE=false MIR=true PAT=true $(COMPONENTSDIR)/$*.owl -B
.PHONY: no-mirror-recreate-%
no-mirror-recreate-%:
$(MAKE) COMP=true IMP=false IMP_LARGE=false MIR=false PAT=true $(COMPONENTSDIR)/$*.owl -B
$(COMPONENTSDIR)/%: | $(COMPONENTSDIR)
touch $@
.PRECIOUS: $(COMPONENTSDIR)/%
# ----------------------------------------
# Mirroring upstream ontologies
# ----------------------------------------
IMP=true # Global parameter to bypass import generation
MIR=true # Global parameter to bypass mirror generation
IMP_LARGE=true # Global parameter to bypass handling of large imports
## ONTOLOGY: pr
.PHONY: mirror-pr
.PRECIOUS: $(MIRRORDIR)/pr.owl
mirror-pr: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I https://raw.githubusercontent.com/obophenotype/pro_obo_slim/master/pr_slim.owl -o [email protected] && \
$(ROBOT) remove -i [email protected] --base-iri $(URIBASE)/PR --axioms external --preserve-structure false --trim false -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: cl
.PHONY: mirror-cl
.PRECIOUS: $(MIRRORDIR)/cl.owl
mirror-cl: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/cl/cl-base.owl --create-dirs -o $(MIRRORDIR)/cl.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/cl.owl -o [email protected] && mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: go
.PHONY: mirror-go
.PRECIOUS: $(MIRRORDIR)/go.owl
mirror-go: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I http://purl.obolibrary.org/obo/go/go-base.owl -o [email protected] && \
$(ROBOT) remove -i [email protected] --base-iri http://purl.obolibrary.org/obo/GO_ --base-iri http://purl.obolibrary.org/obo/GOREL_ --base-iri http://purl.obolibrary.org/obo/GOCHE_ --axioms external --preserve-structure false --trim false -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: envo
.PHONY: mirror-envo
.PRECIOUS: $(MIRRORDIR)/envo.owl
mirror-envo: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/envo/envo-base.owl --create-dirs -o $(MIRRORDIR)/envo.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/envo.owl -o [email protected] && mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: ro
.PHONY: mirror-ro
.PRECIOUS: $(MIRRORDIR)/ro.owl
mirror-ro: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/ro/ro-base.owl --create-dirs -o $(MIRRORDIR)/ro.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/ro.owl -o [email protected] && mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: bspo
.PHONY: mirror-bspo
.PRECIOUS: $(MIRRORDIR)/bspo.owl
mirror-bspo: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/bspo/bspo-base.owl --create-dirs -o $(MIRRORDIR)/bspo.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/bspo.owl -o [email protected] && mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: chebi
.PHONY: mirror-chebi
.PRECIOUS: $(MIRRORDIR)/chebi.owl
mirror-chebi: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I https://raw.githubusercontent.com/obophenotype/chebi_obo_slim/main/chebi_slim.owl -o [email protected] && \
$(ROBOT) remove -i [email protected] --base-iri $(URIBASE)/CHEBI --axioms external --preserve-structure false --trim false -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: pato
.PHONY: mirror-pato
.PRECIOUS: $(MIRRORDIR)/pato.owl
mirror-pato: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/pato/pato-base.owl --create-dirs -o $(MIRRORDIR)/pato.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/pato.owl -o [email protected] && mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: bfo
.PHONY: mirror-bfo
.PRECIOUS: $(MIRRORDIR)/bfo.owl
mirror-bfo: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/bfo.owl --create-dirs -o $(MIRRORDIR)/bfo.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/bfo.owl -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: ncbitaxon
.PHONY: mirror-ncbitaxon
.PRECIOUS: $(MIRRORDIR)/ncbitaxon.owl
mirror-ncbitaxon: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I http://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim.owl -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: ncbitaxondisjoints
.PHONY: mirror-ncbitaxondisjoints
.PRECIOUS: $(MIRRORDIR)/ncbitaxondisjoints.owl
mirror-ncbitaxondisjoints: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I http://purl.obolibrary.org/obo/ncbitaxon/subsets/taxslim-disjoint-over-in-taxon.owl -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: nbo
.PHONY: mirror-nbo
.PRECIOUS: $(MIRRORDIR)/nbo.owl
mirror-nbo: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/nbo/nbo-base.owl --create-dirs -o $(MIRRORDIR)/nbo.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/nbo.owl -o [email protected] && mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: orcidio
.PHONY: mirror-orcidio
.PRECIOUS: $(MIRRORDIR)/orcidio.owl
mirror-orcidio: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then $(ROBOT) convert -I https://w3id.org/orcidio/orcidio.owl -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
## ONTOLOGY: omo
.PHONY: mirror-omo
.PRECIOUS: $(MIRRORDIR)/omo.owl
mirror-omo: | $(TMPDIR)
if [ $(MIR) = true ] && [ $(IMP) = true ]; then curl -L $(OBOBASE)/omo.owl --create-dirs -o $(MIRRORDIR)/omo.owl --retry 4 --max-time 200 &&\
$(ROBOT) convert -i $(MIRRORDIR)/omo.owl -o [email protected] &&\
mv [email protected] $(TMPDIR)/[email protected]; fi
ALL_MIRRORS = $(patsubst %, $(MIRRORDIR)/%.owl, $(IMPORTS))
MERGE_MIRRORS = true
$(MIRRORDIR)/merged.owl: $(ALL_MIRRORS)
if [ $(IMP) = true ] && [ $(MERGE_MIRRORS) = true ]; then $(ROBOT) merge $(patsubst %, -i %, $^) -o $@; fi
.PRECIOUS: $(MIRRORDIR)/merged.owl
$(MIRRORDIR)/%.owl: mirror-% | $(MIRRORDIR)
if [ $(IMP) = true ] && [ $(MIR) = true ] && [ -f $(TMPDIR)/mirror-$*.owl ]; then if cmp -s $(TMPDIR)/mirror-$*.owl $@ ; then echo "Mirror identical, ignoring."; else echo "Mirrors different, updating." &&\
cp $(TMPDIR)/mirror-$*.owl $@; fi; fi
# ----------------------------------------
# Subsets
# ----------------------------------------
$(SUBSETDIR)/%.tsv: $(SUBSETDIR)/%.owl
$(ROBOT) query -f tsv -i $< -s ../sparql/labels.sparql $@
.PRECIOUS: $(SUBSETDIR)/%.tsv
$(SUBSETDIR)/%.owl: $(ONT).owl | $(SUBSETDIR)
$(OWLTOOLS) $< --extract-ontology-subset --fill-gaps --subset $* -o [email protected] && mv [email protected] $@ &&\
$(ROBOT) annotate --input $@ --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) -o [email protected] && mv [email protected] $@
.PRECIOUS: $(SUBSETDIR)/%.owl
$(SUBSETDIR)/%.obo: $(SUBSETDIR)/%.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
$(SUBSETDIR)/%.json: $(SUBSETDIR)/%.owl
$(ROBOT) convert --input $< --check false -f json -o [email protected] &&\
mv [email protected] $@
# ---------------------------------------------
# Sparql queries: Table exports / Query Reports
# ---------------------------------------------
SPARQL_EXPORTS_ARGS = $(foreach V,$(SPARQL_EXPORTS),-s $(SPARQLDIR)/$(V).sparql $(REPORTDIR)/$(V).tsv)
# This combines all into one single command
.PHONY: custom_reports
custom_reports: $(EDIT_PREPROCESSED) | $(REPORTDIR)
ifneq ($(SPARQL_EXPORTS_ARGS),)
$(ROBOT) query -f tsv --use-graphs true -i $< $(SPARQL_EXPORTS_ARGS)
endif
# ----------------------------------------
# DOSDP Templates/Patterns
# ----------------------------------------
PAT=true # Global parameter to bypass pattern generation
ALL_PATTERN_FILES=$(wildcard $(PATTERNDIR)/dosdp-patterns/*.yaml)
ALL_PATTERN_NAMES=$(strip $(patsubst %.yaml,%, $(notdir $(wildcard $(PATTERNDIR)/dosdp-patterns/*.yaml))))
PATTERN_CLEAN_FILES=../patterns/all_pattern_terms.txt \
$(DOSDP_OWL_FILES_DEFAULT) $(DOSDP_TERM_FILES_DEFAULT) \
# Note to future generations: prepending ./ is a safety measure to ensure that
# the environment does not malicously set `PATTERN_CLEAN_FILES` to `\`.
.PHONY: pattern_clean
pattern_clean:
rm -f $(PATTERN_CLEAN_FILES)
.PHONY: patterns
patterns dosdp:
echo "Validating all DOSDP templates"
$(MAKE) dosdp_validation
echo "Building $(PATTERNDIR)/definitions.owl"
$(MAKE) $(PATTERNDIR)/pattern.owl $(PATTERNDIR)/definitions.owl
# DOSDP Template Validation
$(TMPDIR)/pattern_schema_checks: $(ALL_PATTERN_FILES) | $(TMPDIR)
$(PATTERN_TESTER) $(PATTERNDIR)/dosdp-patterns/ && touch $@
.PHONY: pattern_schema_checks
pattern_schema_checks dosdp_validation: $(TMPDIR)/pattern_schema_checks
.PHONY: update_patterns
update_patterns: download_patterns
if [ -n "$$(find $(TMPDIR) -type f -path '$(TMPDIR)/dosdp/*.yaml')" ]; then cp -r $(TMPDIR)/dosdp/*.yaml $(PATTERNDIR)/dosdp-patterns; fi
# This command is a workaround for the absence of -N and -i in wget of alpine (the one ODK depend on now).
# It downloads all patterns specified in external.txt
.PHONY: download_patterns
download_patterns:
if [ $(PAT) = true ]; then rm -f $(TMPDIR)/dosdp/*.yaml.1 || true; fi
if [ $(PAT) = true ] && [ -s $(PATTERNDIR)/dosdp-patterns/external.txt ]; then wget -i $(PATTERNDIR)/dosdp-patterns/external.txt --backups=1 -P $(TMPDIR)/dosdp; fi
if [ $(PAT) = true ]; then rm -f $(TMPDIR)/dosdp/*.yaml.1 || true; fi
$(PATTERNDIR)/dospd-patterns/%.yml: download_patterns
if [ $(PAT) = true ] ; then if cmp -s $(TMPDIR)/dosdp-$*.yml $@ ; then echo "DOSDP templates identical."; else echo "DOSDP templates different, updating." &&\
cp $(TMPDIR)/dosdp-$*.yml $@; fi; fi
# DOSDP Template: Pipelines
# Each pipeline gets its own directory structure
# DOSDP default pipeline
DOSDP_TSV_FILES_DEFAULT = $(wildcard $(PATTERNDIR)/data/default/*.tsv)
DOSDP_OWL_FILES_DEFAULT = $(patsubst %.tsv, $(PATTERNDIR)/data/default/%.ofn, $(notdir $(wildcard $(PATTERNDIR)/data/default/*.tsv)))
DOSDP_TERM_FILES_DEFAULT = $(patsubst %.tsv, $(PATTERNDIR)/data/default/%.txt, $(notdir $(wildcard $(PATTERNDIR)/data/default/*.tsv)))
DOSDP_PATTERN_NAMES_DEFAULT = $(strip $(patsubst %.tsv,%, $(notdir $(wildcard $(PATTERNDIR)/data/default/*.tsv))))
$(DOSDP_OWL_FILES_DEFAULT): $(EDIT_PREPROCESSED) $(DOSDP_TSV_FILES_DEFAULT) $(ALL_PATTERN_FILES)
if [ $(PAT) = true ] && [ "${DOSDP_PATTERN_NAMES_DEFAULT}" ]; then $(DOSDPT) generate --catalog=catalog-v001.xml \
--infile=$(PATTERNDIR)/data/default/ --template=$(PATTERNDIR)/dosdp-patterns --batch-patterns="$(DOSDP_PATTERN_NAMES_DEFAULT)" \
--ontology=$< --obo-prefixes=true --outfile=$(PATTERNDIR)/data/default; fi
# Generate template file seeds
## Generate template file seeds
$(PATTERNDIR)/data/default/%.txt: $(PATTERNDIR)/dosdp-patterns/%.yaml $(PATTERNDIR)/data/default/%.tsv
if [ $(PAT) = true ]; then $(DOSDPT) terms --infile=$(word 2, $^) --template=$< --obo-prefixes=true --outfile=$@; fi
# Generating the seed file from all the TSVs. If Pattern generation is deactivated, we still extract a seed from definitions.owl
$(TMPDIR)/all_pattern_terms.txt: $(DOSDP_TERM_FILES_DEFAULT) $(TMPDIR)/pattern_owl_seed.txt
if [ $(PAT) = true ]; then cat $^ | sort | uniq > $@; else $(ROBOT) query --use-graphs true -f csv -i $(PATTERNDIR)/definitions.owl \
--query ../sparql/terms.sparql $@; fi
$(TMPDIR)/pattern_owl_seed.txt: $(PATTERNDIR)/pattern.owl
if [ $(PAT) = true ]; then $(ROBOT) query --use-graphs true -f csv -i $< --query ../sparql/terms.sparql $@; fi
# Pattern pipeline main targets: the generated OWL files
# Create pattern.owl, an ontology of all DOSDP patterns
$(PATTERNDIR)/pattern.owl: $(ALL_PATTERN_FILES)
if [ $(PAT) = true ]; then $(DOSDPT) prototype --obo-prefixes true --template=$(PATTERNDIR)/dosdp-patterns --outfile=$@; fi
# Generating the individual pattern modules and merging them into definitions.owl
$(PATTERNDIR)/definitions.owl: $(DOSDP_OWL_FILES_DEFAULT)
if [ $(PAT) = true ] && [ "${DOSDP_PATTERN_NAMES_DEFAULT}" ] && [ $(PAT) = true ]; then $(ROBOT) merge $(addprefix -i , $^) \
annotate --ontology-iri $(ONTBASE)/patterns/definitions.owl --version-iri $(ONTBASE)/releases/$(TODAY)/patterns/definitions.owl \
--annotation owl:versionInfo $(VERSION) -o definitions.ofn && mv definitions.ofn $@; fi
# ----------------------------------------
# Release artefacts: export formats
# ----------------------------------------
$(ONT)-base.obo: $(ONT)-base.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
$(ONT)-base.json: $(ONT)-base.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
$(ONT)-full.obo: $(ONT)-full.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
$(ONT)-full.json: $(ONT)-full.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
$(ONT)-simple.obo: $(ONT)-simple.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
$(ONT)-simple.json: $(ONT)-simple.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
$(ONT)-basic.obo: $(ONT)-basic.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
$(ONT)-basic.json: $(ONT)-basic.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
basic.obo: basic.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
basic.json: basic.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
composite-metazoan.obo: composite-metazoan.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
composite-metazoan.json: composite-metazoan.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
composite-metazoan-basic.obo: composite-metazoan-basic.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
composite-metazoan-basic.json: composite-metazoan-basic.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
composite-vertebrate.obo: composite-vertebrate.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
composite-vertebrate.json: composite-vertebrate.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
composite-vertebrate-basic.obo: composite-vertebrate-basic.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
composite-vertebrate-basic.json: composite-vertebrate-basic.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
common-anatomy.obo: common-anatomy.owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
common-anatomy.json: common-anatomy.owl
$(ROBOT) annotate --input $< --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
# ----------------------------------------
# Release artefacts: main release artefacts
# ----------------------------------------
$(ONT).owl: $(ONT)-full.owl
$(ROBOT) annotate --input $< --ontology-iri $(URIBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert -o [email protected] && mv [email protected] $@
$(ONT).obo: $(ONT).owl
$(ROBOT) convert --input $< --check false -f obo $(OBO_FORMAT_OPTIONS) -o [email protected] && grep -v ^owl-axioms [email protected] > $@ && rm [email protected]
$(ONT).json: $(ONT).owl
$(ROBOT) annotate --input $< --ontology-iri $(URIBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) \
convert --check false -f json -o [email protected] &&\
mv [email protected] $@
# -----------------------------------------------------
# Release artefacts: variants (base, full, simple, etc)
# -----------------------------------------------------
SHARED_ROBOT_COMMANDS =
$(ONTOLOGYTERMS): $(SRCMERGED)
$(ROBOT) query -f csv -i $< --query ../sparql/uberon_terms.sparql $@
# ROBOT pipeline that merges imports, including components.
ROBOT_RELEASE_IMPORT_MODE=$(ROBOT) merge --input $<
# ROBOT pipeline that removes imports, then merges components. This is for release artefacts that start from "base"
ROBOT_RELEASE_IMPORT_MODE_BASE=$(ROBOT) remove --input $< --select imports --trim false merge $(patsubst %, -i %, $(OTHER_SRC))
# base: All the axioms as they are editted by the editors, excluding reasoning
$(ONT)-base.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC)
$(ROBOT_RELEASE_IMPORT_MODE_BASE) \
$(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 [email protected] && mv [email protected] $@
# Full: The full artefacts with imports merged, reasoned.
$(ONT)-full.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(IMPORT_FILES)
$(ROBOT_RELEASE_IMPORT_MODE) \
reason --reasoner ELK --equivalent-classes-allowed asserted-only --exclude-tautologies structural \
relax \
reduce -r ELK \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output [email protected] && mv [email protected] $@
# foo-simple: (edit->reason,relax,reduce,drop imports, drop every axiom which contains an entity outside the "namespaces of interest")
# drop every axiom: filter --term-file keep_terms.txt --trim true
# remove --select imports --trim false
$(ONT)-simple.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED) $(IMPORT_FILES)
$(ROBOT_RELEASE_IMPORT_MODE) \
reason --reasoner ELK --equivalent-classes-allowed asserted-only --exclude-tautologies structural \
relax \
remove --axioms equivalent \
relax \
filter --term-file $(SIMPLESEED) --select "annotations ontology anonymous self" --trim true --signature true \
reduce -r ELK \
query --update ../sparql/inject-subset-declaration.ru --update ../sparql/inject-synonymtype-declaration.ru \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output [email protected] && mv [email protected] $@
# foo-basic: A version of -simple containing only relationships using relations on a configurable whitelist (default = BFO:0000050 (?)).
# See above (David comment) for explanation.
# removes any axioms that contains one of the ops that not in the whitelist file
$(ONT)-basic.owl: $(EDIT_PREPROCESSED) $(OTHER_SRC) $(SIMPLESEED) $(KEEPRELATIONS) $(IMPORT_FILES)
$(ROBOT_RELEASE_IMPORT_MODE) \
reason --reasoner ELK --equivalent-classes-allowed asserted-only --exclude-tautologies structural \
relax \
remove --axioms equivalent \
remove --axioms disjoint \
remove --term-file $(KEEPRELATIONS) --select complement --select object-properties --trim true \
relax \
filter --term-file $(SIMPLESEED) --select "annotations ontology anonymous self" --trim true --signature true \
reduce -r ELK \
$(SHARED_ROBOT_COMMANDS) annotate --ontology-iri $(ONTBASE)/$@ $(ANNOTATE_ONTOLOGY_VERSION) --output [email protected] && mv [email protected] $@
basic.owl:
echo "ERROR: You have configured a custom release artefact ($@); this release artefact needs to be define in uberon.Makefile!" && false
composite-metazoan.owl:
echo "ERROR: You have configured a custom release artefact ($@); this release artefact needs to be define in uberon.Makefile!" && false
composite-metazoan-basic.owl:
echo "ERROR: You have configured a custom release artefact ($@); this release artefact needs to be define in uberon.Makefile!" && false
composite-vertebrate.owl:
echo "ERROR: You have configured a custom release artefact ($@); this release artefact needs to be define in uberon.Makefile!" && false
composite-vertebrate-basic.owl:
echo "ERROR: You have configured a custom release artefact ($@); this release artefact needs to be define in uberon.Makefile!" && false
common-anatomy.owl:
echo "ERROR: You have configured a custom release artefact ($@); this release artefact needs to be define in uberon.Makefile!" && false
# ----------------------------------------
# Debugging Tools
# ----------------------------------------
explain_unsat: $(EDIT_PREPROCESSED)
$(ROBOT) explain -i $< -M unsatisfiability --unsatisfiable random:10 --explanation $(TMPDIR)/[email protected]
RELEASE_ASSETS_AFTER_RELEASE=$(foreach n,$(RELEASE_ASSETS), ../../$(n))
GHVERSION=v$(VERSION)
.PHONY: public_release
public_release:
@test $(GHVERSION)
ls -alt $(RELEASE_ASSETS_AFTER_RELEASE)
gh release create $(GHVERSION) --title "$(VERSION) Release" --draft $(RELEASE_ASSETS_AFTER_RELEASE) --generate-notes
# ----------------------------------------
# General Validation
# ----------------------------------------
TSV=
ALL_TSV_FILES=$(DOSDP_TSV_FILES_DEFAULT)
validate-tsv: $(TSV) | $(TMPDIR)
for FILE in $< ; do \
tsvalid $$FILE > $(TMPDIR)/validate.txt; \
if [ -s $(TMPDIR)/validate.txt ]; then cat $(TMPDIR)/validate.txt && exit 1; fi ; \
done
validate-all-tsv: $(ALL_TSV_FILES)
$(MAKE) validate-tsv TSV="$^"
# ----------------------------------------
# Editors Utilities
# ----------------------------------------
.PHONY: normalize_obo_src
normalize_obo_src: $(SRC)
$(OWLTOOLS) $< --merge-axiom-annotations -o -f obo $(TMPDIR)/NORM.obo &&\
$(ROBOT) convert -i $(TMPDIR)/NORM.obo -o $(TMPDIR)/NORM.tmp.obo &&\
mv $(TMPDIR)/NORM.tmp.obo $(SRC)
.PHONY: normalize_src
normalize_src: $(SRC)
$(ROBOT) convert -i $< -f obo --check false -o $(TMPDIR)/normalise && mv $(TMPDIR)/normalise $<
.PHONY: validate_idranges
validate_idranges:
amm $(SCRIPTSDIR)/validate_id_ranges.sc uberon-idranges.owl
.PHONY: update_repo
update_repo:
sh $(SCRIPTSDIR)/update_repo.sh
update_docs:
mkdocs gh-deploy --config-file ../../mkdocs.yaml
# Note to future generations: prepending ./ is a safety measure to ensure that
# the environment does not malicously set `CLEANFILES` to `\`.
.PHONY: clean
clean:
$(MAKE) pattern_clean
[ -n "$(MIRRORDIR)" ] && [ $(MIRRORDIR) != "." ] && [ $(MIRRORDIR) != "/" ] && [ $(MIRRORDIR) != ".." ] && [ -d ./$(MIRRORDIR) ] && rm -rf ./$(MIRRORDIR)/*
[ -n "$(TMPDIR)" ] && [ $(TMPDIR) != "." ] && [ $(TMPDIR) != "/" ] && [ $(TMPDIR) != ".." ] && [ -d ./$(TMPDIR) ] && rm -rf ./$(TMPDIR)/*
[ -n "$(UPDATEREPODIR)" ] && [ $(UPDATEREPODIR) != "." ] && [ $(UPDATEREPODIR) != "/" ] && [ $(UPDATEREPODIR) != ".." ] && [ -d ./$(UPDATEREPODIR) ] && rm -rf ./$(UPDATEREPODIR)/*
rm -f $(CLEANFILES)
.PHONY: help
help:
@echo "$$data"
define data
Usage: [IMAGE=(odklite|odkfull)] [ODK_DEBUG=yes] sh run.sh make [(IMP|MIR|IMP_LARGE|PAT)=(false|true)] command
----------------------------------------
Command reference
----------------------------------------
Core commands:
* prepare_release: Run the entire release pipeline. Use make IMP=false prepare_release to avoid rerunning the imports
* prepare_release_fast: Run the entire release pipeline without refreshing imports, recreating components or recompiling patterns.
* update_repo: Update the ODK repository setup using the config file uberon-odk.yaml
* test: Running all validation tests
* odkversion: Show the current version of the ODK Makefile and ROBOT.
* clean: Delete all temporary files
* help: Print ODK Usage information
* public_release: Uploads the release file to a release management system, such as GitHub releases. Must be configured.
Imports management:
* refresh-imports: Refresh all imports and mirrors.
* recreate-components: Recreate all components.
* no-mirror-refresh-imports: Refresh all imports without downloading mirrors.
* refresh-imports-excluding-large: Refresh all imports and mirrors, but skipping the ones labelled as 'is_large'.
* refresh-%: Refresh a single import, i.e. refresh-go will refresh 'imports/go_import.owl'.
* no-mirror-refresh-%: Refresh a single import without updating the mirror, i.e. refresh-go will refresh 'imports/go_import.owl'.
* mirror-%: Refresh a single mirror.
DOSDP templates
* dosdp: Run the DOSDP patterns pipeline: Run tests, then build OWL files from the tables.
* patterns: Alias of the 'dosdp' command
* pattern_clean: Delete all temporary pattern files
* dosdp_validation: Run all validation checks on DOSDP template files and tables
* pattern_schema_checks: Alias of the 'dosdp_validation' command
* update_patterns: Pull updated patterns listed in dosdp-patterns/external.txt
* dosdp-matches-%: Run the DOSDP matches/query pipeline as configured in your uberon-odk.yaml file.
Editor utilities:
* validate_idranges: Make sure your ID ranges file is formatted correctly
* normalize_src: Load and safe your uberon-edit file after you to make sure its serialised correctly
* normalize_obo_src: Load and safe your uberon-edit.obo file after you to merge duplicate annotation assertions
* explain_unsat: If you have unsatisfiable classes, this command will create a markdown file (tmp/explain_unsat.md) which will explain all your unsatisfiable classes
* validate-all-tsv: Check all your tsv files for possible problems in syntax. Use ALL_TSV_FILES variable to list files
* validate-tsv: Check a tsv file for syntactic problems with tsvalid. Use TSV variable to pass filepath, e.g. make TSV=../my.tsv validate-tsv.
* release_diff: Create a diff between the current release and the new release
Additional build commands (advanced users)
* all: Run the entire pipeline (like prepare_release), but without copying the release files to the release directory.
* all_subsets: Build all subsets
* custom_reports: Generate all custom sparql reports you have configured in your uberon-odk.yaml file.
* all_assets: Build all assets
* show_assets: Print a list of all assets that would be build by the release pipeline
* all_mappings: Update all SSSOM mapping sets
Additional QC commands (advanced users)
* robot_reports: Run all configured ROBOT reports
* validate_profile_%: Run an OWL2 DL profile validation check, for example validate_profile_uberon-edit.owl.
* reason_test: Run a basic reasoning test
Examples:
* sh run.sh make IMP=false prepare_release
* sh run.sh make update_repo
* sh run.sh make test
Tricks:
* Add -B to the end of your command to force re-running it even if nothing has changed
* Use the IMAGE parameter to the run.sh script to use a different image like odklite
* Use ODK_DEBUG=yes sh run.sh make ... to print information about timing and debugging
endef
export data
include uberon.Makefile