-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
594 lines (448 loc) · 18.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
#JAVA_OPTS="-Xmx70G"
BUILD_DIR=build
RESOURCES=resources
REGRESSION=/tools/regression.py
SPARQL=sparql
ROBOT_ENV=ROBOT_JAVA_ARGS=-Xmx80G
ROBOT=$(ROBOT_ENV) robot
JVM_ARGS=JVM_ARGS=-Xmx80G
ARQ=$(JVM_ARGS) arq
RIOT=riot
BLAZEGRAPH-RUNNER=JAVA_OPTS=-Xmx80G blazegraph-runner
BIO-ONTOLOGIES=ontologies.ofn
# Path to data repo; must be separately downloaded/cloned
NEXML_DATA=phenoscape-data
NEXML_SUBDIRS_FILE=nexml-subdirs.txt
DB_FILE=$(BUILD_DIR)/blazegraph-loaded-all.jnl
BLAZEGRAPH_PROPERTIES=$(RESOURCES)/blazegraph.properties
MONARCH=https://data.monarchinitiative.org/dev
# ---------------------------------------------------------------------
clean:
rm -rf $(BUILD_DIR)
# ########## # ##########
# ########## # ##########
# Modules:
# 1. KB build
# 2. Semantic similarity
all: kb-build ss-scores-gen $(DB_FILE)
# ########## # ##########
# ########## # ##########
# ********** * **********
# ########## # ##########
# ########## # ##########
# Module 1 ---> KB build
# ########## # ##########
# Products
# 1. Phenoscape KB
# 2. Phenoscape KB TBox Hierarchy
kb-build: $(BUILD_DIR)/phenoscape-kb.ttl $(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl
# ########## # ##########
# ##########
# 1. Phenoscape KB
$(BUILD_DIR)/phenoscape-kb.ttl: $(BUILD_DIR)/ontology-metadata.ttl $(BUILD_DIR)/phenex-data+tbox.ttl $(BUILD_DIR)/monarch-data-merged.ttl $(BUILD_DIR)/gene-profiles.ttl $(BUILD_DIR)/absences.ttl $(BUILD_DIR)/presences.ttl $(BUILD_DIR)/evolutionary-profiles.ttl
$(RIOT) --verbose --nocheck --output=NTRIPLES \
$(BUILD_DIR)/ontology-metadata.ttl \
$(BUILD_DIR)/phenex-data+tbox.ttl \
$(BUILD_DIR)/monarch-data-merged.ttl \
$(BUILD_DIR)/gene-profiles.ttl \
$(BUILD_DIR)/absences.ttl \
$(BUILD_DIR)/presences.ttl \
$(BUILD_DIR)/evolutionary-profiles.ttl \
> $@.tmp && mv $@.tmp $@
# ----------
# 2. Phenoscape KB TBox Hierarchy
# Compute Tbox hierarchy
$(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl: $(BUILD_DIR)/phenoscape-kb-tbox-classified.ttl $(SPARQL)/subclassHierarchy.sparql
$(ARQ) -q --data=$< --query=$(SPARQL)/subclassHierarchy.sparql --results=ttl > $@.tmp \
&& mv $@.tmp $@
# ##########
# ##########
# Component 1 --> Imported bio-ontologies' metadata
# Extract ontology metadata
# ## Query for ontologies' version information
$(BUILD_DIR)/ontology-metadata.ttl: $(BIO-ONTOLOGIES) $(BUILD_DIR)/mirror $(SPARQL)/ontology-versions.sparql
$(ROBOT) query \
--catalog $(BUILD_DIR)/mirror/catalog-v001.xml \
-i $< \
--use-graphs true \
--format ttl \
--query $(SPARQL)/ontology-versions.sparql $@.tmp \
&& mv $@.tmp $@
# ----------
# Mirror ontologies locally
# $(ONTOLOGIES) - list of ontologies to be imported
$(BUILD_DIR)/mirror: $(BIO-ONTOLOGIES)
rm -rf $@ ; \
$(ROBOT) mirror -i $< -d $@ -o $@/catalog-v001.xml
# ##########
# ##########
# Component 2 --> Phenex data + TBox
# Create Phenex data + TBox KB
$(BUILD_DIR)/phenex-data+tbox.ttl: $(BUILD_DIR)/phenex-data-merged.ofn $(BUILD_DIR)/phenoscape-kb-tbox-classified.ttl
$(ROBOT) merge \
-i $(BUILD_DIR)/phenex-data-merged.ofn \
-i $(BUILD_DIR)/phenoscape-kb-tbox-classified.ttl \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# Store paths to all needed Phenex NeXML files in NEXMLS variable
NEXML_SUBDIRS := $(addprefix ${NEXML_DATA}/, $(shell cat ${NEXML_SUBDIRS_FILE}))
NEXMLS := $(shell find $(NEXML_SUBDIRS) -type f -name "*.xml")
# Store paths to all OFN files which will be produced from NeXML files in NEXML_OWLS variable
NEXML_OWLS := $(patsubst %.xml, %.ofn, $(patsubst $(NEXML_DATA)/%, $(BUILD_DIR)/phenex-data-owl/%, $(NEXMLS)))
# Convert a single NeXML file to its counterpart OFN
$(BUILD_DIR)/phenex-data-owl/%.ofn: $(NEXML_DATA)/%.xml $(BUILD_DIR)/bio-ontologies-merged.ttl
mkdir -p $(dir $@) \
&& kb-owl-tools convert-nexml $(BUILD_DIR)/bio-ontologies-merged.ttl $< $@.tmp \
&& mv $@.tmp $@
# Generate phenex-data-merged.ofn
# Merge all Phenex NeXML OFN files into a single ontology of phenotype annotations
$(BUILD_DIR)/phenex-data-merged.ofn: $(NEXML_OWLS)
$(ROBOT) merge $(addprefix -i , $(NEXML_OWLS)) \
convert --format ofn \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# Generate phenoscape-kb-tbox-classified.ofn
# Compute final inferred classification of Phenoscape KB Tbox
$(BUILD_DIR)/phenoscape-kb-tbox-classified.ttl: $(BUILD_DIR)/phenoscape-kb-tbox-classified-plus-absence.ttl
$(ROBOT) reason \
--reasoner ELK \
--axiom-generators "SubClass EquivalentClass" \
--exclude-duplicate-axioms true \
--exclude-tautologies structural \
--i $< \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# Generate phenoscape-kb-tbox-classified-plus-absence.ttl
$(BUILD_DIR)/phenoscape-kb-tbox-classified-plus-absence.ttl: $(BUILD_DIR)/phenoscape-kb-tbox-classified-pre-absence-reasoning.ofn $(BUILD_DIR)/negation-hierarchy.ofn
$(ROBOT) merge \
-i $(BUILD_DIR)/phenoscape-kb-tbox-classified-pre-absence-reasoning.ofn \
-i $(BUILD_DIR)/negation-hierarchy.ofn \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# Generate negation-hierarchy.ofn
$(BUILD_DIR)/negation-hierarchy.ofn: $(BUILD_DIR)/phenoscape-kb-tbox-classified-pre-absence-reasoning.ofn
kb-owl-tools assert-negation-hierarchy $< $@.tmp \
&& mv $@.tmp $@
# ----------
# Generate phenoscape-kb-tbox-classified-pre-absence-reasoning.ofn
$(BUILD_DIR)/phenoscape-kb-tbox-classified-pre-absence-reasoning.ofn: $(BUILD_DIR)/phenoscape-kb-tbox.ofn
$(ROBOT) reason \
-i $< \
--reasoner ELK \
--axiom-generators "SubClass EquivalentClass" \
--exclude-duplicate-axioms true \
--exclude-tautologies structural \
convert --format ofn \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# Generate phenoscape-kb-tbox.ofn
$(BUILD_DIR)/phenoscape-kb-tbox.ofn: $(BUILD_DIR)/bio-ontologies-classified.ttl \
$(BUILD_DIR)/defined-by-links.ttl \
$(BUILD_DIR)/phenex-tbox.ofn \
$(BUILD_DIR)/anatomical-entity-implies_presence_of.ofn \
$(BUILD_DIR)/anatomical-entity-absences.ofn \
$(BUILD_DIR)/anatomical-entity-part_of.ofn \
$(BUILD_DIR)/hasParts.ofn \
$(BUILD_DIR)/anatomical-entity-has_part_inhering_in.ofn \
$(BUILD_DIR)/anatomical-entity-phenotype_of.ofn \
$(BUILD_DIR)/anatomical-entity-phenotype_of_part_of.ofn \
$(BUILD_DIR)/anatomical-entity-phenotype_of_develops_from.ofn
$(ROBOT) merge \
$(addprefix -i ,$^) \
convert --format ofn \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# *** Subsumers ***
# -----
$(BUILD_DIR)/defined-by-links.ttl: $(BUILD_DIR)/bio-ontologies-merged.ttl $(SPARQL)/isDefinedBy.sparql
$(ROBOT) query \
--use-graphs true \
--format ttl \
--input $< \
--query $(SPARQL)/isDefinedBy.sparql $@
$(BUILD_DIR)/anatomical-entity-%.ofn: patterns/%.yaml $(BUILD_DIR)/anatomical-entities.txt $(BUILD_DIR)/bio-ontologies-merged.ttl
mkdir -p $(dir $@) \
&& dosdp-tools generate \
--generate-defined-class=true \
--obo-prefixes=true \
--ontology=$(BUILD_DIR)/bio-ontologies-merged.ttl \
--template=$< \
--infile=$(BUILD_DIR)/anatomical-entities.txt \
--outfile=$@.tmp \
&& mv $@.tmp $@
$(BUILD_DIR)/hasParts.ofn: $(BUILD_DIR)/anatomical-entities.txt $(BUILD_DIR)/qualities.txt patterns/has_part.yaml $(BUILD_DIR)/bio-ontologies-merged.ttl
mkdir -p $(dir $@) \
&& sed '1d' $(BUILD_DIR)/qualities.txt > $(BUILD_DIR)/qualities--header.txt \
&& cat $(BUILD_DIR)/anatomical-entities.txt $(BUILD_DIR)/qualities--header.txt > $(BUILD_DIR)/anatomical-entities++qualities.txt \
&& dosdp-tools generate \
--generate-defined-class=true \
--obo-prefixes=true \
--ontology=$(BUILD_DIR)/bio-ontologies-merged.ttl \
--template=patterns/has_part.yaml \
--infile=$(BUILD_DIR)/anatomical-entities++qualities.txt \
--outfile=$@.tmp \
&& mv $@.tmp $@
# -----
# Generate anatomical-entities.txt
$(BUILD_DIR)/anatomical-entities.txt: $(BUILD_DIR)/bio-ontologies-classified.ttl $(BUILD_DIR)/defined-by-links.ttl $(SPARQL)/anatomicalEntities.sparql
$(ARQ) \
-q \
--data=$< \
--data=$(BUILD_DIR)/defined-by-links.ttl \
--results=TSV \
--query=$(SPARQL)/anatomicalEntities.sparql > $@.tmp \
&& sed 's/^\?//' $@.tmp > $@.tmp2 \
&& rm $@.tmp && mv $@.tmp2 $@
# Generate qualities.txt
$(BUILD_DIR)/qualities.txt: $(BUILD_DIR)/bio-ontologies-classified.ttl $(SPARQL)/qualities.sparql
$(ROBOT) query \
-i $< \
--use-graphs true \
--query $(SPARQL)/qualities.sparql $@.tmp \
&& mv $@.tmp $@
# -----
# ----------
# Generate bio-ontologies-classified.ttl
# Compute inferred classification of just the input ontologies.
# We need to remove axioms that can infer unsatisfiability, since
# the input ontologies are not 100% compatible.
$(BUILD_DIR)/bio-ontologies-classified.ttl: $(BUILD_DIR)/bio-ontologies-merged.ttl
$(ROBOT) remove -i $< --axioms 'disjoint' --trim true \
remove --term 'owl:Nothing' --trim true \
reason \
--reasoner ELK \
--axiom-generators "SubClass EquivalentClass" \
--exclude-duplicate-axioms true \
--exclude-tautologies structural \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# Merge imported ontologies
# Remove root ZP phenotype because it attracts anything related to 'abnormal' (sizes) during semantic similarity calculations
$(BUILD_DIR)/bio-ontologies-merged.ttl: $(BIO-ONTOLOGIES) mod_taxa.ttl $(BUILD_DIR)/mirror $(SPARQL)/update_zfa_labels.ru $(SPARQL)/update_xao_labels.ru
$(ROBOT) merge \
--catalog $(BUILD_DIR)/mirror/catalog-v001.xml \
-i $< \
-i mod_taxa.ttl \
query \
--update $(SPARQL)/update_zfa_labels.ru \
--update $(SPARQL)/update_xao_labels.ru \
remove --term 'ZP:00000000' --trim true \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# Generate phenex-tbox.ofn
# Remove abox axioms from phenex-data-merged.ofn
$(BUILD_DIR)/phenex-tbox.ofn: $(BUILD_DIR)/phenex-data-merged.ofn
$(ROBOT) remove \
-i $< \
--axioms abox \
convert --format ofn \
-o $@.tmp \
&& mv $@.tmp $@
# ----------
# ##########
# ##########
# Component 3 ---> Monarch data
# Monarch data
# 1. MGI
# 2. ZFIN
# Merge monarch data files
$(BUILD_DIR)/monarch-data-merged.ttl: $(BUILD_DIR)/monarch/mgislim.ttl $(BUILD_DIR)/monarch/zfinslim.ttl $(BUILD_DIR)/monarch-types-labels.ttl
$(ROBOT) merge \
-i $(BUILD_DIR)/monarch/mgislim.ttl \
-i $(BUILD_DIR)/monarch/zfinslim.ttl \
-i $(BUILD_DIR)/monarch-types-labels.ttl \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# Query monarch data for types and labels
$(BUILD_DIR)/monarch-types-labels.ttl: $(SPARQL)/monarch-types-labels.sparql $(BUILD_DIR)/monarch/mgi.ttl $(BUILD_DIR)/monarch/zfin.ttl
$(ARQ) \
-q \
--data=$(BUILD_DIR)/monarch/mgi.ttl \
--data=$(BUILD_DIR)/monarch/zfin.ttl \
--query=$< \
--results=NTRIPLES > $@.tmp \
&& mv $@.tmp $@
# Download MONARCH files
$(BUILD_DIR)/monarch/%:
mkdir -p $(BUILD_DIR)/monarch
curl -L $(MONARCH)/$* -o $@.tmp \
&& mv $@.tmp $@
# ##########
# ##########
# Component 4 ----> Profiles
# Generate gene-profiles.ttl
$(BUILD_DIR)/gene-profiles.ttl: $(BUILD_DIR)/monarch-data-merged.ttl $(SPARQL)/geneProfiles.sparql
$(ROBOT) query \
-i $< \
--format ttl \
--query $(SPARQL)/geneProfiles.sparql $@.tmp \
&& mv $@.tmp $@
# Generate absences.ttl
$(BUILD_DIR)/absences.ttl: $(SPARQL)/absences.sparql $(BUILD_DIR)/subclass-closure.ttl $(BUILD_DIR)/phenex-data+tbox.ttl
$(ARQ) \
-q \
--data=$(BUILD_DIR)/phenex-data+tbox.ttl \
--data=$(BUILD_DIR)/subclass-closure.ttl \
--results=TSV \
--query=$< > $@.tmp \
&& sed -e '1d' -e 's/$$/ ./' $@.tmp > $@.tmp2 \
&& rm $@.tmp && mv $@.tmp2 $@
# Generate presences.ttl
$(BUILD_DIR)/presences.ttl: $(SPARQL)/presences.sparql $(BUILD_DIR)/subclass-closure.ttl $(BUILD_DIR)/phenex-data+tbox.ttl
$(ARQ) \
-q \
--data=$(BUILD_DIR)/phenex-data+tbox.ttl \
--data=$(BUILD_DIR)/subclass-closure.ttl \
--results=TSV \
--query=$< > $@.tmp \
&& sed -e '1d' -e 's/$$/ ./' $@.tmp > $@.tmp2 \
&& rm $@.tmp && mv $@.tmp2 $@
# Generate evolutionary-profiles.ttl
# Contains taxon-profiles data
$(BUILD_DIR)/evolutionary-profiles.ttl: $(BUILD_DIR)/phenex-data+tbox.ttl
kb-owl-tools output-evolutionary-profiles $< $@.tmp \
&& mv $@.tmp $@
# ##########
# ##########
# Component 5 ----> Closures
# Compute subclass closures
$(BUILD_DIR)/subclass-closure.ttl: $(BUILD_DIR)/phenoscape-kb-tbox-classified.ttl $(SPARQL)/subclass-closure-construct.sparql
$(ARQ) \
-q \
--data=$< \
--optimize=off \
--results=TSV \
--query=$(SPARQL)/subclass-closure-construct.sparql > $@.tmp \
&& sed -e '1d' -e 's/$$/ ./' $@.tmp > $@.tmp2 \
&& rm $@.tmp && mv $@.tmp2 $@
# Compute instance closures
$(BUILD_DIR)/instance-closure.ttl: $(SPARQL)/profile-instance-closure-construct.sparql $(BUILD_DIR)/phenex-data+tbox.ttl $(BUILD_DIR)/gene-profiles.ttl $(BUILD_DIR)/evolutionary-profiles.ttl
$(ARQ) \
-q \
--data=$(BUILD_DIR)/phenex-data+tbox.ttl \
--data=$(BUILD_DIR)/gene-profiles.ttl \
--data=$(BUILD_DIR)/evolutionary-profiles.ttl \
--results=NTRIPLES \
--query=$< > $@.tmp \
&& mv $@.tmp $@
# ##########
# ########## # ##########
# ########## # ##########
# ********** * **********
# ########## # ##########
# ########## # ##########
# Module 2 ---> Semantic similarity
# ########## # ##########
# Products
# 1. taxa-pairwise-sim.ttl
# 2. genes-pairwise-sim.ttl
# 3. taxa-expect-scores.ttl
# 4. genes-expect-scores.ttl
ss-scores-gen: $(BUILD_DIR)/taxa-pairwise-sim.ttl \
$(BUILD_DIR)/genes-pairwise-sim.ttl \
$(BUILD_DIR)/taxa-expect-scores.ttl \
$(BUILD_DIR)/genes-expect-scores.ttl
# ########## # ##########
# ##########
# Pairwise similarity for taxa/genes
$(BUILD_DIR)/%-pairwise-sim.ttl: $(BUILD_DIR)/profiles.ttl $(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl
kb-owl-tools pairwise-sim 1 1 $(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl $< $* $@.tmp $(BUILD_DIR)/$*-scores.tsv.tmp \
&& mv $@.tmp $@ && mv $(BUILD_DIR)/$*-scores.tsv.tmp $(BUILD_DIR)/$*-scores.tsv
# ##########
# Generate expect scores for taxa and genes
$(BUILD_DIR)/%-expect-scores.ttl: $(BUILD_DIR)/%-rank-statistics.txt
kb-owl-tools expects-to-triples $< $@.tmp \
&& mv $@.tmp $@
$(BUILD_DIR)/%-rank-statistics.txt: $(BUILD_DIR)/%-scores.tsv $(BUILD_DIR)/%-profile-sizes.txt
python $(REGRESSION) `cat $(BUILD_DIR)/$*-profile-sizes.txt | wc -l` $< $@.tmp \
&& mv $@.tmp $@
# Built along with $(BUILD_DIR)/taxa-pairwise-sim.ttl
$(BUILD_DIR)/%-scores.tsv: $(BUILD_DIR)/%-pairwise-sim.ttl
touch $@
# ----------
# Output profile sizes
$(BUILD_DIR)/profile-sizes.txt: $(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl $(BUILD_DIR)/profiles.ttl
kb-owl-tools output-profile-sizes $< $(BUILD_DIR)/profiles.ttl $@.tmp \
&& mv $@.tmp $@
$(BUILD_DIR)/genes-profile-sizes.txt: $(BUILD_DIR)/profile-sizes.txt
grep -v 'VTO_' $(BUILD_DIR)/profile-sizes.txt > $@.tmp || true \
&& mv $@.tmp $@
$(BUILD_DIR)/taxa-profile-sizes.txt: $(BUILD_DIR)/profile-sizes.txt
grep 'VTO_' $(BUILD_DIR)/profile-sizes.txt > $@.tmp || true \
&& mv $@.tmp $@
# ----------
$(BUILD_DIR)/corpus-ics-%.ttl: $(BUILD_DIR)/profiles.ttl $(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl
kb-owl-tools output-ics $(BUILD_DIR)/phenoscape-kb-tbox-hierarchy.ttl $< $* $@.tmp \
&& mv $@.tmp $@
# ----------
# Generate profiles.ttl for genes and taxa
$(BUILD_DIR)/profiles.ttl: $(BUILD_DIR)/evolutionary-profiles.ttl $(BUILD_DIR)/gene-profiles.ttl
$(ROBOT) merge \
-i $(BUILD_DIR)/evolutionary-profiles.ttl \
-i $(BUILD_DIR)/gene-profiles.ttl \
convert --format ttl \
-o $@.tmp \
&& mv $@.tmp $@
# ##########
# ########## # ##########
# ########## # ##########
$(BUILD_DIR)/phylopics.owl: $(NEXML_DATA)/KB_static_data/phylopics.owl
cp $< $@
$(BUILD_DIR)/vto_ncbi_common_names.owl: $(NEXML_DATA)/KB_static_data/vto_ncbi_common_names.owl
cp $< $@
# ########## # ##########
# ########## # ##########
# ##########
# Load pipeline artifacts into Blazegraph database
# Artifacts:
# 1. Phenoscape KB
# 2. Closures = subclass + instance)
# 3. taxa-sim = taxa-ics + taxa-expect-scores + taxa-pairwise-sim
# 4. gene-sim = gene-ics + gene-expect-scores + gene-pairwise-sim
# 5. build-time
# Insert KB build time in DB
$(BUILD_DIR)/build-time.ttl: $(SPARQL)/build-time.sparql
echo "<http://kb.phenoscape.org/> <http://www.w3.org/2000/01/rdf-schema#label> \"Phenoscape Knowledgebase\" ." > $(BUILD_DIR)/kb-label.ttl && \
$(ARQ) \
-q \
--data=$(BUILD_DIR)/kb-label.ttl \
--results=NTRIPLES \
--query=$< > $@.tmp \
&& mv $@.tmp $@
$(DB_FILE): $(BLAZEGRAPH_PROPERTIES) \
$(BUILD_DIR)/phenoscape-kb.ttl \
$(BUILD_DIR)/subclass-closure.ttl $(BUILD_DIR)/instance-closure.ttl \
$(BUILD_DIR)/corpus-ics-taxa.ttl $(BUILD_DIR)/taxa-expect-scores.ttl $(BUILD_DIR)/taxa-pairwise-sim.ttl \
$(BUILD_DIR)/corpus-ics-genes.ttl $(BUILD_DIR)/genes-expect-scores.ttl $(BUILD_DIR)/genes-pairwise-sim.ttl \
$(BUILD_DIR)/phylopics.owl \
$(BUILD_DIR)/vto_ncbi_common_names.owl \
$(BUILD_DIR)/build-time.ttl
rm -f $@ && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/" $(BUILD_DIR)/phenoscape-kb.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/closure" $(BUILD_DIR)/subclass-closure.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/closure" $(BUILD_DIR)/instance-closure.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/sim/taxa" $(BUILD_DIR)/corpus-ics-taxa.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/sim/taxa" $(BUILD_DIR)/taxa-expect-scores.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/sim/taxa" $(BUILD_DIR)/taxa-pairwise-sim.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/sim/genes" $(BUILD_DIR)/corpus-ics-genes.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/sim/genes" $(BUILD_DIR)/genes-expect-scores.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/sim/genes" $(BUILD_DIR)/genes-pairwise-sim.ttl && \
$(BLAZEGRAPH-RUNNER) load --informat=rdfxml --journal=$@ --properties=$< --graph="http://purl.org/phenoscape/phylopics.owl" $(BUILD_DIR)/phylopics.owl && \
$(BLAZEGRAPH-RUNNER) load --informat=rdfxml --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/" $(BUILD_DIR)/vto_ncbi_common_names.owl && \
$(BLAZEGRAPH-RUNNER) load --informat=turtle --journal=$@ --properties=$< --graph="http://kb.phenoscape.org/" $(BUILD_DIR)/build-time.ttl
# ##########
# ########## # ##########
# ########## # ##########
# ########## # ########## # ########## # THE END # ########## # ########## # ########## #