Skip to content

Commit

Permalink
change: gsetX now defined as relative expression
Browse files Browse the repository at this point in the history
  • Loading branch information
ivokwee committed Aug 24, 2024
1 parent f18a1c6 commit 04a9fdf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions R/gset-meta.r
Original file line number Diff line number Diff line change
Expand Up @@ -475,9 +475,12 @@ gset.fitContrastsWithAllMethods <- function(gmt,
m <- list(gsva = zx.gsva, ssgsea = zx.ssgsea, rnkcorr = zx.rnkcorr)
m <- m[which(!sapply(m, is.null))]

## average expression of geneset members
## average *relative* expression of geneset members. Note: since
## v.3.5.0 we use average relative expression instead of average
## expression.
ng <- Matrix::colSums(G != 0)
meta.matrix <- as.matrix(Matrix::t(G != 0) %*% X) / ng
mX <- X - rowMeans(X, na.rm=TRUE) ## see note above
meta.matrix <- as.matrix(Matrix::t(G != 0) %*% mX) / ng

m[["meta"]] <- meta.matrix

Expand All @@ -491,8 +494,11 @@ gset.fitContrastsWithAllMethods <- function(gmt,
}

res <- list(
meta = all.meta, sig.counts = sig.counts, outputs = all.results,
matrices = m, timings = timings0
meta = all.meta,
sig.counts = sig.counts,
outputs = all.results,
matrices = m,
timings = timings0
)

return(res)
Expand Down

0 comments on commit 04a9fdf

Please sign in to comment.