This repository has been archived by the owner on Jul 28, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
186 lines (176 loc) · 5.75 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
all: clean examples paper
BEAST_BIN ?= beast/beast/bin/beast
PYTHON ?= $(shell which python2)
PY_ENV ?= beastling_ve
ACTIVATE ?= $(PY_ENV)/bin/activate
BEASTLING_BIN ?= $(PY_ENV)/bin/beastling
# Clean
.PHONY: clean_beast
clean_beast:
rm -fr beast/
rm -f java_version
rm -f java_is_8
rm -f beast_version
rm -f beast_is_24
.PHONY: clean_virtualenv
clean_virtualenv:
# We are not cleaning your custom virtualenv.
# That way lie accidents!
rm -rf beastling_ve/
rm -f has_ete
rm -f has_newick
rm -f has_numpy
rm -f has_pandas
rm -f has_phyltr
rm -f has_scipy
rm -f has_seaborn
.PHONY: clean
clean: clean_beast clean_virtualenv
# Delete TeX cruft
rm -f beastling.aux
rm -f beastling.bbl
rm -f beastling.blg
rm -f beastling.log
rm -f beastling.out
rm -f beastling.pdf
rm -f supplement.aux
rm -f supplement.bbl
rm -f supplement.blg
rm -f supplement.log
rm -f supplement.out
rm -f supplement.pdf
# Delete BEASTling and BEAST output
rm -f examples/*/*.xml
rm -f examples/*/*.log
rm -f examples/*/*.nex
rm -f examples/*/*.state
# Delete processed data files
rm -f examples/austronesian/wals_data.csv
rm -f examples/austronesian/austronesian_reference.nex
rm -f examples/austronesian/processed_austronesian_reference.nex
rm -f examples/indoeuropean/indoeuropean.csv
# Delete results
rm -f examples/austronesian/language_list.txt
rm -f examples/austronesian/parameter_means.csv
rm -f examples/indoeuropean/rate_variation.eps
rm -f examples/austronesian/supp_language_table.tex
rm -f examples/austronesian/supp_feature_table.tex
rm -f examples/austronesian/table.tex
rm -f examples/indoeuropean/mcct.eps
rm -f examples/indoeuropean/category_rates.eps
rm -f examples/indoeuropean/parameter_means.csv
rm -f examples/indoeuropean/ranking_correlations.csv
rm -f examples/indoeuropean/table.tex
.PHONY: examples
examples: examples/austronesian/table.tex examples/indoeuropean/table.tex
examples/austronesian/austronesian.xml: $(BEASTLING_BIN) $(ACTIVATE)
. $(ACTIVATE) && \
cd examples/austronesian && \
python ./preprocess.py && \
beastling --overwrite austronesian.conf
examples/austronesian/austronesian.log: $(BEAST_BIN) beast/packages/morph-models/lib/MM.addon.jar examples/austronesian/austronesian.xml
export BEAST_ADDON_PATH=./beast/packages && \
$(BEAST_BIN) -overwrite -working -java examples/austronesian/austronesian.xml
examples/austronesian/table.tex: $(ACTIVATE) has_newick has_seaborn examples/austronesian/austronesian.log
. $(ACTIVATE) && \
cd examples/austronesian && \
python postprocess.py
examples/indoeuropean/indoeuropean.xml: $(BEASTLING_BIN) $(ACTIVATE)
. $(ACTIVATE) && \
cd examples/indoeuropean && \
python preprocess.py && \
beastling --overwrite indoeuropean.conf
examples/indoeuropean/indoeuropean.log: $(BEAST_BIN) examples/indoeuropean/indoeuropean.xml
$(BEAST_BIN) -overwrite -working -java examples/indoeuropean/indoeuropean.xml
examples/indoeuropean/table.tex: $(ACTIVATE) has_ete has_numpy has_pandas has_phyltr has_scipy has_seaborn examples/indoeuropean/indoeuropean.log
. $(ACTIVATE) && \
cd examples/indoeuropean && \
python postprocess.py
# Targets for building the paper:
.PHONY: paper
paper:
pdflatex beastling
bibtex beastling
pdflatex beastling
pdflatex beastling
pdflatex supplement
pdflatex supplement
## Create beastling virtual environment:
# Make sure we can use virtualenv
$(ACTIVATE):
$(PYTHON) -m virtualenv $(PY_ENV) 2> virtualenv_error || \
make force-$(ACTIVATE)
force-$(ACTIVATE):
# Fallback because virtualenv was not available: Download a virtualenv release from github and run that.
grep -F 'No module named virtualenv' virtualenv_error
curl -Lo virtualenv-15.0.3.tar.gz "https://github.com/pypa/virtualenv/archive/15.0.3.tar.gz"
tar -xvzf virtualenv-15.0.3.tar.gz
$(PYTHON) virtualenv-15.0.3/virtualenv.py $(PY_ENV)
# Install beastling to the virtualenv
beastling_ve/bin/beastling: $(ACTIVATE)
. $(ACTIVATE) && \
pip install beastling
has_ete: $(ACTIVATE)
. $(ACTIVATE) && \
pip install ete2 && \
python -c 'import ete2' && \
echo "YES" > has_ete
has_newick: $(ACTIVATE)
. $(ACTIVATE) && \
pip install newick && \
python -c 'import newick' && \
echo "YES" > has_newick
has_pandas: $(ACTIVATE)
. $(ACTIVATE) && \
pip install pandas && \
python -c 'import pandas' && \
echo "YES" > has_pandas
has_phyltr: $(ACTIVATE)
. $(ACTIVATE) && \
pip install phyltr && \
python -c 'import phyltr' && \
echo "YES" > has_phyltr
has_scipy: $(ACTIVATE)
. $(ACTIVATE) && \
pip install scipy && \
python -c 'import scipy' && \
echo "YES" > has_scipy
has_seaborn: $(ACTIVATE)
. $(ACTIVATE) && \
pip install seaborn && \
python -c 'import seaborn' && \
echo "YES" > has_seaborn
has_numpy: $(ACTIVATE)
. $(ACTIVATE) && \
pip install numpy && \
python -c 'import numpy' && \
echo "YES" > has_numpy
## Install beast:
# Check java
java_is_8:
java -version 2> java_version && \
grep -F 'version "1.8' java_version && \
echo "YES" > java_is_8
# Download core
beast/distfiles/beast.tgz:
mkdir -p beast/distfiles
curl -Lo beast/distfiles/beast.tgz \
"https://github.com/CompEvol/beast2/releases/download/v2.4.5/BEAST.v2.4.5.Linux.tgz"
# Unpack core
beast/beast/bin/beast: beast/distfiles/beast.tgz
cd beast/ && \
tar -xvzf distfiles/beast.tgz
# Get beast version
beast_version: java_is_8 $(BEAST_BIN)
$(BEAST_BIN) -version > beast_version
beast_is_24: beast_version
grep -F 'v2.4' beast_version && \
echo "YES" > beast_is_24
# Download morph-models package
beast/packages/mm.zip:
mkdir -p beast/packages/morph-models
curl -Lo beast/packages/morph-models/mm.zip "https://github.com/CompEvol/morph-models/releases/download/1.0.5/MM.addon.v1.0.5.zip"
# Unpack morph-models package
beast/packages/morph-models/lib/MM.addon.jar: beast/packages/mm.zip
cd beast/packages/morph-models && \
unzip mm.zip