Makefile 9.54 KB
Newer Older
1
2
D1 := data/raw
D2 := output/formatted
3
D3 := output/processed
4
5
D4 := figs/test.format.tree
D5 := figs/test.traits
6
D5 := figs/test.CWM
Georges Kunstler's avatar
Georges Kunstler committed
7
sites:= Fushan Paracou BCI Mbaiki Luquillo Japan Spain Sweden Canada France Swiss NSW NVS US
8
9
10
D3Done :=  $(addsuffix /Done.txt,$(addprefix $(D3)/, $(sites) )) 
D2traits :=  $(addsuffix /traits.csv,$(addprefix $(D2)/, $(sites) )) 
D2tree :=  $(addsuffix /tree.csv,$(addprefix $(D2)/, $(sites) )) 
Daniel Falster's avatar
Daniel Falster committed
11

12

13
all: TRY sites
14

15
sites: $(sites)
16

17

18
#-------------------------------------------------------
Daniel Falster's avatar
Daniel Falster committed
19

20
21
22
23
TRY: $(D2)/TRY/data.TRY.std.rds

$(D2)/TRY/data.TRY.std.rds:  
	Rscript R/format.data/TRY.R
24
25

#-------------------------------------------------------
26

27
BCI: $(D3)/BCI/Done.txt
28

Georges Kunstler's avatar
Georges Kunstler committed
29
$(D3)/BCI/Done.txt: R/process.data/process-fun.R $(D2)/BCI/traits.csv
30
	Rscript -e "source('$<'); process_bigplot_dataset('BCI', Rlim=15,std.traits='local'); process_bigplot_dataset('BCI', Rlim=15,std.traits='global'); process_bigplot_dataset('BCI', Rlim=15,std.traits='no');"
31

Georges Kunstler's avatar
Georges Kunstler committed
32
$(D2)/BCI/traits.csv: R/find.trait/BCI.R R/find.trait/trait-fun.R $(D2)/BCI/tree.csv 
33
34
35
36
	Rscript $<

$(D2)/BCI/tree.csv: R/format.data/BCI.R $(shell find $(D1)/BCI -type f)
	Rscript $<
Georges Kunstler's avatar
Georges Kunstler committed
37
38
39
40
41

#-------------------------------------------------------

Japan: $(D3)/Japan/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
42
$(D3)/Japan/Done.txt: R/process.data/process-fun.R $(D2)/Japan/traits.csv
43
	Rscript -e "source('$<'); process_bigplot_dataset('Japan', Rlim=15,std.traits='local');  process_bigplot_dataset('Japan', Rlim=15,std.traits='global'); process_bigplot_dataset('Japan', Rlim=15,std.traits='no');"
Georges Kunstler's avatar
Georges Kunstler committed
44

Georges Kunstler's avatar
Georges Kunstler committed
45
$(D2)/Japan/traits.csv: R/find.trait/Japan.R R/find.trait/trait-fun.R $(D2)/Japan/tree.csv 
Georges Kunstler's avatar
Georges Kunstler committed
46
47
48
49
	Rscript $<

$(D2)/Japan/tree.csv: R/format.data/Japan.R $(shell find $(D1)/Japan -type f)
	Rscript $<
50
51
52
53
#-------------------------------------------------------

Luquillo: $(D3)/Luquillo/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
54
$(D3)/Luquillo/Done.txt: R/process.data/process-fun.R $(D2)/Luquillo/traits.csv
55
	Rscript -e "source('$<'); process_bigplot_dataset('Luquillo', Rlim=15,std.traits='local');  process_bigplot_dataset('Luquillo', Rlim=15,std.traits='no');process_bigplot_dataset('Luquillo', Rlim=15,std.traits='global');"
56

Georges Kunstler's avatar
Georges Kunstler committed
57
$(D2)/Luquillo/traits.csv: R/find.trait/Luquillo.R R/find.trait/trait-fun.R $(D2)/Luquillo/tree.csv 
58
59
60
61
62
63
64
65
66
	Rscript $<

