
dropMonomorphies = function(sms) {
 sl = smList(sms)
 summs = lapply(sl, col.summary)
 todrop = lapply(summs, function(x) which(x[,"RAF"]==1 | x[,"RAF"]==0))
 for (i in 1:length(todrop))
   if (length(todrop[[i]])>0) sl[[i]] = sl[[i]][,-todrop[[i]]]
 sms@smlEnv$smList = sl
 sms
}

library(GGdata)
library(multicore)
data(eset)
ex
library(genefilter)
exf1 = nsFilter(ex)
length(get("17", revmap(illuminaHumanv1CHR))->ZZ)
kp = intersect(ZZ, featureNames(exf1[[1]]))
c17 = getSS("GGdata", "17", renameChrs="chr17", probesToKeep=kp, wrapperEndo=dropMonomorphies)
f1dm = eqtlTests(c17, ~male, targdir="c17c", genegran=1, geneApply=mclapply)
save(f1dm, file="f1dm.rda")
set.seed(1234); permf1dm = eqtlTests(permEx(c17), ~male, targdir="c17c_perm", genegran=1, geneApply=mclapply)
save(permf1dm, file="permf1dm.rda")
