-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
76 lines (56 loc) · 3.91 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
.PHONY: shapefiles models intermediate_data maps extended_maps figures all clean
all: documents/model_summaries.html documents/geographic_cross_validation.html figures figures/SuppTable1-observed-predicted-missing.csv figures/ExtendedTable01-models.docx README.txt
# Major groupings of files
FUNCTIONS := $(wildcard R/*.R)
HP3_DATA := data/hosts.csv data/viruses.csv data/associations.csv
SHAPEFILES := shapefiles/mam/mam.shp shapefiles/host_zg_area/host_zg_area.shp shapefiles/Mammals_Terrestrial/Mammals_Terrestrial.shp
MODELS := intermediates/all_viruses_models.rds intermediates/all_viruses_strict_models.rds intermediates/all_zoonoses_models.rds intermediates/all_zoonoses_norev_models.rds intermediates/all_zoonoses_strict_models.rds intermediates/domestic_viruses_models.rds intermediates/domestic_viruses_strict_models.rds intermediates/domestic_zoonoses_models.rds intermediates/domestic_zoonoses_strict_models.rds intermediates/vtraits_models.rds intermediates/vtraits_strict_models.rds
INTERMEDIATE_DATA := data/intermediate/PVR_cytb_hostmass.csv data/intermediate/HP3-ST_PDmatrix.csv data/intermediate/HP3-cytb_PDmatrix.csv
MAPNAMES_FILE := figures/maps/map_names.txt
MAP_NAMES := $(shell cat ${MAPNAMES_FILE})
EXTENDED_MAPS := figures/ExtendedFigure04-ALL.png figures/ExtendedFigure05-CARNIVORA.png figures/ExtendedFigure06-CETARTIODACTYLA.png figures/ExtendedFigure07-CHIROPTERA.png figures/ExtendedFigure08-PRIMATES.png figures/ExtendedFigure09-RODENTIA.png
FIGURES := figures/Figure01A-boxplots.pdf figures/Figure01B-boxplots.pdf figures/Figure02-all-gams.svg figures/Figure02-all-gams.png figures/Figure03-missing-zoo-maps.png figures/Figure04-viral-traits.svg figures/Figure04-viral-traits.png
shapefiles: $(SHAPEFILES)
models: $(MODELS)
intermediate_data: $(INTERMEDIATE_DATA)
maps: $(MAP_NAMES)
extended_maps: $(EXTENDED_MAPS)
figures: $(FIGURES)
.PHONY: shapefiles models intermediate_data maps extended_maps figures all clean
#shapefiles/mam/mam.shp shapefiles/host_zg_area/host_zg_area.shp shapefiles/Mammals_Terrestrial/Mammals_Terrestrial.shp: scripts/01-download-shapefiles.R
$(SHAPEFILES): scripts/01-download-shapefiles.R
Rscript $<
touch shapefiles/*/*.*
$(INTERMEDIATE_DATA): scripts/02-generate_phylogenetic_intermediate_data.R data/cytb_supertree.tree data/supertree_mammals.tree $(HP3_DATA)
Rscript $<
intermediates/postprocessed_database.rds: scripts/03-preprocess_data.R $(HP3_DATA) $(INTERMEDIATE_DATA)
Rscript $<
$(MODELS): scripts/04-fit-models.R $(FUNCTIONS) intermediates/postprocessed_database.rds
Rscript $<
documents/model_summaries.html: documents/model_summaries.Rmd $(FUNCTIONS) $(MODELS)
Rscript -e "rmarkdown::render('$<')"
documents/geographic_cross_validation.html: documents/geographic_cross_validation.Rmd $(FUNCTIONS) $(MODELS) data/region_names.rds intermediates/postprocessed_database.rds $(SHAPEFILES)
Rscript -e "rmarkdown::render('$<')"
figures/Figure01A-boxplots.pdf Figure01B-boxplots.pdf: scripts/05-make-Figure01-boxplots.R intermediates/postprocessed_database.rds
Rscript $<
figures/Figure02-all-gams.svg figures/Figure02-all-gams.png: scripts/06-make-Figure02-all-gams.R $(FUNCTIONS) $(MODELS)
Rscript $<
$(MAP_NAMES): scripts/07-make-maps.R $(MODELS) $(SHAPEFILES)
Rscript $<
figures/Figure03-missing-zoo-maps.png $(EXTENDED_MAPS): scripts/08-make-Figure03-ExtendedFigs-stitch-maps.R $(MAP_NAMES)
Rscript $<
figures/Figure04-viral-traits.svg figures/Figure04-viral-traits.png: scripts/09-make-Figure04-viral-traits.R $(MODELS)
Rscript $<
figures/ExtendedTable01-models.docx: scripts/11-make-ExtendedTable01-models.R $(MODELS)
Rscript $<
figures/SuppTable1-observed-predicted-missing.csv: scripts/12-make-SuppTable01-predictions.R $(MODELS)
Rscript $<
README.txt: README.md
cp -f README.md README.txt
clean:
rm -r shapefiles/*/
rm data/intermediate/*.*
rm intermediates/*.*
rm figures/maps/*.png
rm figures/*.png figures/*.svg figures/*.pdf figures/*.docx figures/*.csv
rm -r documents/*cache/