$(D2)/Luquillo/tree.csv: R/format.data/Luquillo.R $(shell find $(D1)/Luquillo -type f)
	Rscript $<

#-------------------------------------------------------

Mbaiki: $(D3)/Mbaiki/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
67
$(D3)/Mbaiki/Done.txt: R/process.data/process-fun.R $(D2)/Mbaiki/traits.csv
68
	Rscript -e "source('$<'); process_bigplot_dataset('Mbaiki', Rlim=15,std.traits='local'); process_bigplot_dataset('Mbaiki', Rlim=15,std.traits='global'); process_bigplot_dataset('Mbaiki', Rlim=15,std.traits='no');"
69

Georges Kunstler's avatar
Georges Kunstler committed
70
$(D2)/Mbaiki/traits.csv: R/find.trait/Mbaiki.R R/find.trait/trait-fun.R $(D2)/Mbaiki/tree.csv 
71
72
73
74
	Rscript $<

$(D2)/Mbaiki/tree.csv: R/format.data/Mbaiki.R $(shell find $(D1)/Mbaiki -type f)
	Rscript $<
75

76
77
78
79
#-------------------------------------------------------

Canada: $(D3)/Canada/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
80
81
$(D3)/Canada/Done.txt: R/process.data/process-fun.R  $(D2)/Canada/traits.csv
	Rscript -e "source('$<'); process_inventory_dataset('Canada',std.traits='local'); process_inventory_dataset('Canada',std.traits='global');process_inventory_dataset('Canada',std.traits='no');"
82

Georges Kunstler's avatar
Georges Kunstler committed
83
$(D2)/Canada/traits.csv: R/find.trait/Canada.R R/find.trait/trait-fun.R $(D2)/Canada/tree.csv $(D2)/TRY/data.TRY.std.rds
84
85
86
87
88
	Rscript $<

$(D2)/Canada/tree.csv: R/format.data/Canada.R $(shell find $(D1)/Canada -type f)
	Rscript $<

89
90
91
#-------------------------------------------------------
France: $(D3)/France/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
92
$(D3)/France/Done.txt: R/process.data/process-fun.R $(D2)/France/traits.csv
93
	Rscript -e "source('$<'); process_inventory_dataset('France',std.traits='local'); process_inventory_dataset('France',std.traits='global');process_inventory_dataset('France',std.traits='no');"
94

Georges Kunstler's avatar
Georges Kunstler committed
95
$(D2)/France/traits.csv: R/find.trait/France.R R/find.trait/trait-fun.R $(D2)/France/tree.csv $(D2)/TRY/data.TRY.std.rds
96
97
98
99
100
	Rscript $<

$(D2)/France/tree.csv: R/format.data/France.R $(shell find $(D1)/France -type f)
	Rscript $<

101
102
#-------------------------------------------------------

103
104
Fushan: $(D3)/Fushan/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
105
$(D3)/Fushan/Done.txt: R/process.data/process-fun.R $(D2)/Fushan/traits.csv
106
	Rscript -e "source('$<'); process_bigplot_dataset('Fushan', Rlim=15,std.traits='local'); process_bigplot_dataset('Fushan', Rlim=15,std.traits='global');process_bigplot_dataset('Fushan', Rlim=15,std.traits='no');"
107

108

Georges Kunstler's avatar
Georges Kunstler committed
109
$(D2)/Fushan/traits.csv: R/find.trait/Fushan.R R/find.trait/trait-fun.R $(D2)/Fushan/tree.csv 
110
111
112
113
114
	Rscript $<

$(D2)/Fushan/tree.csv: R/format.data/Fushan.R $(shell find $(D1)/Fushan -type f)
	Rscript $<

115
#-------------------------------------------------------
116

