Skip to content

Commit

Permalink
Merge pull request #198 from bigomics/fix-corpora-fisherpval
Browse files Browse the repository at this point in the history
use standard fisher if corpora fails
  • Loading branch information
ivokwee authored Dec 12, 2024
2 parents 36b19d2 + 0b446fb commit db9a0d0
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions R/gset-fisher.r
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,15 @@ gset.fisher <- function(genes, genesets, background = NULL,
ii <- which((a + c) > 0)
d1 <- d + 1 * (d == 0) ## hack to avoid crash...
b1 <- b + 1 * (b == 0) ## hack to avoid crash...
pv1 <- corpora::fisher.pval(a[ii], (a + b1)[ii], c[ii], (c + d1)[ii], alternative = "greater")
pv[ii] <- pv1
pv1 <- try(
corpora::fisher.pval(a[ii], (a + b1)[ii], c[ii], (c + d1)[ii], alternative = "greater"), silent = TRUE
)
if (class(pv1) != "try-error") {
pv[ii] <- pv1
} else {
message("[playbase::gset.fisher] fast.fisher failed. Testing with standard fisher.")
method <- "fisher"
}
} else if (method == "fisher") {
if (mc) {
pv <- unlist(lapply(genesets, test.fisher))
Expand Down

0 comments on commit db9a0d0

Please sign in to comment.