Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/output.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ print.contamMix <- function(x, tabDelim = FALSE, ...) {
if (tabDelim) {
cat(x$e, anal$MAP, anal$ci,
if (length(x$chains) > 1) coda::gelman.diag(anal$mcmcObj)$psrf else "",
x$seed,
sep="\t");
cat("\n")
} else {
Expand Down
9 changes: 9 additions & 0 deletions exec/estimate.R
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ opt = getopt(rbind(
c('saveMN', NA, 0, "logical"), #save MN intermediate for debugging
c('recordAll', NA, 0, "logical"), #record *all* proportions from MCMC chain
c('tabOutput', NA, 0, "logical"), #simple tab-delimited output
c('seed', NA, 0, "integer"), #set rng seed
c('nrThreads', NA, 1, "integer")) # Number of threads to use. Defaults to 1.
)
if (is.null(opt$nIter)) opt$nIter = 50000
Expand Down Expand Up @@ -61,6 +62,14 @@ cat(paste0("Using ",used_cores, " threads.\n"), file=stderr())

## do the work
data = loadSAM(samFn=opt$samFn, malnFn=opt$malnFn, endogId=opt$consId, baseqThreshold=opt$baseq, transverOnly=opt$transverOnly, trimBases=opt$trimBases, saveMN=opt$saveMN)
## set/record RNG seed
if (is.null(opt$seed)) {
data$seed = round(runif(1,max=1e5))
} else {
data$seed = opt$seed
}
RNGkind("L'Ecuyer-CMRG")
set.seed(data$seed)
res = runChains(nChains=opt$nChains, nIter=opt$nIter, data=data, alpha=opt$alpha)

## results in text format
Expand Down