forked from geneontology/noctua-models
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
150 lines (110 loc) · 5.16 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
OBO= http://purl.obolibrary.org/obo
GO=../go/ontology
GOX=$(GO)/extensions
# default catalog
CAT=catalog-v001.xml
# fake catalog that rewires go-lego to null
# NOTE: problematic for OWLAPI, lack of declarations
FAKECAT=fake-catalog.xml
# catalog that rewires go-lego to local cache
MIRROR = mirror-catalog.xml
# catalog that rewires go-lego to extracted minimal module
MODCAT = module-catalog.xml
all: noctua-models.owl noctua-models-merged.owl noctua-models-noimport.owl
test: all
clean:
rm -rf $(MIRROR)
# travis has issues loading the complete set of ontologies in go-lego (memory, timeout)
# instead we therefore perform a bare-bones OWL syntax check using the OWLAPI on each model.
# we use the fake-catalog which rewires go-lego.owl to an empty file.
travis-test:
owltools --catalog-xml fake-catalog.xml models/*.ttl
# ----------------------------------------
# EXPORT TO GPAD
# ----------------------------------------
# TODO: replace logic in https://build.berkeleybop.org/job/export-lego-to-gpad-sparql with this
make_gpad_dir:
rm -rf legacy ;\
mkdir -p legacy/gpad
minerva:
git clone https://github.com/geneontology/minerva.git
build_minerva: minerva
cd minerva && ./build-cli.sh && chmod 755 minerva-cli/bin/minerva-cli.sh && touch $@
MINERVA_CLI_MEMORY=10G
blazegraph.jnl:
MINERVA_CLI_MEMORY=$(MINERVA_CLI_MEMORY) && minerva/minerva-cli/bin/minerva-cli.sh --import-owl-models -f models -j $@.tmp && mv $@.tmp $@
.PRECIOUS: blazegraph.jnl
write-gpad: blazegraph.jnl
MINERVA_CLI_MEMORY=$(MINERVA_CLI_MEMORY) minerva/minerva-cli/bin/minerva-cli.sh $(GPAD_MINERVA_ARGS) --lego-to-gpad-sparql --ontology http://purl.obolibrary.org/obo/go/extensions/go-lego.owl -i blazegraph.jnl --gpad-output legacy/gpad
# collates by-model gpads into per-MOD gpads (directly under legacy/)
# see
# https://github.com/geneontology/go-site/issues/431
collate-gpads:
./util/collate-gpads.pl legacy/gpad/*gpad
# ----------------------------------------
# COMBINED MODELS
# ----------------------------------------
TTL = -o -f ttl $(subst .owl,.ttl,$@.ttl)
# - combined models
# - imports preserved
noctua-models.owl: $(MIRROR)
owltools --catalog-xml $(MIRROR) models/*.ttl --merge-support-ontologies --set-ontology-id http://model.geneontology.org/noctua-models.owl -o $@ $(TTL)
# owltools --catalog-xml $(MIRROR) models/*.ttl --merge-support-ontologies --label-abox --set-ontology-id http://model.geneontology.org/noctua-models.owl -o $@ $(TTL)
# - combined models
# - imports -> module -> merged
noctua-models-merged.owl: noctua-models.owl target/go-lego-module.owl
owltools --catalog-xml $(MODCAT) $< --merge-imports-closure -o $@ $(TTL)
# - combined models
# - imports: REMOVED
noctua-models-noimport.owl: noctua-models.owl
owltools --catalog-xml $(FAKECAT) $< --remove-imports-declarations -o $@ $(TTL)
# test: add labels to all abox members
noctua-models-labeled.owl: target/go-lego-module.owl
owltools --catalog-xml catalog-v001.xml $< --label-abox -o -f ttl $@
noctua-importer.owl:
./util/make-import.pl models > $@ && catalog-yaml-to-xml.py multimodel-catalog.yaml module-catalog.yaml > multimodel-catalog.xml
# Add abox labels
%-labeled.owl: %.owl
owltools use-catalog $< --label-abox -o -f ttl $@
# combined models, converted to obographs
# note: why merge first?
noctua-models.json: noctua-models.owl
minerva-cli.sh --catalog-xml $(FAKECAT) --owl-lego-to-json -i $< --pretty-json -o $@
# combined models, no imports, turtle
# (this is an intermediate target)
target/m.owl-ttl:
owltools --catalog-xml $(FAKECAT) models/* --merge-support-ontologies --remove-imports-declarations -o -f ttl $@
# as above, roundtripped
target/m.ttl: target/m.owl-ttl
riot $< > $@
# ----------------------------------------
# MODULES
# ----------------------------------------
# create a complete module
target/go-lego-module.owl: $(MIRROR)
owltools --catalog-xml $(MIRROR) models/* --merge-support-ontologies --extract-module -c -s $(OBO)/go/extensions/go-lego.owl -o $@
# use owltools slurp-import-chain to mirror all imports
$(MIRROR):
owltools $(OBO)/go/extensions/go-lego.owl --sic -d . -c $@
debug.owl:
owltools --catalog-xml $(MIRROR) $(OBO)/go/extensions/go-lego.owl --run-reasoner -r elk -u -m $@
# ----------------------------------------
# PER-MODEL FILES
# ----------------------------------------
# direct ttl translation, no imports
#target/%.ttl: models/%
# owltools --catalog-xml $(FAKECAT) $< --remove-imports-declarations -o -f ttl $@
# a module for an individual model
# (intermediate target, see next step)
target/%-module.owl: models/%.ttl $(MIRROR)
owltools --catalog-xml $(MIRROR) $< --merge-support-ontologies --extract-module -n $(OBO)/go/noctua/$@ -c -s $(OBO)/go/extensions/go-lego.owl -o $@
.PRECIOUS: target/%-module.owl
# a model merged with its module
target/%-plus-module.owl: models/%.ttl target/%-module.owl
owltools --catalog-xml $(FAKECAT) $^ --merge-support-ontologies --remove-imports-declarations --label-abox -o $@
target/%.json: models/%
owltools --catalog-xml $(FAKECAT) $< --remove-imports-declarations -o -f json $@
%.obo: %.owl
owltools --catalog-xml $(FAKECAT) $< --set-ontology-id $(OBO)/test/$@ -o -f obo --no-check $@
%.json: %.owl
owltools --catalog-xml $(FAKECAT) $< -o -f json $@