This repository has been archived by the owner on Jul 12, 2019. It is now read-only.
forked from OBOFoundry/COB
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
100 lines (77 loc) · 4.02 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
# config
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
.SECONDARY:
OBO = http://purl.obolibrary.org/obo/
CORE = obo-core.owl
MODULES = generic physical biological human science
PREFIX = 'CORE: http://purl.obolibrary.org/CORE_'
GENERIC_SHEET = https://docs.google.com/spreadsheets/d/e/2PACX-1vRGrxd10VuAmb55RqWEzft8q64mI0Ryr8biOb3K8Sx281Xv0NyRVwhr-Z_0IjFWra8dPmHYeKng6PbS/pub?gid=1709706289&single=true&output=tsv
PHYSICAL_SHEET = https://docs.google.com/spreadsheets/d/e/2PACX-1vRGrxd10VuAmb55RqWEzft8q64mI0Ryr8biOb3K8Sx281Xv0NyRVwhr-Z_0IjFWra8dPmHYeKng6PbS/pub?gid=2144007357&single=true&output=tsv
BIOLOGICAL_SHEET = https://docs.google.com/spreadsheets/d/e/2PACX-1vRGrxd10VuAmb55RqWEzft8q64mI0Ryr8biOb3K8Sx281Xv0NyRVwhr-Z_0IjFWra8dPmHYeKng6PbS/pub?gid=663651851&single=true&output=tsv
HUMAN_SHEET = https://docs.google.com/spreadsheets/d/e/2PACX-1vRGrxd10VuAmb55RqWEzft8q64mI0Ryr8biOb3K8Sx281Xv0NyRVwhr-Z_0IjFWra8dPmHYeKng6PbS/pub?gid=1499631141&single=true&output=tsv
SCIENCE_SHEET = https://docs.google.com/spreadsheets/d/e/2PACX-1vRGrxd10VuAmb55RqWEzft8q64mI0Ryr8biOb3K8Sx281Xv0NyRVwhr-Z_0IjFWra8dPmHYeKng6PbS/pub?gid=1951374411&single=true&output=tsv
core: $(CORE)
$(CORE): $(MODULES)
$(eval INPUTS := $(foreach I,$(shell ls modules), --input modules/$(I)))
robot --prefix $(PREFIX) merge $(INPUTS) \
annotate --ontology-iri $(OBO)obo-core.owl --output $@
# ---------- MODULES ---------- #
generic: modules/generic.owl
modules/generic.owl: templates/generic.tsv
robot --prefix $(PREFIX) template --template $< \
annotate --ontology-iri $(OBO)obo-core/$@\
--output $@
physical: modules/physical.owl
modules/physical.owl: templates/physical.tsv | modules/generic.owl
robot --prefix $(PREFIX) merge $(foreach I,$|, --input $(I)) \
template --template $< --ontology-iri $(OBO)obo-core/$@\
--output $@
biological: modules/biological.owl
modules/biological.owl: templates/biological.tsv | modules/generic.owl
robot --prefix $(PREFIX) merge $(foreach I,$|, --input $(I)) \
template --template $< --ontology-iri $(OBO)obo-core/$@\
--output $@
human: modules/human.owl
modules/human.owl: templates/human.tsv | modules/generic.owl modules/biological.owl
robot --prefix $(PREFIX) merge $(foreach I,$|, --input $(I)) \
template --template $< --ontology-iri $(OBO)obo-core/$@\
--output $@
science: modules/science.owl
modules/science.owl: templates/science.tsv | modules/generic.owl modules/human.owl
robot --prefix $(PREFIX) merge $(foreach I,$|, --input $(I)) \
template --template $< --ontology-iri $(OBO)obo-core/$@\
--output $@
# ---------- TEMPLATES ---------- #
templates:
mkdir -p $@
.PHONY: templates/generic.tsv
templates/generic.tsv: | templates
curl "$(GENERIC_SHEET)" > $@
.PHONY: templates/physical.tsv
templates/physical.tsv:
curl "$(PHYSICAL_SHEET)" > $@
.PHONY: templates/biological.tsv
templates/biological.tsv:
curl "$(BIOLOGICAL_SHEET)" > $@
.PHONY: templates/human.tsv
templates/human.tsv:
curl "$(HUMAN_SHEET)" > $@
.PHONY: templates/science.tsv
templates/science.tsv:
curl "$(SCIENCE_SHEET)" > $@
# ---------- ALIGNMENT ---------- #
# Currentlh this requires installing some tools - I will set up a docker for running these...
XONTS = ro sio biotop bfoc mesh chebi blmod common_core
all_matches: $(patsubst %, matches/matches-%.tsv, $(XONTS))
matches/matches-%.tsv: manual-core.owl
rdfmatch -d rdf_matcher -G imports/matches-$*.owl --predicate skos:exactMatch --prefix CORE -f tsv -l -A ~/repos/onto-mirror/void.ttl -i prefixes.ttl -i $< -i $* new_match > $@.tmp && cut -f1-4 $@.tmp | sort -u > $@
# match to wikidata
matches/wd-closematches.ttl: manual-core.owl
wd-ontomatch -d ontomatcher -i $< -a wikidata_ontomatcher:cached_db_file=$@ -e match_classes
matches/wd-align.tsv: manual-core.owl matches/wd-closematches.ttl
rdfmatch -d rdf_matcher -G imports/matches-wd.owl --predicate skos:closeMatch --prefix CORE -f tsv -l -A ~/repos/onto-mirror/void.ttl -i prefixes.ttl -i $< -i wd-closematches.ttl exact > $@.tmp && cut -f1-9,11,15-19 $@.tmp > $@