## Not run:
# #
# # contents of fns are two chromsomes of cis runs for CEU
# #
# fns = dir(system.file("rdas", package="GGtools"), full=TRUE)
# cc = collectBest(fns, mafs=c(.01, .05), hidists=c(10000, 50000))
# sapply(cc, sapply, function(x) sum(x$fdr <= 0.01))
# #
# # this tells us which to keep
# #
# kp = cc[["0.05"]][["50000"]]
# kp = kp[kp$fdr <= 0.01,]
# #
# # the hits are in the table above; the following function
# # retrieves the initial scores giving rise to the filtered
# # hits
# #
# pullHits = function(fns, atts) {
# tmp = lapply(fns, function(x) get(load(x)))
# kl = lapply(tmp, function(x) paste(names(x), x$snp, sep=":"))
# attk = paste(atts$genes, atts$bestsnp, sep=":")
# tmp = lapply(1:length(tmp), function(x) tmp[[x]][ match( attk, kl[[x]], nomatch=0 ) ])
# curans = do.call(c, lapply(tmp, as, "GRanges"))
# neword = match( attk, paste(names(curans), curans$snp, sep=":"))
# newfdr = atts$fdr[neword]
# curans$fdr = newfdr
# curans
# }
# pullHits( fns, kp )
# #
# #
# #
# # after executing code in example for All.cis (protected by dontrun)
# # and running save(f1, file="f1.rda"), the following will work
# # genewise max score
# cf1 = collectFiltered("f1.rda", mafs=.02, hidists=25000, targetname="gwise")
# # SNPwise scores, all
# cf2 = collectFiltered("f1.rda", mafs=.02, hidists=25000, targetname="swise",
# filterFun = cis.FDR.filter.SNPcentric.complete )
# # SNPwise scores, best per SNP when SNP is cis to multiple genes
# cf3 = collectFiltered("f1.rda", mafs=.02, hidists=25000, targetname="swise2",
# filterFun = cis.FDR.filter.SNPcentric )
# ## End(Not run) # end dontrun
Run the code above in your browser using DataLab