-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
176 lines (146 loc) · 3.79 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
# Vaccine Ontology (VO) Makefile
# Jie Zheng
#
# This Makefile is used to build artifacts for the Vaccine Ontology.
#
### Configuration
#
# prologue:
# <http://clarkgrubb.com/makefile-style-guide#toc2>
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
### Definitions
SHELL := /bin/bash
OBO := http://purl.obolibrary.org/obo
VO := $(OBO)/VO_
TODAY := $(shell date +%Y-%m-%d)
### Directories
#
# This is a temporary place to put things.
build:
mkdir -p $@
### ROBOT
#
# We use the latest official release version of ROBOT
build/robot.jar: | build
curl -L -o $@ "https://github.com/ontodev/robot/releases/latest/download/robot.jar"
ROBOT := java -jar build/robot.jar
### Imports
#
# Use Ontofox to import various modules.
build/%_import.owl: src/Ontofox_input/%_import_input.txt | build/robot.jar build
curl -s -F file=@$< -o $@ https://ontofox.hegroup.org/service.php
# Use ROBOT to remove external java axioms
src/imports/%_import.owl: build/%_import.owl
$(ROBOT) remove --input build/$*_import.owl \
--base-iri 'http://purl.obolibrary.org/obo/$*_' \
--axioms external \
--preserve-structure false \
--trim false \
--output $@
IMPORT_FILES := $(wildcard src/imports/*_import.owl)
.PHONY: imports
imports: $(IMPORT_FILES)
### Templates
#
src/modules/%.owl: src/templates/%.csv | build/robot.jar
echo '' > $@
$(ROBOT) merge \
--input src/vo_edit.owl \
template \
--template $< \
--prefix "VO: http://purl.obolibrary.org/obo/VO_" \
--ontology-iri "http://purl.obolibrary.org/obo/vo/dev/$(notdir $@)" \
--output $@
# Update all modules
MODULE_NAMES := vaccine\
vaccine_adjuvant\
vaccine_component\
data_item\
process\
site\
gene\
protein\
other\
individuals\
vo_annotationProp\
vo_objectProp\
vo_CVX_code\
vo_RxNorm\
vo_FDA\
vo_VIOLIN\
obsolete
MODULE_FILES := $(foreach x,$(MODULE_NAMES),src/modules/$(x).owl)
.PHONY: modules
modules: $(MODULE_FILES)
# Build views
CVO/cvo.owl: vo.owl src/views/cvo.txt | build/robot.jar
$(ROBOT) extract \
--input $< \
--method STAR \
--term-file $(word 2,$^) \
--individuals definitions \
--copy-ontology-annotations true \
annotate \
--ontology-iri "$(OBO)/vo/cvo.owl" \
--version-iri "$(OBO)/vo/releases/$(TODAY)/cvo.owl" \
--output $@
CVX-VO/cvx-vo.owl: vo.owl src/views/cvx-vo.txt | build/robot.jar
$(ROBOT) extract \
--input $< \
--method STAR \
--term-file $(word 2,$^) \
--individuals definitions \
--copy-ontology-annotations true \
annotate \
--ontology-iri "$(OBO)/vo/cvx-vo.owl" \
--version-iri "$(OBO)/vo/releases/$(TODAY)/cvx-vo.owl" \
--output $@
.PHONY: views
views: CVO/cvo.owl CVX-VO/cvx-vo.owl
### Build
#
# Here we create a standalone OWL file appropriate for release.
# This involves merging, reasoning, annotating,
# and removing any remaining import declarations.
build/vo-merged.owl: src/vo_edit.owl | build/robot.jar build
$(ROBOT) merge \
--input $< \
annotate \
--ontology-iri "$(OBO)/vo/vo-merged.owl" \
--version-iri "$(OBO)/vo/releases/$(TODAY)/vo-merged.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output build/vo-merged.tmp.owl
sed '/<owl:imports/d' build/vo-merged.tmp.owl > $@
rm build/vo-merged.tmp.owl
vo.owl: build/vo-merged.owl
$(ROBOT) reason \
--input $< \
--reasoner ELK \
annotate \
--ontology-iri "$(OBO)/vo.owl" \
--version-iri "$(OBO)/vo/releases/$(TODAY)/vo.owl" \
--annotation owl:versionInfo "$(TODAY)" \
--output $@
robot_report.tsv: build/vo-merged.owl
$(ROBOT) report \
--input $< \
--fail-on none \
--output $@
vo_terms.tsv: build/vo-merged.owl
$(ROBOT) query \
--input $< \
--query SPARQL/get_VO_terms.rq $@
###
#
# Full build
.PHONY: all
all: vo.owl robot_report.tsv vo_terms.tsv CVO/cvo.owl CVX-VO/cvx-vo.owl
# Remove generated files
.PHONY: clean
clean:
rm -rf build