GSVA icon indicating copy to clipboard operation
GSVA copied to clipboard

Error in rowVars, is this a bug?

Open Sporgelum opened this issue 4 months ago • 1 comments

Hello,

I was trying to run the GSVA package, and I can not go over this ERROR. I tried also your little test script and I get the same error, could I ask if this is me or it is a bug?

Thank you in advance! Bests, Marius

## ----load_library, message=FALSE, warning=FALSE, cache=FALSE------------------
library(GSVA)

## -----------------------------------------------------------------------------
p <- 10000 ## number of genes
n <- 30    ## number of samples
## simulate expression values from a standard Gaussian distribution
X <- matrix(rnorm(p*n), nrow=p,
+             dimnames=list(paste0("g", 1:p), paste0("s", 1:n)))
X[1:5, 1:5]
           s1         s2         s3          s4         s5
g1 -1.7725966 -1.2359761 -0.6027843  0.57165280  1.1265952
g2  0.9380674 -0.5480429  1.3086108  0.05344146  1.0677674
g3 -1.2904868 -0.3913396 -0.4798115  0.79482082  0.9605071
g4 -0.6453839 -0.9296986  0.8787031  0.97828711 -0.7674490
g5  0.2296284  1.2074361  0.6797481 -0.65380854  0.4248799
 
## -----------------------------------------------------------------------------
## sample gene set sizes
gs <- as.list(sample(10:100, size=100, replace=TRUE))
## sample gene sets
gs <- lapply(gs, function(n, p)
+     paste0("g", sample(1:p, size=n, replace=FALSE)), p)
names(gs) <- paste0("gs", 1:length(gs))
 
## -----------------------------------------------------------------------------
gsva.es <- gsva(X, gs, verbose=FALSE)
Error in rowVars(x, rows = rows, cols = cols, na.rm = na.rm, refine = refine,  : 
  Argument 'useNames' must be either TRUE or FALSE
> dim(gsva.es)
Error: object 'gsva.es' not found
> gsva.es[1:5, 1:5]
Error: object 'gsva.es' not found

Sporgelum avatar Aug 22 '25 17:08 Sporgelum

Hi Marius,

apologies for the very late response -- somehow your message has escaped our attention.

This error is due to a change in package matrixStats on which GSVA depends and to get around it you should install the latest version of this package., see, e.g., https://github.com/rcastelo/GSVA/issues/222#issuecomment-2609182007

However, the code you're trying to run looks like example code from an outdated version of the GSVA vignette and will not work any longer on recent version of GSVA, see, e.g., #185 for an explanation and/or (after upgrading) any of the below for getting working example code:

library(GSVA)
?gsva
example(gsva)
vignette("GSVA")

Please let us know if this does not solve your problem or you should have further questions or issues.

axelklenk avatar Sep 30 '25 08:09 axelklenk