rcastelo / GSVA

Gene set variation analysis
200 stars 40 forks source link

Error: Calling gsva(expr=., gset.idx.list=., method=., ...) is defunct; use a method-specific parameter object (see '?gsva'). #146

Closed BirongZhang closed 6 months ago

BirongZhang commented 8 months ago

Dear all,

when I am using

### consensusTME
bulkExpMatrix <- as.matrix(read.csv("TCGA_OV_Example.csv",header = T,sep = ",", row.names=1))
bulkExpMatrix[1:3,1:3]
ConsensusTME::consensusTMEAnalysis(bulkExpMatrix, cancer = "OV", statMethod = "gsva")

### GSVA
gsva_results <- gsva(
  bulkExpMatrix,
  Signature,
  method = "gsva")

I got the following error:

Error: Calling gsva(expr=., gset.idx.list=., method=., ...) is defunct; use a method-specific parameter object (see '?gsva').

Here is my sessionInfo():

R version 4.2.3 (2023-03-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] GSVA_1.50.1                 TBSignatureProfiler_1.15.0  SummarizedExperiment_1.28.0 Biobase_2.58.0             
 [5] GenomicRanges_1.50.2        GenomeInfoDb_1.34.9         IRanges_2.32.0              S4Vectors_0.36.2           
 [9] BiocGenerics_0.44.0         MatrixGenerics_1.10.0       matrixStats_1.2.0           dplyr_1.1.4                
[13] ConsensusTME_0.0.1.9000     devtools_2.4.5              usethis_2.2.3   

Could you please help me to have a look at this? Any advice would be highly appreciated! Thanks!

Kind regards, Birong

rcastelo commented 8 months ago

hi, in the current release version of GSVA (1.50.1) we have deprecated the way in which one calls the function gsva() in favor of an object oriented interface that should resolve some misunderstandings regarding what parameters apply to what method. However, using the old interface currently issues a warning not an error, e.g.:

library(GSVA)
example(gsva)
es <- gsva(y, geneSets)
Estimating GSVA scores for 3 gene sets.
Estimating ECDFs with Gaussian kernels
  |======================================================================| 100%

Warning message:
Calling gsva(expr=., gset.idx.list=., method=., ...) is deprecated; use a method-specific parameter object (see '?gsva'). 
es[, 1:3]
             s1           s2         s3
set1 -1.0000000 5.551115e-17 -0.8000000
set2 -0.1428571 1.298701e-01  0.3650794
set3  0.9230769 1.666667e-01  0.4848485

According to your session information you are running the current release version of GSVA 1.50.1 in R 4.2.3, which should not happen because GSVA 1.50.1 should run only on top of R 4.3.x. This raises the suspicion that GSVA might not have been installed in your system in the recommended way, which is described at https://bioconductor.org/install and also in the package landing page at https://bioconductor.org/packages/GSVA. I can make you two suggestions:

  1. Have the current release version of GSVA (1.50.1) installed in your system in the recommended way, which consists of (1) installing the latest release version of R 4.3.x from, e.g., CRAN, (2) on this latest release version of R 4.3.x, then install the package BiocManager by typing install.packages("BiocManager"), and (3) install GSVA with the command BiocManager::install("GSVA").
  2. Since the way in which the gsva() function has been called through the years is now deprecated and it will become defunct in the next release version, prompting an error such as the one you got, call the gsva() function in the new way, which is described in the help page of gsva() and in the vignette of the package.

best regards,

robert.

BirongZhang commented 8 months ago

Hi Robert,

I installed the latest R/4.3.3(R version 4.3.3), and GSVA(GSVA_1.50.1). Problem solved! Thanks very much for your time and help!

Best regards, Birong

R version 4.3.3 (2024-02-29)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Big Sur 11.6

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/London
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] TBSignatureProfiler_1.15.0  SummarizedExperiment_1.32.0 Biobase_2.62.0              GenomicRanges_1.54.1       
 [5] GenomeInfoDb_1.38.7         IRanges_2.36.0              S4Vectors_0.40.2            BiocGenerics_0.48.1        
 [9] MatrixGenerics_1.14.0       matrixStats_1.2.0           dplyr_1.1.4                 ConsensusTME_0.0.1.9000    
[13] GSVA_1.50.1   
Henry-zhang-For commented 6 months ago

Dear all, I went through the same problem. My R version is 4.4.0, GSVA version is 1.52.2. About a month ago it was normal, GSVA version was 1.51.? at that time. But it went wrong today. So I updated GSVA version, but it didn't work.

axelklenk commented 6 months ago

Dear Henry,

please do not reply to closed issues without reopening them -- we might miss your message.

Robert had already pointed this out in his previous answer:

Since the way in which the gsva() function has been called through the years is now deprecated and it will become defunct in the next release version, prompting an error such as the one you got, call the gsva() function in the new way, which is described in the help page of gsva() and in the vignette of the package.

In the version of GSVA you had been using back then, the old way of calling gsva() was deprecated, i.e., it would still work but give you a warning that it is about to change and stop working. This has now happened in the current version where the old API is defunct, i.e., does not work any longer and throws an error.

