forked from lgmgeo/AnnotSV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
250 lines (216 loc) · 10.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
############################################################################################################
# AnnotSV 3.3.6 #
# #
# AnnotSV: An integrated tool for Structural Variations annotation and ranking #
# #
# Copyright (C) 2017-2023 Veronique Geoffroy ([email protected]) #
# #
# This is part of AnnotSV source code. #
# #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
# as published by the Free Software Foundation; either version 3 #
# of the License, or (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; If not, see <http://www.gnu.org/licenses/>. #
############################################################################################################
SHELL = /bin/bash
DESTDIR ?=
PREFIX ?= /usr/local
INSTALLDIR1 := $(shell readlink -f "$(DESTDIR)$(PREFIX)")
INSTALLDIR2 := $(shell readlink -f "$(DESTDIR).")
BINDIR := $(PREFIX)/bin
ETCDIR := $(PREFIX)/etc
SHAREDIR := $(PREFIX)/share
DOCDIR := $(SHAREDIR)/doc
BASHDIR := $(SHAREDIR)/bash
TCLVERSION := tcl$(shell echo 'puts $${tcl_version};exit 0' | tclsh)
TCLDIRDISTRIBUTED := share/tcl
TCLDIR := $(SHAREDIR)/$(TCLVERSION)
PYTHONDIRDISTRIBUTED := share/python3
PYTHONDIR := $(SHAREDIR)/python3
ANNOTSV := AnnotSV
VERSION := 3.3.6
RM := /bin/rm
RMDIR := /bin/rmdir
MKDIR := install -d
MV := /bin/mv
CP := install -p -m 0644
CPDIR := /bin/cp -r
CHMOD := /bin/chmod -R 777
CONFIGFILE := etc/$(ANNOTSV)/configfile
MAKEFILE := Makefile
PROPERTIES := etc/$(ANNOTSV)/application.properties
BASH_SCRIPTS := $(shell find share/bash/$(ANNOTSV)/ -name '*.bash' 2> /dev/null)
DOCUMENTATIONS := $(shell find License.txt changeLog.txt commandLineOptions.txt README.AnnotSV_*.pdf 2> /dev/null)
# make install
.PHONY: install
ifeq ('$(INSTALLDIR1)' , '$(INSTALLDIR2)')
all: install-display install-documentationlight install-variantconvert install-done
install: install-display install-documentationlight install-variantconvert install-done
install-exomiser: install-exomiser-1 install-exomiser-3
else
all: install-display install-configfile install-makefile install-executable install-tcl-toolbox install-python-toolbox install-bash-toolbox install-doc install-others-doc install-variantconvert install-done
install: install-display install-configfile install-makefile install-executable install-tcl-toolbox install-python-toolbox install-bash-toolbox install-doc install-others-doc install-variantconvert install-done
install-exomiser: install-exomiser-1 install-exomiser-2 install-exomiser-3
endif
install-display:
@echo ""
@echo "Installation of $(ANNOTSV)-$(VERSION):"
@echo "----------------------------"
@echo DESTDIR=$(DESTDIR)
@echo PREFIX=$(PREFIX)
@echo TCLVERSION=$(TCLVERSION)
install-documentationlight: $(DOCUMENTATIONS)
@echo ""
$(MV) $^ $(DESTDIR)$(DOCDIR)/$(ANNOTSV)
$(MV) $(TCLDIRDISTRIBUTED) $(TCLDIR)
install-configfile: $(CONFIGFILE)
@echo ""
@echo "Configfile configuration"
@echo "------------------------"
$(MKDIR) $(DESTDIR)$(ETCDIR)/$(ANNOTSV)
install -p -m 0755 $(CONFIGFILE) $(DESTDIR)$(ETCDIR)/$(ANNOTSV)
install-makefile: $(MAKEFILE)
@echo ""
@echo "Makefile installation"
@echo "---------------------"
install -p -m 0755 $(MAKEFILE) $(DESTDIR)$(PREFIX)
install-executable:
@echo ""
@echo "Executable installation"
@echo "-----------------------"
$(MKDIR) $(DESTDIR)$(BINDIR)
install -p -m 0755 bin/AnnotSV $(DESTDIR)$(BINDIR)
install-tcl-toolbox:
@echo ""
@echo "Tcl scripts installation"
@echo "------------------------"
$(MKDIR) $(DESTDIR)$(TCLDIR)/$(ANNOTSV)
cd share/tcl ; tar cf - $(ANNOTSV) | tar xf - -C $(DESTDIR)$(TCLDIR)/
install-python-toolbox:
@echo ""
@echo "Python scripts installation"
@echo "---------------------------"
$(MKDIR) $(DESTDIR)$(PYTHONDIR)/variantconvert
cd share/python3 ; tar cf - variantconvert | tar xf - -C $(DESTDIR)$(PYTHONDIR)/
install-variantconvert:
@echo ""
@echo "variantconvert installation"
@echo "---------------------------"
touch $(DESTDIR)$(PYTHONDIR)/variantconvert/pipinstall.flag
chmod 777 $(DESTDIR)$(PYTHONDIR)/variantconvert/pipinstall.flag
pip3 install -e $(DESTDIR)$(PYTHONDIR)/variantconvert/. || pip install -e $(DESTDIR)$(PYTHONDIR)/variantconvert/. || rm -f $(DESTDIR)$(PYTHONDIR)/variantconvert/pipinstall.flag
@echo ""
touch $(DESTDIR)$(PYTHONDIR)/variantconvert/configs/GRCh37/annotsv3_from_bed.local.json
touch $(DESTDIR)$(PYTHONDIR)/variantconvert/configs/GRCh38/annotsv3_from_bed.local.json
$(CHMOD) $(DESTDIR)$(PYTHONDIR)/variantconvert/configs/GRCh37/annotsv3_from_bed.local.json
$(CHMOD) $(DESTDIR)$(PYTHONDIR)/variantconvert/configs/GRCh38/annotsv3_from_bed.local.json
install-bash-toolbox: $(BASH_SCRIPTS)
@echo ""
@echo "Bash scripts installation"
@echo "-------------------------"
$(MKDIR) $(DESTDIR)$(BASHDIR)/$(ANNOTSV)
$(CP) $^ $(DESTDIR)$(BASHDIR)/$(ANNOTSV)
install-doc: $(DOCUMENTATIONS)
@echo ""
@echo "Documentations installation"
@echo "---------------------------"
$(MKDIR) $(DESTDIR)$(DOCDIR)/$(ANNOTSV)
$(CP) $^ $(DESTDIR)$(DOCDIR)/$(ANNOTSV)
install-others-doc: share/doc/$(ANNOTSV)/Example
$(CPDIR) $^ $(DESTDIR)$(DOCDIR)/$(ANNOTSV)
install-done:
@echo ""
@echo "Done"
@echo ""
@echo "WARNING: Annotations need to be installed:"
@echo "make DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) install-human-annotation"
@echo "make DESTDIR=$(DESTDIR) PREFIX=$(PREFIX) install-mouse-annotation"
# make install_organism_annotations
install-all-annotations: install-human-annotation install-mouse-annotation
install-human-annotation: Annotations_Human_$(VERSION).tar.gz install-exomiser
@echo ""
@echo "Installation of human annotation:"
@echo ""
tar -xf Annotations_Human_$(VERSION).tar.gz -C $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/
$(RM) -rf Annotations_Human_$(VERSION).tar.gz
$(CHMOD) $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/Annotations_*
@echo ""
@echo "--> Human annotation installed"
install-exomiser-1: 2202_phenotype.zip
@echo ""
@echo "Installation of Exomiser data:"
@echo ""
$(MKDIR) -p $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/Annotations_Exomiser/2202
tar -xf 2202_hg19.tar.gz -C $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/Annotations_Exomiser/2202/
unzip 2202_phenotype.zip -d $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/Annotations_Exomiser/2202/
$(RM) -rf 2202_phenotype.zip
$(RM) -rf 2202_hg19.tar.gz
install-exomiser-2:
install -p -m 0755 $(PROPERTIES) $(DESTDIR)$(ETCDIR)/$(ANNOTSV)
$(CPDIR) share/AnnotSV/jar/ $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/
install-exomiser-3:
@echo ""
@echo "--> Exomiser data installed"
install-mouse-annotation: Annotations_Mouse_$(VERSION).tar.gz
@echo ""
@echo "Installation of mouse annotation:"
@echo ""
$(MKDIR) $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/
tar -xf Annotations_Mouse_$(VERSION).tar.gz -C $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)/
$(RM) -rf Annotations_Mouse_$(VERSION).tar.gz
@echo ""
@echo "--> Mouse annotation installed"
Annotations_%.tar.gz:
@echo ""
@echo "Download AnnotSV supporting data files:"
@echo ""
curl -C - -LO https://www.lbgi.fr/~geoffroy/Annotations/$@
%_phenotype.zip:
@echo ""
@echo "Download Exomiser supporting data files:"
@echo ""
curl -C - -LO https://www.lbgi.fr/~geoffroy/Annotations/2202_hg19.tar.gz
curl -C - -LO https://data.monarchinitiative.org/exomiser/data/$@
# make uninstall
.PHONY: uninstall
ifeq ('$(PREFIX)' , '/usr/local')
uninstall: uninstall1 uninstall4
else ifeq ('$(INSTALLDIR1)' , '$(INSTALLDIR2)')
uninstall: uninstall1 uninstall2 uninstall4
else
uninstall: uninstall1 uninstall2 uninstall3 uninstall4
endif
uninstall1:
@echo ""
@echo "Uninstalling of $(ANNOTSV)"
@echo "------------------------"
$(RM) -f $(DESTDIR)$(BINDIR)/$(ANNOTSV)
$(RM) -f $(DESTDIR)$(BINDIR)/INSTALL_annotations.sh
$(RM) -f $(DESTDIR)$(BINDIR)/INSTALL_code.sh
$(RM) -rf $(DESTDIR)$(TCLDIR)/$(ANNOTSV)
$(RM) -rf $(DESTDIR)$(PYTHONDIR)/$(ANNOTSV)
$(RM) -rf $(DESTDIR)$(PYTHONDIR)/variantconvert
$(RM) -rf $(DESTDIR)$(DOCDIR)/$(ANNOTSV)
$(RM) -rf $(DESTDIR)$(SHAREDIR)/$(ANNOTSV)
$(RM) -rf $(DESTDIR)$(BASHDIR)/$(ANNOTSV)
$(RM) -rf $(DESTDIR)$(ETCDIR)/$(ANNOTSV)
$(RM) -rf $(DESTDIR)$(PREFIX)/Makefile
$(RM) -rf $(DESTDIR)$(PREFIX)/README.md
$(RM) -rf $(DESTDIR)$(PREFIX)/Scoring_Criteria_AnnotSV_*.xlsx
$(RM) -rf $(DESTDIR)$(PREFIX)/.git
$(RM) -rf $(DESTDIR)$(PREFIX)/.gitignore
uninstall2:
$(RMDIR) --ignore-fail-on-non-empty $(DESTDIR)$(BINDIR) $(DESTDIR)$(BASHDIR) $(DESTDIR)$(TCLDIR) $(DESTDIR)$(PYTHONDIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(SHAREDIR) $(DESTDIR)$(ETCDIR)
uninstall3:
$(RMDIR) --ignore-fail-on-non-empty $(DESTDIR)$(PREFIX)
uninstall4:
@echo ""
@echo "Done"