117
118
NSW: $(D3)/NSW/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
119
$(D3)/NSW/Done.txt: R/process.data/process-fun.R $(D2)/NSW/traits.csv
120
	Rscript -e "source('$<'); process_inventory_dataset('NSW',std.traits='local');  process_inventory_dataset('NSW',std.traits='global');process_inventory_dataset('NSW',std.traits='no');"
121

Georges Kunstler's avatar
Georges Kunstler committed
122
$(D2)/NSW/traits.csv: R/find.trait/NSW.R R/find.trait/trait-fun.R $(D2)/NSW/tree.csv $(D2)/TRY/data.TRY.std.rds
123
124
125
126
127
	Rscript $<

$(D2)/NSW/tree.csv: R/format.data/NSW.R $(shell find $(D1)/NSW -type f)
	Rscript $<

128
129
#-------------------------------------------------------

Daniel Falster's avatar
Daniel Falster committed
130
131
NVS: $(D3)/NVS/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
132
$(D3)/NVS/Done.txt: R/process.data/process-fun.R $(D2)/NVS/traits.csv
133
	Rscript -e "source('$<'); process_inventory_dataset('NVS',std.traits='local');  process_inventory_dataset('NVS',std.traits='global'); process_inventory_dataset('NVS',std.traits='no');"
134

Georges Kunstler's avatar
Georges Kunstler committed
135
$(D2)/NVS/traits.csv: R/find.trait/NVS.R R/find.trait/trait-fun.R $(D2)/NVS/tree.csv 
136
137
138
139
140
	Rscript $<

$(D2)/NVS/tree.csv: R/format.data/NVS.R $(shell find $(D1)/NVS -type f)
	Rscript $<

141
142
#-------------------------------------------------------

143
Paracou: $(D3)/Paracou/Done.txt
144

Georges Kunstler's avatar
Georges Kunstler committed
145
$(D3)/Paracou/Done.txt: R/process.data/process-fun.R $(D2)/Paracou/traits.csv
146
	Rscript -e "source('$<'); process_bigplot_dataset('Paracou', Rlim=15,std.traits='local');  process_bigplot_dataset('Paracou', Rlim=15,std.traits='global');  process_bigplot_dataset('Paracou', Rlim=15,std.traits='no');"
147

Georges Kunstler's avatar
Georges Kunstler committed
148
$(D2)/Paracou/traits.csv: R/find.trait/Paracou.R R/find.trait/trait-fun.R $(D2)/Paracou/tree.csv 
149
	Rscript $<
150
151
152
153

$(D2)/Paracou/tree.csv: R/format.data/Paracou.R $(shell find $(D1)/Paracou -type f)
	Rscript $<

154
155
156
157
#-------------------------------------------------------

Spain: $(D3)/Spain/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
158
$(D3)/Spain/Done.txt: R/process.data/process-fun.R $(D2)/Spain/traits.csv
159
	Rscript -e "source('$<'); process_inventory_dataset('Spain',std.traits='local');  process_inventory_dataset('Spain',std.traits='global'); process_inventory_dataset('Spain',std.traits='no');"
160

Georges Kunstler's avatar
Georges Kunstler committed
161
$(D2)/Spain/traits.csv: R/find.trait/Spain.R R/find.trait/trait-fun.R $(D2)/Spain/tree.csv $(D2)/TRY/data.TRY.std.rds
162
163
164
165
166
	Rscript $<

$(D2)/Spain/tree.csv: R/format.data/Spain.R $(shell find $(D1)/Spain -type f)
	Rscript $<

167
168
169
170
#-------------------------------------------------------

Sweden: $(D3)/Sweden/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
171
$(D3)/Sweden/Done.txt: R/process.data/process-fun.R  $(D2)/Sweden/traits.csv
172
	Rscript -e "source('$<'); process_inventory_dataset('Sweden',std.traits='local');  process_inventory_dataset('Sweden',std.traits='global'); process_inventory_dataset('Sweden',std.traits='no');"
173

