-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile
261 lines (207 loc) · 8.07 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
.ONESHELL:
.SHELLFLAGS = -e -c
MAKEFLAGS = -j1
# Determine this makefile's path.
# Be sure to place this BEFORE `include` directives, if any.
THIS_FILE := $(lastword $(MAKEFILE_LIST))
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
ifdef PHARMCAT_DATA_DIR
dataDir := $(PHARMCAT_DATA_DIR)
else
dataDir := build
endif
ifeq ($(OS),Windows_NT)
GRADLE_CMD := cmd /c gradlew.bat --console=plain
ifneq (,$(findstring cygdrive,${ROOT_DIR}))
ROOT_DIR := $(shell echo ${ROOT_DIR} | sed 's/\/cygdrive\///' | sed 's/./&:/1')
endif
else
GRADLE_CMD := ./gradlew --console=plain
endif
ifdef PHARMCAT_DOCKER_PLATFORM
dockerPlatform := --platform $(PHARMCAT_DOCKER_PLATFORM)
else
dockerPlatform :=
endif
quietTest = true
.PHONY: updateData
updateData: clean
@echo "Updating data..."
@${GRADLE_CMD} updateData
cp build/resources/main/org/pharmgkb/pharmcat/util/vcfQueryCache.json src/main/resources/org/pharmgkb/pharmcat/util/
@echo "Moving pharmcat_position files..."
mv -f src/main/resources/org/pharmgkb/pharmcat/definition/alleles/pharmcat_positions.* .
cp -f pharmcat_positions.vcf src/test/resources/org/pharmgkb/pharmcat/reference.vcf
mv -f src/main/resources/org/pharmgkb/pharmcat/definition/alleles/pharmcat_regions.bed .
@echo ""
@echo "Updating examples..."
@${GRADLE_CMD} updateExample
# this reverts files with only EOL changes
@git stash
@git stash pop
.PHONY: _dockerPrep
_dockerPrep: clean
${GRADLE_CMD} shadowJar
mv -f build/libs/pharmcat-`git describe --tags | sed -r s/^v//`-all.jar build/pharmcat.jar
.PHONY: docker
docker: _dockerPrep
docker build ${dockerPlatform} -t pcat .
.PHONY: scriptPkg
scriptPkg:
rm -rf build/preprocessor
mkdir -p build/preprocessor
cp -f preprocessor/requirements.txt build/preprocessor
cp -f preprocessor/pharmcat_vcf_preprocessor.py build/preprocessor
cp -f preprocessor/pharmcat_pipeline build/preprocessor
mkdir build/preprocessor/preprocessor
cp -f preprocessor/preprocessor/*.py build/preprocessor/preprocessor
cp -f preprocessor/preprocessor/*.tsv build/preprocessor/preprocessor
cp -f pharmcat_positions.* pharmcat_regions.bed build/pipeline
cp -f docs/using/VCF-Preprocessor.md build/preprocessor/README.md
chmod 644 build/preprocessor/preprocessor/* build/preprocessor/*
chmod 755 build/preprocessor/pharmcat_pipeline build/preprocessor/pharmcat_vcf_preprocessor.py build/preprocessor/preprocessor
cd build; tar -czvf preprocessor.tar.gz preprocessor
# meant to be run in CI: run gradle with --no-daemon
.PHONY: pipelinePkg
pipelinePkg:
${GRADLE_CMD} shadowJar --no-daemon
rm -rf build/pipeline
mkdir -p build/pipeline
cp -f bin/pharmcat build/pipeline
cp -f build/libs/pharmcat-`git describe --tags | sed -r s/^v//`-all.jar build/pipeline/pharmcat.jar
cp -f preprocessor/requirements.txt build/pipeline
cp -f preprocessor/pharmcat_vcf_preprocessor.py build/pipeline
cp -f preprocessor/pharmcat_pipeline build/pipeline
mkdir build/pipeline/preprocessor
cp -f preprocessor/preprocessor/*.py build/pipeline/preprocessor
cp -f preprocessor/preprocessor/*.tsv build/pipeline/preprocessor
cp -f pharmcat_positions.* pharmcat_regions.bed build/pipeline
chmod 644 build/pipeline/preprocessor/* build/pipeline/*
chmod 755 build/pipeline/pharmcat build/pipeline/pharmcat_pipeline build/pipeline/pharmcat_vcf_preprocessor.py build/pipeline/preprocessor
cd build/pipeline; tar -czvf ../pipeline.tar.gz *
.PHONE: updateDataFromScratch
updateDataFromScratch: docker updateData
.PHONY: clean
clean:
@echo "Cleaning up..."
@${GRADLE_CMD} -q clean
.PHONY: clean-test-data
clean-test-data:
@echo "Deleting pre-existing VCF test data"
@rm -rf ${dataDir}/testVcf
.PHONY: clean-test-zips
clean-test-zips:
@echo "Deleting pre-existing VCF test zips"
rm -f ${dataDir}/vcfTests-*.zip
.PHONY: allVcfTests
allVcfTests: clean _generateVcf _fuzzyVcfTests _vcfTests _exactVcfTests
.PHONY: rerun-allVcfTests
rerun-allVcfTests: clean _fuzzyVcfTests _vcfTests _exactVcfTests
.PHONY: allVcfMissingTests
allVcfMissingTests: clean _generateVcf-missing _fuzzyVcfTests-missing _vcfTests-missing _exactVcfTests-missing
.PHONY: _generateVcf
_generateVcf: clean-test-data
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Generating VCF test data"
@src/scripts/vcf_generator/generate_vcf_test_data.sh
@echo ""
.PHONY: _generateVcf-missing
_generateVcf-missing: clean-test-data
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Generating VCF test data with missing positions"
@src/scripts/vcf_generator/generate_vcf_test_data.sh -m
@echo ""
.PHONY: _vcfTests
_vcfTests:
@echo "Deleting pre-existing VCF test results"
@rm -rf ${dataDir}/autogeneratedTestResults
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Running default VCF tests:"
@${GRADLE_CMD} -q testAutogeneratedVcfs
@echo "Zipping results..."
@src/scripts/vcf_generator/zip_results.sh
@src/scripts/vcf_generator/compare_results.sh
.PHONY: vcfTests
vcfTests: clean _generateVcf _vcfTests
.PHONY: _vcfTests-missing
_vcfTests-missing:
@echo "Deleting pre-existing VCF test results"
@rm -rf ${dataDir}/autogeneratedTestResults
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Running default VCF with missing positions tests:"
@${GRADLE_CMD} -q testAutogeneratedVcfsMissing
@echo "Zipping results..."
@src/scripts/vcf_generator/zip_results.sh -m
@src/scripts/vcf_generator/compare_results.sh -m
.PHONY: vcfMissingTests
vcfMissingTests: clean _generateVcf-missing _vcfTests-missing
.PHONY: _exactVcfTests
_exactVcfTests:
@echo "Deleting pre-existing VCF test results"
@rm -rf ${dataDir}/autogeneratedTestResults
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Running exact VCF tests:"
@${GRADLE_CMD} -q testAutogeneratedVcfsExactMatchOnly
@echo "Zipping results..."
src/scripts/vcf_generator/zip_results.sh -e
src/scripts/vcf_generator/compare_results.sh -e
.PHONY: exactVcfTests
exactVcfTests: clean _generateVcf _exactVcfTests
.PHONY: _exactVcfTests-missing
_exactVcfTests-missing:
@echo "Deleting pre-existing VCF test results"
@rm -rf ${dataDir}/autogeneratedTestResults
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Running exact VCF with missing positions tests:"
@${GRADLE_CMD} -q testAutogeneratedVcfsExactMatchOnlyMissing
@echo "Zipping results..."
src/scripts/vcf_generator/zip_results.sh -e -m
src/scripts/vcf_generator/compare_results.sh -e -m
.PHONY: exactVcfMissingTests
exactVcfMissingTests: clean _generateVcf-missing _exactVcfTests-missing
.PHONY: _fuzzyVcfTests
_fuzzyVcfTests:
@echo "Deleting pre-existing VCF test results"
@rm -rf ${dataDir}/autogeneratedTestResults
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Running fuzzy VCF tests:"
${GRADLE_CMD} -q testAutogeneratedVcfsFuzzyMatch
@echo "Zipping results..."
src/scripts/vcf_generator/zip_results.sh -f
src/scripts/vcf_generator/compare_results.sh -f
.PHONY: fuzzyVcfTests
fuzzyVcfTests: clean _generateVcf _fuzzyVcfTests
.PHONY: _fuzzyVcfTests-missing
_fuzzyVcfTests-missing:
@echo "Deleting pre-existing VCF test results"
@rm -rf ${dataDir}/autogeneratedTestResults
@export PHARMCAT_TEST_QUIET=${quietTest}
@echo "Running fuzzy VCF with missing positions tests:"
${GRADLE_CMD} -q testAutogeneratedVcfsFuzzyMatchMissing
@echo "Zipping results..."
src/scripts/vcf_generator/zip_results.sh -f -m
src/scripts/vcf_generator/compare_results.sh -f -m
.PHONY: fuzzyVcfMissingTests
fuzzyVcfMissingTests: clean _generateVcf-missing _fuzzyVcfTests-missing
.PHONY: test-preprocessor
test-preprocessor:
cd preprocessor
python3 -m pytest --cov=preprocessor
.PHONY: release
release:
bin/release.sh
.PHONY: dockerRelease
dockerRelease: _dockerPrep
version=`git describe --tags | sed -r s/^v//`
docker buildx inspect pcat-builder || docker buildx create --name pcat-builder --bootstrap --platform linux/amd64,linux/arm64
docker buildx build --builder pcat-builder --platform linux/amd64,linux/arm64 --push --tag pgkb/pharmcat:latest --tag pgkb/pharmcat:$${version} .
.PHONEY: jekyllDocker
jekyllDocker:
docker build ${dockerPlatform} -t jekyll docs/
.PHONEY: jekyll
jekyll:
docker run --rm -it -v ${ROOT_DIR}:/PharmCAT jekyll
# used to build reference FASTA download for Zenodo
.PHONEY: referenceFasta
referenceFasta:
bin/referenceFasta.sh