forked from monarch-initiative/dipper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
154 lines (114 loc) · 4.27 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
###
### Environment variables.
###
DIPPER_BIN = ./dipper-etl.py --debug
TEST = python -m unittest
VENV != python ./scripts/within_pip_env.py
# $(warning python virtual env detection report $(VENV))
NP=4
PYUTEST = @(echo $@ && [ $(VENV) -eq 0 ] && $(TEST) tests/[email protected])||(echo "Not in python virtual enviroment or ERROR"; exit 1)
GTT = "translationtable/GLOBAL_TERMS.yaml"
all: lint_error test tt_generated
###
### Tests
###
test: test_translationtable test_impc test_reactome test_clinvar test_wormbase \
test_rgd test_ctd test_string test_udp test_mgi test_gwascatalog \
test_dataset test_source_metadata # test_orphanet test_impc_fetch
test_dataset:
$(PYUTEST)
test_source_metadata:
@$(PYUTEST)
test_mgi:
$(PYUTEST)
test_clinvar:
$(PYUTEST)
test_flybase:
$(PYUTEST)
test_wormbase:
@$(PYUTEST)
test_string:
$(PYUTEST)
test_udp:
$(PYUTEST)
test_impc:
$(PYUTEST)
test_gwascatalog:
$(PYUTEST)
test_reactome:
$(PYUTEST)
test_rgd:
$(PYUTEST)
test_sgd:
$(PYUTEST)
test_ctd:
$(PYUTEST)
test_mychem:
$(PYUTEST)
test_ncbi:
$(PYUTEST)
test_omim:
$(PYUTEST)
test_biogrid:
$(PYUTEST)
# test_orphanet:
# $(TEST) tests.test_orphanet.GeneVariantDiseaseTest
test_impc_fetch:
$(DIPPER_BIN) --sources impc --no_verify --fetch_only
test_omia-integration:
python tests/omia-integration.py --input ./out/omia.ttl
###################################################################################
### checks on supporting artifacts
test_translationtable:
@ echo "lint curie_map yaml file"
@ yamllint -c .yamllint dipper/curie_map.yaml
@ echo "----------------------------------------------------------------------"
@ echo "lint translation table yaml files"
@ yamllint -c .yamllint translationtable/
@ echo "----------------------------------------------------------------------"
@ echo "python unit test for duplicate keys and invertablility in global tt"
@ $(TEST) tests/test_trtable.py
@ echo "----------------------------------------------------------------------"
@ echo "Is the _entire_ $(GTT) file ordered by ontology curie?"
@ LC_ALL=en_US.UTF-8 sort -k2,2 -k3,3n -t ':' --stable --check $(GTT)
@ echo "----------------------------------------------------------------------"
@ echo "Orphan labels in dipper/source/Ingest.py w.r.t. $(GTT)?"
@ scripts/check_labels_v_gtt.sh
@ echo "----------------------------------------------------------------------"
# lint if within a python virtual env
# make can be called without being in a venv and produce unhelpful results
lint_error:
@ # runs single threaded just under a minute with 4 cores ~ 20 seconds
@ echo "Lint for errors"
@ ([ $(VENV) -eq 0 ] && /usr/bin/time -f"Linted in %Es" pylint -j $(NP) -E ./dipper)||\
echo "Not in python virtual enviroment or other ERROR"
@ echo "----------------------------------------------------------------------"
lint_warn:
@ echo "Lint for warnings"
@ ([ $(VENV) -eq 0 ] && /usr/bin/time -f"Linted in %Es" pylint -j $(NP) --disable=C,R ./dipper)||\
echo "Not in python virtual enviroment or other ERROR"
@ echo "----------------------------------------------------------------------"
lint:
@ echo "Lint for everything"
@ ([ $(VENV) -eq 0 ] && /usr/bin/time -f"Linted in %Es" pylint -j $(NP) ./dipper)||\
echo "Not in python virtual enviroment or other ERROR"
@ echo "----------------------------------------------------------------------"
# Generate specialized files from our various mapping files
tt_generated: translationtable/generated/prefix_equivalents.yaml
clean_tt_generated:
rm translationtable/generated/prefix_equivalents.yaml
rm translationtable/generated/curiemap_prefix.txt
rm /tmp/local_inverse.tab
translationtable/generated/curiemap_prefix.txt : dipper/curie_map.yaml
@ cut -f1 -d ':' $< | tr -d "'" | egrep -v "^$|^ *#" |\
grep .|sed 's|\(.*\)|"\1"|g' | LC_ALL=C sort -u > $@
/tmp/local_inverse.tab : translationtable/[a-z_-]*.yaml
@ awk -F '"' '/^"[^"]+": "[^":]+".*/\
{if($$2 != $$4 && ! match($$2, /[0-9]+/))\
print "\"" $$4 "\"\t\"" $$2 "\""}' \
$^ | LC_ALL=C sort -u > $@
translationtable/generated/prefix_equivalents.yaml : \
translationtable/generated/curiemap_prefix.txt /tmp/local_inverse.tab
@ echo "---\n# prefix_equivalents.yaml" > $@ && \
LC_ALL=C join $< /tmp/local_inverse.tab | \
awk '{v=$$1;$$1="";print substr($$0,2) ": " v}' | sort -u >> $@