Please follow Robert's advice and check the vignette or ?gsva to learn how to use GSVA from this version on -- the necessary changes to your code are minimal but eliminate some common errors in using GSVA.

Best regards,

- axel

Henry-zhang-For commented 6 months ago

Dear Henry,

please do not reply to closed issues without reopening them -- we might miss your message.

Robert had already pointed this out in his previous answer:

Since the way in which the gsva() function has been called through the years is now deprecated and it will become defunct in the next release version, prompting an error such as the one you got, call the gsva() function in the new way, which is described in the help page of gsva() and in the vignette of the package.

In the version of GSVA you had been using back then, the old way of calling gsva() was deprecated, i.e., it would still work but give you a warning that it is about to change and stop working. This has now happened in the current version where the old API is defunct, i.e., does not work any longer and throws an error.

Please follow Robert's advice and check the vignette or ?gsva to learn how to use GSVA from this version on -- the necessary changes to your code are minimal but eliminate some common errors in using GSVA.

Best regards,

  • axel

thank you very much, i have solved this problem.

qqxj commented 5 months ago

你是煞笔么,你自己修包修不好你直接给之前版本的安装地址好么? 非要安装最新版本,找个GSVA_1.50.1版本费劲死了,cnm罗伯特

rcastelo commented 5 months ago

Dear @qqxj GSVA, and essentially every other Bioconductor package, has upstream and downstream dependencies for which the Bioconductor project can only guarantee that are compatible and play well together in the latest release, and that's the main reason why we recommend updating to the latest release of the software. That said, there are a few ways in which you can install a previous version of GSVA:

  1. Because Bioconductor package versions are associated with specific R versions, installing an older R will give you the corresponding GSVA version. For install, to install GSVA 1.50.x, install first R 4.3.x (e.g., you may find older source tarballs at https://cran.r-project.org/src/base/R-4), then install BiocManager and type BiocManager::install("GSVA").
  2. Using docker, pull the Bioconductor Docker container corresponding to the release of Bioconductor you need (see https://hub.docker.com/r/bioconductor/bioconductor_docker/tags), e.g., 3.18 for GSVA 1.50.x, and then do the BiocManager::install("GSVA") from a Docker container running this Docker image.:
    $ docker pull bioconductor/bioconductor_docker:RELEASE_3_18
  3. Use renv, see https://rstudio.github.io/renv/articles/bioconductor.html
  4. You may try first downloading the tarball of the version of GSVA you want, e.g., for GSVA 1.50.x going to https://bioconductor.org/packages/3.18/bioc/html/GSVA.html and then installing the tarball directly in the version of R you have. This may or may not work depending on a number of factors.

There may be other options/hacks that I'm not aware of, in any case, we do not give support to problems with older versions of the software, so you have to find yourself the way to working with an older version of the software.

Yoonmay-hua commented 5 months ago

Dear Henry, I met the same problem as you, could you tell us how to solve this issue? The new version package of GSVA is kind of hard to use.

Henry-zhang-For commented 5 months ago

Dear Henry, I met the same problem as you, could you tell us how to solve this issue? The new version package of GSVA is kind of hard to use.

there is a sample in the help, I use these codes replace Previous gsva function codes. you should know what it replaces if you have used gsva before.

gbmPar <- gsvaParam(dat, geneset_list, kcdf="Gaussian"#"Gaussian" for logCPM,logRPKM,logTPM, "Poisson" for counts ) gsva_mat <- gsva(gbmPar)

Yoonmay-hua commented 5 months ago

Thanks for your help. That works!

zhaozhongze-wushi commented 2 months ago

Dear all, I am encountering the same issue. My R version is 4.4.1, and the GSVA package version is 1.52.3. My friend's R version is 4.3.2, and the GSVA package version is 1.50.0. I want to perform ssGSEA analysis, but I keep getting errors. The same data and code work on my friend's computer.

axelklenk commented 2 months ago

Dear zhaozhongze-wushi,

please do not reply to closed issues without reopening them -- we might miss your message.

To make this quite clear: this is not an issue but expected behavior. In previous versions, gsva() had allowed (and silently ignored) invalid combinations of values to argument method and method parameters. Recent versions are employing an object-oriented API in which so-called parameter objects avoid this type of problem. After a deprecation period of six months in which users have received a warning asking them to update their code, using the old API is now an error.

As the error message suggests you can check out gsva() documentation using ?gsva to find out how to use the new API. For ssGSEA, you probably want to use something like:

ssgseaPar <- ssgseaParam(yourData, yourGenesets)
ssgseaScores <- gsva(ssgseaPar)

In addition, more recent versions contain performance improvements for ssGSEA in particular, so I'd recommend that your friend, too, updates to current versions of R and GSVA and uses code as in the example above.

Please let us know if you have any further questions.

Ocean7879 commented 2 weeks ago

We can resolve the issue by downloading the GSVA package from Bioconductor 3.18 (GSVA_1.50.5.tar.gz); I hope this helps. My R version is 4.3.2 (WSL-linux).