Skip to content

Commit

Permalink
Merge pull request #5 from vladpetyuk/master
Browse files Browse the repository at this point in the history
controlling reproducibility of permutations
  • Loading branch information
GuangchuangYu committed Jun 4, 2015
2 parents 762658d + c37a00f commit 4bcf3ab
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/gsea.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ gsea <- function(geneList,
print("calculating permutation scores...")
pb <- txtProgressBar(min=0, max=nGeneSet, style=3)
}
seeds <- sample.int(length(selected.gs), replace=TRUE)
if(Sys.info()[1] == "Windows") {
permScores <- t(sapply(seq_along(selected.gs), function(i) {
if(verbose)
setTxtProgressBar(pb, i)
set.seed(seeds[i])
perm.gseaEScore(geneList=geneList,
geneSet=selected.gs[[i]],
nPerm=nPerm,
Expand All @@ -69,6 +71,7 @@ gsea <- function(geneList,
permScores <- mclapply(seq_along(selected.gs), function(i) {
if(verbose)
setTxtProgressBar(pb, i)
set.seed(seeds[i])
perm.gseaEScore(geneList=geneList,
geneSet=selected.gs[[i]],
nPerm=nPerm,
Expand Down

0 comments on commit 4bcf3ab

Please sign in to comment.