/
Makefile
132 lines (105 loc) · 6.31 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
## global variables
# set parameters for inference
MODE=release
# set parameters for debugging code
# MODE=debug
# main operations
all: analysis manuscript
clean:
@rm -f *.aux *.bbl *.blg *.log *.pdf *.docx *.bak *~ *.Rout */*.Rout */*.pdf */*.aux */*.log *.rda */*.rda */*/*.rda data/intermediate/*.rda data/intermediate/*.Rout
@rm data/intermediate/structure -rf
@rm data/intermediate/bayescan -rf
@rm data/intermediate/pcadapt -rf
@rm code/rmarkdown/article_files/figure-latex/*.pdf -f
@rm code/rmarkdown/supporting_information_files/figure-latex/*.pdf -f
@rm code/rmarkdown/supporting_information.tex -f
@rm code/rmarkdown/supporting_information.md -f
@rm code/rmarkdown/supporting_information.docx -f
@rm code/rmarkdown/supporting_information.pdf -f
@rm code/rmarkdown/article.md -f
@rm code/rmarkdown/article.tex -f
@rm code/rmarkdown/article.docx -f
@rm code/rmarkdown/article.pdf -f
@rm article/*.csv -f
@rm article/*.docx -f
pull_ms:
@scp -P 443 uqjhans4@cbcs-comp01.server.science.uq.edu.au:/home/uqjhans4/GitHub/genetic-surrogates/article/* article
push_ms:
@scp -P 443 code/rmarkdown/* uqjhans4@cbcs-comp01.server.science.uq.edu.au:/home/uqjhans4/GitHub/genetic-surrogates/code/rmarkdown
# commands for generating manuscript
manuscript: article si
article: article/article.pdf article/article.docx
si: article/supporting_information.pdf
slides: article/slides.pdf
article/article.docx: code/rmarkdown/article.Rmd code/rmarkdown/references.bib code/rmarkdown/preamble.tex code/rmarkdown/reference-style.csl
R -e "rmarkdown::render('code/rmarkdown/article.Rmd', clean=FALSE)"
R -e "sapply(dir('code/rmarkdown/article_files/figure-latex', full.names=TRUE), function(x) {system(paste('convert -density 300 -quality 85', x, gsub('.pdf', '.png', x, fixed=TRUE)))})"
R -e "x <- readLines('code/rmarkdown/article.tex'); pos <- grep('\\\\includegraphics', x, fixed=TRUE); x[pos] <- gsub('}', '.png}', x[pos], fixed=TRUE); writeLines(x, 'code/rmarkdown/article.tex')"
cd code/rmarkdown && \
pandoc +RTS -K512m -RTS article.tex -o article.docx --highlight-style tango --latex-engine pdflatex --include-in-header preamble.tex --variable graphics=yes --variable 'geometry:margin=1in' --bibliography references.bib --filter /usr/bin/pandoc-citeproc && \
rm article.knit.md && \
rm article.utf8.md && \
cd ../..
mv code/rmarkdown/article.docx article/
article/article.pdf: code/rmarkdown/article.Rmd code/rmarkdown/references.bib code/rmarkdown/preamble.tex code/rmarkdown/reference-style.csl
R -e "rmarkdown::render('code/rmarkdown/article.Rmd')"
R -e "source('code/R/functions/format_pnas.R');format_pnas('code/rmarkdown/article.tex','code/rmarkdown/article.tex')"
cd code/rmarkdown && pdflatex article.tex
mv code/rmarkdown/article.pdf article/
mv code/rmarkdown/article.tex article/
rm article/article.md -f
rm article/article.utf8.md -f
article/supporting_information.pdf: code/rmarkdown/supporting_information.Rmd code/rmarkdown/preamble.tex code/rmarkdown/si-preamble.tex
R -e "rmarkdown::render('code/rmarkdown/supporting_information.Rmd')"
mv code/rmarkdown/supporting_information.pdf article/
rm code/rmarkdown/supporting_information.tex -f
rm code/rmarkdown/supporting_information.md -f
article/slides.pdf: code/rmarkdown/slides.Rmd
R -e "rmarkdown::render('code/rmarkdown/slides.Rmd', clean=F)"
mv code/rmarkdown/slides.pdf article/
rm code/rmarkdown/slides.tex -f
rm code/rmarkdown/slides.md -f
# commands for running analysis
analysis: data/final/results.rda
data/final/results.rda: data/intermediate/12-*.rda code/R/analysis/13-*.R
R CMD BATCH --no-restore --no-save code/R/analysis/13-*.R
mv *.Rout data/intermediate/
data/intermediate/12-*.rda: data/intermediate/07-*.rda data/intermediate/08-*.rda data/intermediate/09-*.rda data/intermediate/10-*.rda data/intermediate/11-*.rda code/R/analysis/12-*.R
R CMD BATCH --no-restore --no-save code/R/analysis/12-*.R
mv *.Rout data/intermediate/
data/intermediate/11-*.rda: data/intermediate/06-*.rda code/R/analysis/11-*.R code/parameters/raptr.toml code/parameters/gurobi.toml
R CMD BATCH --no-restore --no-save code/R/analysis/11-*.R
mv *.Rout data/intermediate/
data/intermediate/10-*.rda: data/intermediate/06-*.rda code/R/analysis/10-*.R code/parameters/raptr.toml code/parameters/gurobi.toml
R CMD BATCH --no-restore --no-save code/R/analysis/10-*.R
mv *.Rout data/intermediate/
data/intermediate/09-*.rda: data/intermediate/06-*.rda code/R/analysis/09-*.R code/parameters/raptr.toml code/parameters/gurobi.toml
R CMD BATCH --no-restore --no-save code/R/analysis/09-*.R
mv *.Rout data/intermediate/
data/intermediate/08-*.rda: data/intermediate/06-*.rda code/R/analysis/08-*.R code/parameters/raptr.toml code/parameters/gurobi.toml
R CMD BATCH --no-restore --no-save code/R/analysis/08-*.R
mv *.Rout data/intermediate/
data/intermediate/07-*.rda: data/intermediate/06-*.rda code/R/analysis/07-*.R code/parameters/raptr.toml code/parameters/gurobi.toml
R CMD BATCH --no-restore --no-save code/R/analysis/07-*.R
mv *.Rout data/intermediate/
data/intermediate/06-*.rda: data/intermediate/05-*.rda code/R/analysis/06-*.R
R CMD BATCH --no-restore --no-save code/R/analysis/06-*.R
mv *.Rout data/intermediate/
data/intermediate/05-*.rda: data/intermediate/04-*.rda code/R/analysis/05-*.R code/parameters/nmds.toml
R CMD BATCH --no-restore --no-save code/R/analysis/05-*.R
mv *.Rout data/intermediate/
data/intermediate/04-*.rda: data/intermediate/03-*.rda code/R/analysis/04-*.R code/parameters/bayescan.toml code/parameters/pcadapt.toml
R CMD BATCH --no-restore --no-save code/R/analysis/04-*.R
mv *.Rout data/intermediate/
data/intermediate/03-*.rda: data/intermediate/02-*.rda code/R/analysis/03-*.R code/parameters/structure.toml code/parameters/clumpp.toml
R CMD BATCH --no-restore --no-save code/R/analysis/03-*.R
mv *.Rout data/intermediate/
data/intermediate/02-*.rda: data/intermediate/01-*.rda code/R/analysis/02-*.R code/parameters/surrogate.toml
R CMD BATCH --no-restore --no-save code/R/analysis/02-*.R
mv *.Rout data/intermediate/
data/intermediate/01-*.rda: data/intermediate/00-*.rda code/R/analysis/01-*.R
R CMD BATCH --no-restore --no-save code/R/analysis/01-*.R
mv *.Rout data/intermediate/
data/intermediate/00-*.rda: code/R/analysis/00-*.R code/parameters/general.toml data/raw/*
R CMD BATCH --no-restore --no-save '--args MODE=$(MODE)' code/R/analysis/00-*.R
mv *.Rout data/intermediate/