-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
90 lines (76 loc) · 2.36 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
#!/bin/bash
# Define directory structure; for scripts
FIG_SRC=scripts/figures
TAB_SRC=scripts/tables
# Define directory structure; for output
MANUSCRIPT=manuscript
FIG_DIR=manuscript/figures
TAB_DIR=manuscript/tables
# Define directory structure; for intermediates
DATA=data
LOG=log
LOG_FIG=log/figures
LOG_TAB=log/tables
# Define commands
RFIG=R CMD BATCH --vanilla $< $(LOG_FIG)/$(<F).Rout
RTAB=R CMD BATCH --vanilla $< $(LOG_TAB)/$(<F).Rout
# All
all: ## Run all parts of the makefile
all: data figures tables clean
# Download data
data: ## Download the processed data
data:
wget -c -O data.zip https://ndownloader.figshare.com/articles/13088624/versions/1
unzip -n data.zip -d $(DATA)
# Directories
dir_manuscript: ## Make manuscript directory tree
dir_manuscript:
test ! -d $(MANUSCRIPT) && mkdir $(MANUSCRIPT) || exit 0
test ! -d $(TAB_DIR) && mkdir $(TAB_DIR) || exit 0
test ! -d $(FIG_DIR) && mkdir $(FIG_DIR) || exit 0
dir_logs: ## Make logs directory tree
dir_logs:
test ! -d $(LOG) && mkdir $(LOG) || exit 0
test ! -d $(LOG_FIG) && mkdir $(LOG_FIG) || exit 0
test ! -d $(LOG_TAB) && mkdir $(LOG_TAB) || exit 0
figures: ## Generate the figures
figures: dir_manuscript \
dir_logs \
$(FIG_DIR)/timeline.png \
$(FIG_DIR)/remove_batch.png \
$(FIG_DIR)/Pparg_knockdown.png
tables: ## Generate the tables
tables: dir_manuscript \
dir_logs \
$(TAB_DIR)/datasets_pharmacological.tex \
$(TAB_DIR)/datasets_genetic.tex
# Figures
$(FIG_DIR)/timeline.png: $(FIG_SRC)/timeline.R \
$(DATA)/genetic_perturbation.rds \
$(DATA)/pharmacological_perturbation.rds
$(RFIG)
$(FIG_DIR)/remove_batch.png: $(FIG_SRC)/remove_batch.R \
$(DATA)/genetic_perturbation.rds
$(RFIG)
$(FIG_DIR)/Pparg_knockdown.png: $(FIG_SRC)/Pparg_knockdown.R \
$(DATA)/genetic_perturbation.rds
$(RFIG)
# Tables
$(TAB_DIR)/datasets_pharmacological.tex: $(TAB_SRC)/datasets_pharmacological.R \
$(DATA)/pharmacological_perturbation.rds
$(RTAB)
$(TAB_DIR)/datasets_genetic.tex: $(TAB_SRC)/datasets_genetic.R \
$(DATA)/genetic_perturbation.rds
$(RTAB)
# Clean Up
.PHONY: clean
clean: ## Clean up
clean:
rm -f *.pdf
rm -f *.RData
# Source: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## Print the current page
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
.DEFAULT_GOAL := help