-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontent.mk
357 lines (248 loc) · 8.81 KB
/
content.mk
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
## Framework for making tsvs (not part of pipeline)
Ignore += $(wildcard *.prov.tsv *.var.tsv)
######################################################################
## Compare old and new sgtf
sgtf_comp.Rout: sgtf_comp.R sgtf_old.rds sgtf_new.rds
$(pipeR)
comp_plots.Rout: comp_plots.R sgtf_comp.rds
######################################################################
Sources += $(wildcard *.dict.tsv)
######################################################################
sgtf_ref.Rout: sgtf_ref.R data/sgtf_ref.rds prov.dict.tsv
sr_clean.Rout: sr_clean.R sgtf_ref.rds
$(pipeR)
sr.Rout: sr_agg.R sr_clean.rds dataDates.rda
$(pipeR)
######################################################################
## sgtf pipeline
## sgtf line list by aggregating (everything is extended now)
## (here is where we manually pick the data set)
sgtf.Rout: sgtf_agg.R sr.rds
$(pipeR)
## sgtf.props.Rout: props.R
## sgtf.pplots.Rout: pplots.R
## Fit our big model
impmakeR += bin quasi
## fitbig.bin.Rout: fitbig.R bin.R
## fitbig.quasi.Rout: fitbig.R quasi.R
.PRECIOUS: fitbig.%.Rout
fitbig.%.Rout: fitbig.R sgtf.props.rds %.rda
$(pipeR)
## Tidy and coefplot
## tidybig.bin.Rout: tidybig.R
## tidybig.quasi.Rout: tidybig.R
.PRECIOUS: tidybig.%.Rout
tidybig.%.Rout: tidybig.R fitbig.%.rds
$(pipeR)
## Simulate ensembles from resample parameters
## simbig.quasi.Rout: simbig.R
## simbig.bin.rds: simbig.R
simbig.%.Rout: simbig.R fitbig.%.rds simDates.rda
$(pipeR)
impmakeR += simsplot
## simsplot.quasi.Rout: simbigplot.R
simsplot.%.Rout: simbigplot.R simbig.%.rds sgtf.props.rds
$(pipeR)
######################################################################
## ssfit (Preprint 1)
## Machinery (still rough and should be simplified)
bbmle_overdisp.Rout: bbmle_overdisp.R
test_overdisp.Rout: test_overdisp.R bbmle_overdisp.rda
betaformulation.Rout: betaformulation.R
$(pipeR)
## Refactoring this into ssfitfuns
ssfit.Rout: ssfit.R sgtf.props.rds betasigma.rda
$(pipeR)
ssprofile.Rout: ssprofile.R ssfit.rda
$(pipeRcall)
## Unfinished!
sstidyPlots.Rout: sstidyPlots.R sstidy.rds
$(pipeRcall)
## sssims.rds: sssims.R
sssims.Rout: basesims.R ssfit.rda simDates.rda
$(pipeRcall)
sssimsplot.Rout: simbigplot.R sssims.rds sgtf.props.rds dataDates.rda
$(pipeRcall)
######################################################################
## Parallel ssbin (could be DRY-ed later)
ssbin.Rout: ssbin.R sgtf.props.rds bbmle_overdisp.rda
$(pipeR)
ssbinprofile.Rout: ssprofile.R ssbin.rda
$(pipeRcall)
## Graphics code is hiding here; rescue someday
ssbintidy.Rout: sstidy.R ssbin.rda
$(pipeRcall)
ssbinsims.Rout: basesims.R ssbin.rda simDates.rda
$(pipeRcall)
ssbinsimsplot.Rout: simbigplot.R ssbinsims.rds sgtf.props.rds dataDates.rda
$(pipeRcall)
## ssbinsimfake.rds: simfake.R
ssbinsimfake.Rout: simfake.R ssbinsims.rds sgtf.props.rds betaformulation.rda
$(pipeRcall)
ssfake.props.rds: outputs/ssbinsimfake.rds
$(copy)
######################################################################
## Table for 1210 preprint (products.md)
## ssalltidy.Rout.csv: ssalltidy.R
ssalltidy.Rout: ssalltidy.R sstidy.rds ssbintidy.rds
$(pipeRcall)
######################################################################
## Back to sr pipeline
## Rename this stuff (or directorize)
## sr.props.Rout: props.R
sr.max.Rout: maxmodel.R sr.props.rds
$(pipeR)
sr.max.check.Rout: checkfit.R sr.max.rds
$(pipeR)
sr.good.Rout: goodmodel.R sr.props.rds
$(pipeR)
sr.good.check.Rout: checkfit.R sr.good.rds
$(pipeR)
## sr.props.Rout: props.R
## sgtf_%.Rout: sr_%.Rout
sr_gauteng.Rout: gpfilter.R sr.props.rds
$(pipeR)
## Maybe this is superseded by ggpredict stuff
## gauteng_escPlot.Rout: escPlot.R sr_gauteng.rds
impmakeR += escPlot
%_escPlot.Rout: escPlot.R sr_%.rds
$(pipeR)
## gauteng_mm.Rout: srp_mm.R sr_gauteng.rds
%_mm.Rout: srp_mm.R sr_%.rds
$(pipeR)
## Rename to diagnosis or something
## gauteng_mm.dharma.Rout: dharma.R sr_gauteng.rds
%.dharma.Rout: dharma.R %.rds
$(pipeR)
## Rename to diagnosis or something
## gauteng_mm.predict.Rout: predict.R sr_gauteng.rds
## gauteng_mm.predict.Rout: predict.R sr_gauteng.rds
%.predict.Rout: predict.R %.rds dataDates.rda simDates.rda
$(pipeR)
gauteng.rplot.Rout: rplot.R gauteng_mm.predict.rds sr_gauteng.rds
$(pipeR)
sr_glm.Rout: sr_glm.R sr_clean.rds
sr_profile.Rout: sr_profile.R sr_fit.rda
######################################################################
## A simple pipeline for faking sr data
sr.fake.Rout: bbinfake.R sr.props.rds betaformulation.rda
$(pipeR)
## Select out the sucky provinces (using fit stuff below)
sr.currfake.Rout: currfake.R sr.fake.rds rpfits.rda
$(pipeR)
## Look at sr-style data with gams
## sr.currfake.gamplot.Rout: gamplot.R
%.gamplot.Rout: gamplot.R %.rds
$(pipeR)
######################################################################
## An ambitious pipeline for faking sr data
## To make a realistic challenge, we should fit the real data separately
## Didn't work, but we did do some good fitting stuff!
# separate fits to reinfection and primary data
rpfits.Rout: rpfits.R sr.props.rds ssbinfuns.rda
$(pipeR)
## Refactoring 2021 Dec 11 (Sat)
## ssbinfuns.rda: ssbinfuns.R
######################################################################
## post-process omega proportions
impmakeR += props
%.props.Rout: props.R %.rds simDates.rda
$(pipeR)
## Naive smoothed plots
impmakeR += pplots
%.pplots.Rout: pplots.R %.props.rds
$(pipeR)
######################################################################
## Alternative version (name controls data stream instead of fit type)
## Fit a big model (embracing for now the quasi default)
impmakeR += fitq
%.fitq.Rout: fitbig.R quasi.rda %.props.rds
$(pipeR)
## Tidy and coefplot
impmakeR += tidy
%.tidy.Rout: tidybig.R %.fitq.rds
$(pipeR)
######################################################################
## Merging Lancet pcr with reinfection
phase.Rout: phase.R reinf.rds sgtf.tsv
$(pipeR)
######################################################################
kappa.Rout: kappa.R
$(pipeR)
######################################################################
## Experimental
## A short attempt to fit a glmm (doesn't accept quasi) 2021 Dec 07 (Tue)
glmm.Rout: glmm.R bin.rda sgtf.props.rds
$(pipeR)
## quasify (so far just cribbed from Ben)
quasify.Rout: quasify.R
## Stan from Daniel
Sources += $(wildcard *.stan)
stanfit_newyork_basemodel.Rout: stanfit_newyork_basemodel.R basemodel.stan
##
ssstan.Rout: ssstan.R sslogist.stan
##
constsim.Rout: constsim.R
######################################################################
## TMB example
Sources += $(wildcard *.cpp)
Ignore += $(wildcard *.o *.so)
tmb_fit.Rout: tmb_fit.R outputs/ssbinsimfake.rds logistic_fit.cpp tmb_funs.rda
tmb_eval.Rout: tmb_eval.R tmb_fit.rda outputs/ssbinsimfake.rds tmb_funs.rda
tmb_ci.Rout: tmb_ci.R tmb_fit.rda
tmb_ci_plot.Rout: tmb_ci_plot.R tmb_ci.rds
######################################################################
## TMB application (developing) 2021 Dec 12 (Sun)
tmb_look.Rout: tmb_look.R logistic_sim.rds
tmb_funs.Rout: tmb_funs.R
## Run once ever; supposed to make things faster
Ignore += precompile.out
precompile.out:
sudo Rscript --vanilla -e "TMB::precompile()"
touch $@
## This should also be run once and not piped -- only if you have a sudo installation of TMB
## When I tried precompile alone, it got very confused
## This is not tested 2021 Dec 13 (Mon) but matches something that seems to have worked
## You should be able to sudo make any .so after you do the precompile
Ignore += firstcompile.out
firstcompile.out: base = logistic_fit_fixedloc
firstcompile.out: precompile.out
touch $<
echo sudo Rscript --vanilla -e "TMB::compile('$(base)')" && \
echo sudo rm $(base).so $(base).o
touch $@
## Compile a TMB model
Ignore += logistic_fit_fixedloc.so
logistic_fit_fixedloc.so: logistic_fit_fixedloc.cpp logistic_fit.h
touch $<
Rscript --vanilla -e "TMB::compile('$<')"
## Fit the SG with fixedloc
## ssfake.mmfit.Rout: mmfit.R
## sgtf.mmfit.Rout: mmfit.R
.PRECIOUS: %.mmfit.Rout
%.mmfit.Rout: mmfit.R %.props.rds tmb_funs.rda logistic_fit_fixedloc.so
$(pipeR)
## ssfake.mmeval.Rout: mmeval.R
## sgtf.props.mmeval.Rout.pdf: mmeval.R
## sgtf.props.mmeval.Rout: mmeval.R
.PRECIOUS: %.mmeval.Rout
%.mmeval.Rout: mmeval.R %.mmfit.rda tmb_funs.rda logistic_fit_fixedloc.so
$(pipeR)
ssfake.ssfit.Rout: ssfit.R sgtf.props.rds betaformulation.rda
%.ssfit.Rout: ssfit.R %.props.rds betatheta.rda
$(pipeR)
######################################################################
### Makestuff
Sources += Makefile
Ignore += makestuff
msrepo = https://github.com/dushoff
Makefile: makestuff/00.stamp
makestuff/%.stamp:
- $(RM) makestuff/*.stamp
(cd makestuff && $(MAKE) pull) || git clone $(msrepo)/makestuff
touch $@
-include makestuff/os.mk
## -include makestuff/pipeR.mk
-include makestuff/git.mk
-include makestuff/visual.mk
-include makestuff/pipeR.mk