forked from monarch-initiative/ontogpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
169 lines (119 loc) · 5.87 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
RUN = poetry run
# NOTE: we are currently pinned to an earlier linkml because pydantic...
TMPRUN =
PACKAGE = ontogpt
TEMPLATE_DIR = src/$(PACKAGE)/templates
EVAL_DIR = src/$(PACKAGE)/evaluation
TEMPLATES = $(notdir $(basename $(wildcard $(TEMPLATE_DIR)/*.yaml)))
ENTRY_CLASSES = recipe.Recipe gocam.GoCamAnnotations reaction.ReactionDocument ctd.ChemicalToDiseaseDocument
all: all_pydantic
all_pydantic: $(patsubst %, $(TEMPLATE_DIR)/%.py, $(TEMPLATES))
all_projects: $(patsubst %, projects/%, $(TEMPLATES))
all_docs: $(patsubst %, docs/%/index.md, $(TEMPLATES))
list_templates: $(TEMPLATE_DIR)/*.yaml
@echo $(basename $^)
test: unit-test
unit-test:
$(RUN) python -m unittest discover tests.unit
integration-test:
$(RUN) python -m unittest
get_version:
$(RUN) python -c "import ontogpt;print('.'.join((ontogpt.__version__).split('.', 3)[:3]))"
$(TEMPLATE_DIR)/%.py: src/$(PACKAGE)/templates/%.yaml
$(RUN) gen-pydantic --pydantic_version 2 $< > $@.tmp && mv $@.tmp $@
%.py: %.yaml
$(RUN) gen-pydantic --pydantic_version 2 $< > $@
#all_images: $(patsubst %, docs/images/%.png, $(ENTRY_CLASSES))
#docs/images/%.png:
# $(RUN) erdantic ontogpt.templates.$* -o $@
projects/%: src/$(PACKAGE)/templates/%.yaml
$(RUN) gen-project $< -d $@ && cp -pr $@/docs docs/$*
docs/index.md: README.md
cp $< $@
docs/%/index.md: src/$(PACKAGE)/templates/%.yaml
$(RUN) gen-doc --include-top-level-diagram --diagram-type er_diagram $< -d docs/$*
serve:
$(RUN) mkdocs serve
gh-deploy:
$(RUN) mkdocs gh-deploy
# -- OWL Pipeline --
all_recipes: tests/output/owl/merged/recipe-all-merged.owl
# prefix with 'web' for a URL in recipe-urls.csv
# prefix wiyth 'case' for a previously downloaded recipe in cases/ directory
RECIPES = case-spaghetti case-egg-noodles case-tortilla-soup \
web-spinach-and-feta-turkey-burgers \
web-shrimp-and-cheesy-grits-with-bacon \
web-easy-french-toast-waffles \
web-easy-palak-paneer \
web-sweet-chili-thai-sauce \
web-grilled-asparagus \
web-sauteed-lacinato-kale \
web-quick-pickled-onions \
web-deviled-eggs-106562 \
web-corn-dog \
web-spicy-thai-basil-chicken-pad-krapow-gai \
web-marinated-summer-squash-with-hazelnuts-and-ricotta \
web-Waldorf \
web-red-lentil-soup \
web-sweet-and-spicy-pork-and-napa-cabbage-stir-fry-with-spicy-noodles
RECIPE_URLS_FILE = tests/input/recipe-urls.csv
RECIPE_GROUPINGS = src/ontogpt/owl/recipe-groupings.ofn
tests/output/owl/recipe-case-%.owl: tests/input/cases/recipe-%.txt
$(RUN) ontogpt extract -t recipe $< --set-slot-value url=https://w3id.org/ontogpt/recipes/instances/$* -o $@ -O owl
.PRECIOUS: tests/output/owl/recipe-case-%.owl
tests/output/owl/recipe-web-%.owl:
$(RUN) ontogpt recipe-extract $* -R $(RECIPE_URLS_FILE) -o $@ -O owl
.PRECIOUS: tests/output/owl/recipe-web-%.owl
tests/output/owl/recipe-web-%.yaml:
$(RUN) ontogpt recipe-extract $* -R $(RECIPE_URLS_FILE) -o $@ -O yaml
.PRECIOUS: tests/output/owl/recipe-web-%.yaml
tests/output/owl/recipe-all.owl: $(patsubst %, tests/output/owl/recipe-%.owl, $(RECIPES))
robot merge $(patsubst %, -i %, $^) -o $@
.PRECIOUS: tests/output/owl/recipe-all.owl
# seed terms for ROBOT extract
tests/output/owl/seed-recipe-%.txt: tests/output/owl/recipe-%.owl
robot query -i $< -f csv -q tests/input/queries/terms.rq $@
.PRECIOUS: tests/output/owl/seed-recipe-%.txt
FOODON = tests/output/owl/imports/foodon.owl
$(FOODON):
curl -L -s http://purl.obolibrary.org/obo/foodon.owl > $@
.PRECIOUS: $(FOODON)
tests/output/owl/imports/recipe-%-import.owl: tests/output/owl/seed-recipe-%.txt $(FOODON)
robot extract -i $(FOODON) -m BOT -T $< -o $@
tests/output/owl/merged/recipe-%-merged.owl: tests/output/owl/imports/recipe-%-import.owl $(RECIPE_GROUPINGS)
robot merge -i tests/output/owl/recipe-$*.owl -i $(RECIPE_GROUPINGS) -i $< reason -r elk -o $@
# enrichment
GENE_SET_FILES = $(wildcard tests/input/genesets/*.yaml)
GENE_SETS = $(patsubst tests/input/genesets/%.yaml,%,$(GENE_SET_FILES))
ZFIN_GENE_SET_FILES = $(wildcard tests/input/genesets/zebrafish/*.yaml)
ZFIN_GENE_SETS = $(patsubst tests/input/genesets/zebrafish/%.yaml,%,$(ZFIN_GENE_SET_FILES))
SGD_GENE_SET_FILES = $(wildcard tests/input/genesets/yeast/*.yaml)
SGD_GENE_SETS = $(patsubst tests/input/genesets/yeast/%.yaml,%,$(SGD_GENE_SET_FILES))
t:
echo $(GENE_SETS)
tests/input/genesets/%.yaml: tests/input/genesets/%.json
$(RUN) ontogpt convert-geneset -U $< -o $@
.PRECIOUS: tests/input/genesets/%.yaml
N=2
analysis/enrichment/zebrafish/%-results-$(N).yaml: tests/input/genesets/zebrafish/%.yaml
$(RUN) ontogpt -vv eval-enrichment -n $(N) -U $< -A tests/input/zfin.gaf -o $@.tmp && mv $@.tmp $@
analysis/enrichment/yeast/%-results-$(N).yaml: tests/input/genesets/yeast/%.yaml
$(RUN) ontogpt -vv eval-enrichment -n $(N) -U $< -A tests/input/sgd.gaf -o $@.tmp && mv $@.tmp $@
analysis/enrichment/gpt4/%-results-$(N).yaml: tests/input/genesets/%.yaml analysis/enrichment/TRIGGER-REANALYSIS
$(RUN) ontogpt -v eval-enrichment --model gpt-4 -n $(N) -U $< -o $@.tmp && mv $@.tmp $@
analysis/enrichment/%-results-$(N).yaml: tests/input/genesets/%.yaml analysis/enrichment/TRIGGER-REANALYSIS
$(RUN) ontogpt -v eval-enrichment -n $(N) -U $< -o $@.tmp && mv $@.tmp $@
analysis/enrichment-summary.yaml:
cat analysis/enrichment/*-$(N).yaml > $@
analysis/enrichment-summary-$(N).yaml:
cat analysis/enrichment/*-$(N).yaml > $@
analysis/zebrafish-enrichment-summary-$(N).yaml:
cat analysis/enrichment/zebrafish/*-$(N).yaml > $@
analysis/yeast-enrichment-summary-$(N).yaml:
cat analysis/enrichment/yeast/*-$(N).yaml > $@
analysis/gpt4-enrichment-summary-$(N).yaml:
cat analysis/enrichment/gpt4/*-$(N).yaml > $@
all_enrich: $(patsubst %, analysis/enrichment/%-results-$(N).yaml, $(GENE_SETS))
all_zfin_enrich: $(patsubst %, analysis/enrichment/zebrafish/%-results-$(N).yaml, $(ZFIN_GENE_SETS))
all_sgd_enrich: $(patsubst %, analysis/enrichment/yeast/%-results-$(N).yaml, $(SGD_GENE_SETS))
all_gpt4_enrich: $(patsubst %, analysis/enrichment/gpt4/%-results-$(N).yaml, $(GENE_SETS))