Makefile 9.72 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 Canada France Spain US Sweden Swiss NSW NVS Japan
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

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='no'); process_bigplot_dataset('BCI', Rlim=15,std.traits='global');"
31

32
$(D2)/BCI/traits.csv: R/find.trait/BCI.R R/find.trait/trait.fun.R $(D2)/BCI/tree.csv $(D2)/TRY/data.TRY.std.rds
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
42

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

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

$(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='no'); process_bigplot_dataset('Japan', Rlim=15,std.traits='global');"
Georges Kunstler's avatar
Georges Kunstler committed
44
45
46
47
48
49

$(D2)/Japan/traits.csv: R/find.trait/Japan.R R/find.trait/trait.fun.R $(D2)/Japan/tree.csv $(D2)/TRY/data.TRY.std.rds
	Rscript $<

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

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

$(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
57
58
59
60
61
62
63
64
65
66
67

$(D2)/Luquillo/traits.csv: R/find.trait/Luquillo.R R/find.trait/trait.fun.R $(D2)/Luquillo/tree.csv $(D2)/TRY/data.TRY.std.rds
	Rscript $<

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

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

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

$(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='no'); process_bigplot_dataset('Mbaiki', Rlim=15,std.traits='global');"
69
70
71
72
73
74

$(D2)/Mbaiki/traits.csv: R/find.trait/Mbaiki.R R/find.trait/trait.fun.R $(D2)/Mbaiki/tree.csv $(D2)/TRY/data.TRY.std.rds
	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

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

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

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='no');process_inventory_dataset('France',std.traits='global');"
94

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
105
Fushan: $(D3)/Fushan/Done.txt

$(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='no');process_bigplot_dataset('Fushan', Rlim=15,std.traits='global');"
107

108

109
$(D2)/Fushan/traits.csv: R/find.trait/Fushan.R R/find.trait/trait.fun.R $(D2)/Fushan/tree.csv $(D2)/TRY/data.TRY.std.rds
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

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='no');process_inventory_dataset('NSW',std.traits='global');"
121

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
132
NVS: $(D3)/NVS/Done.txt

$(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='no'); process_inventory_dataset('NVS',std.traits='global');"
134

135
$(D2)/NVS/traits.csv: R/find.trait/NVS.R R/find.trait/trait.fun.R $(D2)/NVS/tree.csv $(D2)/TRY/data.TRY.std.rds
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

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='no');  process_bigplot_dataset('Paracou', Rlim=15,std.traits='global');"
147

148
$(D2)/Paracou/traits.csv: R/find.trait/Paracou.R R/find.trait/trait.fun.R $(D2)/Paracou/tree.csv $(D2)/TRY/data.TRY.std.rds
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

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='no'); process_inventory_dataset('Spain',std.traits='global');"
160

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

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='no'); process_inventory_dataset('Sweden',std.traits='global');"
173

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

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='no'); process_inventory_dataset('Swiss',std.traits='global');"
186

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

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='no');process_inventory_dataset('US',std.traits='global');"
199

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