/
abcMK.R
23 lines (20 loc) · 1.11 KB
/
abcMK.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## ####################################################################
## create a control file to send to the cluster
## ####################################################################
setwd('/home1/02413/sbellan/Rakai/AcuteRetroSim/')
batch <- 5
batchdirnm <- file.path('results',paste0('abcBatch',batch))
if(!file.exists(batchdirnm)) dir.create(batchdirnm) # create directory if necessary
if(!file.exists(file.path(batchdirnm,'routs'))) dir.create(file.path(batchdirnm, 'routs')) # setup directory to store Rout files
for(jj in 1:16) { ## separate batches into smaller ones so they start on queue faster
sink(paste0("abcGo",jj,".txt"))
## ####################################################################
to.do <- (jj-1)*25 + 1:25
for(ii in to.do) {
cmd <- paste("R CMD BATCH '--no-restore --no-save --args batch.dir=\"", batchdirnm, "\" seed=", ii, " batch=", batch,
"' ABCsimStarter.R ", file.path(batchdirnm, "routs", paste0('abc', ii, ".Rout")), sep='')
cat(cmd) # add command
cat('\n') # add new line
}
sink()
}