Georges Kunstler's avatar
Georges Kunstler committed
174
$(D2)/Sweden/traits.csv: R/find.trait/Sweden.R R/find.trait/trait-fun.R $(D2)/Sweden/tree.csv $(D2)/TRY/data.TRY.std.rds
175
176
177
178
179
	Rscript $<

$(D2)/Sweden/tree.csv: R/format.data/Sweden.R $(shell find $(D1)/Sweden -type f)
	Rscript $<

180
181
182
#-------------------------------------------------------

Swiss: $(D3)/Swiss/Done.txt
183

Georges Kunstler's avatar
Georges Kunstler committed
184
$(D3)/Swiss/Done.txt: R/process.data/process-fun.R $(D2)/Swiss/traits.csv
185
	Rscript -e "source('$<'); process_inventory_dataset('Swiss',std.traits='local');  process_inventory_dataset('Swiss',std.traits='global'); process_inventory_dataset('Swiss',std.traits='no');"
186

Georges Kunstler's avatar
Georges Kunstler committed
187
$(D2)/Swiss/traits.csv: R/find.trait/Swiss.R R/find.trait/trait-fun.R $(D2)/Swiss/tree.csv $(D2)/TRY/data.TRY.std.rds
188
189
190
191
192
	Rscript $<

$(D2)/Swiss/tree.csv: R/format.data/Swiss.R $(shell find $(D1)/Swiss -type f)
	Rscript $<

193
#-------------------------------------------------------
194

195
196
US: $(D3)/US/Done.txt

Georges Kunstler's avatar
Georges Kunstler committed
197
$(D3)/US/Done.txt: R/process.data/process-fun.R  $(D2)/US/traits.csv
198
	Rscript -e "source('$<'); process_inventory_dataset('US',std.traits='local'); process_inventory_dataset('US',std.traits='global'); process_inventory_dataset('US',std.traits='no');"
199

Georges Kunstler's avatar
Georges Kunstler committed
200
$(D2)/US/traits.csv: R/find.trait/US.R R/find.trait/trait-fun.R $(D2)/US/tree.csv $(D2)/TRY/data.TRY.std.rds
201
202
203
204
205
	Rscript $<

$(D2)/US/tree.csv: R/format.data/US.R $(shell find $(D1)/US -type f) 
	Rscript $<

206
#-------------------------------------------------------
207
TEST.TREE: $(D4)/Done.txt 
208

209
210
$(D4)/Done.txt:	R/format.data/test.tree.R $(D3tree) 
	Rscript $<
211
212

#-------------------------------------------------------
213
TEST.TRAITS: $(D5)/Done.txt 
214

215
216
$(D5)/Done.txt:	R/find.trait/test.traits.R $(D4)/Done.txt $(D3traits)
	Rscript $<
217

218
#-------------------------------------------------------
219
TEST.CWM: $(D6)/Done.txt 
220

221
222
$(D6)/Done.txt:	R/process.data/test.tree.CWM.R  $(D5)/Done.txt $(D3Done)
	Rscript $<
223

224
#-------------------------------------------------------
225
226
227

# This susbtitution rule should work as rule, but not, why not?
# docs/output/formatted/%/tree.csv: $(D1)/%/* %.R
228
# 	Rscript %.R   
229
230
231
232
233
234
235
236
237
238
239
240

# Is based on this which does work
# %-tree.csv: %/* %/*/* %.R
#         Rscript $*.R

# code to generate makefile contents
# s = dir("data/metadata/sites")
# cat((sprintf("%s: output/formatted/%s/traits.csv\n
# output/formatted/%s/traits.csv: output/formatted/%s/tree.csv R/find.trait/%s.R
# \tRscript R/find.trait/%s.R\n
# output/formatted/%s/tree.csv: $(shell find data/raw/%s -type f) %s.R
# \tRscript %s.R\n\n",s,s,s,s,s,s,s,s,s,s,s)), file="temp.txt")
Daniel Falster's avatar
Daniel Falster committed
241