<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="" style="word-wrap:break-word">
<div class="">
<div class="">Hi, all.</div>
<div class=""><br class="">
</div>
<div class="">I’m trying to assemble a set of functions to do a resampling of a value that is calculated by a combination of subsampling and sums. Each iteration involves reading in a number of large files, sampling from the entries in the files, and doing
 calculations based on these subsamples. The way I have it set up right now is through a combination of lapply and for. The outer resampling is then done with mclapply.</div>
<div class=""><br class="">
</div>
<div class="">I have two problems. First, the code used to run, but now doesn’t. I get the error</div>
<div class=""><br class="">
</div>
<div class="">
<div class="" style="margin:0px; font-size:10px; font-family:Monaco; color:rgb(255,255,255); background-color:rgb(0,0,0)">
In parallel:::mclapply(iters, do.call(tii.calc, config), mc.cores = ncores) :</div>
<div class="" style="margin:0px; font-size:10px; font-family:Monaco; color:rgb(255,255,255); background-color:rgb(0,0,0)">
  all scheduled cores encountered errors in user code</div>
<div class="" style="margin:0px; font-size:10px; font-family:Monaco; color:rgb(245,245,245); background-color:rgb(0,0,0)">
> </div>
</div>
<div class=""><br class="">
</div>
<div class="">Any ideas on how to fix this problem? I am running R 3.3.1 in the terminal on a personal OS X Yosemite machine.</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">Second, I’m hoping to speed up the function. It is currently very slow, and I need to do a number of outer resamplings in the 100s or 1000s.</div>
<div class=""><br class="">
</div>
<div class="">Here is the outer resampling code that calls the function itself (attached):</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">source("tree_collapser.R")</div>
<div class="">source("~/taxon_influence/tii_calc.r")</div>
<div class="">library(phangorn)</div>
<div class="">library(SnowballC)</div>
<div class="">library(ape)</div>
<div class="">library(stringr)</div>
<div class=""><br class="">
</div>
<div class="">outgroup <- "Hemichordata"</div>
<div class="">burnin <- 0.5</div>
<div class="">n.iters <- 2</div>
<div class="">ncores <- parallel:::detectCores()/4</div>
<div class=""><br class="">
</div>
<div class="">d <- read.nexus.data(as.character("tully.nex"))</div>
<div class="">nom <- sort(names(d)[-which(names(d) == outgroup)])</div>
<div class=""><br class="">
</div>
<div class="">miltrees <- list.files(pattern="^minus[A-Z].*\\.t$")</div>
<div class="">fulltree <- read.nexus("tully.nex.t_alltaxa")</div>
<div class="">##iter.list <- rep(list(miltrees), n.iters)</div>
<div class="">iters <- 1:n.iters</div>
<div class=""><br class="">
</div>
<div class="">##tii.rep <- parallel:::mclapply(iters, tii.calc(iter.list, taxnames=nom, </div>
<div class="">##<span class="x_Apple-tab-span" style="white-space:pre"> </span>full.trees=fulltree, outgroup=outgroup, burnin=burnin), mc.cores=ncores)</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">config <- list(treelist=miltrees, taxnames=nom, full.trees=fulltree, </div>
<div class=""><span class="x_Apple-tab-span" style="white-space:pre"></span>outgroup=outgroup, burnin=burnin)</div>
<div class=""><br class="">
</div>
<div class="">tii.rep <- parallel:::mclapply(iters, do.call(tii.calc, config), mc.cores=ncores)</div>
</div>
<div class=""><br class="">
</div>
<div class="">Thanks!</div>
<div class=""><br class="">
</div>
<div class="">~John</div>
<div class=""><br class="">
</div>
</div>
</div>
<div class="" style="word-wrap:break-word">
<div class=""></div>
<br class="">
</div>
</body>
</html>