Browse code

Changed coercions to dgCMatrix to go via virtual classes to comply with latest updates in Matrix version 1.4-2

Robert Castelo authored on 06/09/2022 14:25:29
Showing4 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: GSVA
2
-Version: 1.45.2
2
+Version: 1.45.3
3 3
 Title: Gene Set Variation Analysis for microarray and RNA-seq data
4 4
 Authors@R: c(person("Justin", "Guinney", role=c("aut", "cre"), email="justin.guinney@sagebase.org"),
5 5
              person("Robert", "Castelo", role="aut", email="robert.castelo@upf.edu"),
... ...
@@ -885,7 +885,7 @@ ssgsea <- function(X, geneSets, alpha=0.25, parallel.sz,
885 885
   colnames(es) <- colnames(X)
886 886
   
887 887
   if(is(X, "dgCMatrix")){
888
-    es <- as(es, "dgCMatrix")
888
+    es <- as(as(as(es, "dMatrix"), "generalMatrix"), "CsparseMatrix")
889 889
   }
890 890
   
891 891
   es
... ...
@@ -920,7 +920,7 @@ zscore <- function(X, geneSets, parallel.sz, verbose=TRUE,
920 920
   es <- do.call("cbind", es)
921 921
   
922 922
   if(is(X, "dgCMatrix")){
923
-    es <- as(es, "dgCMatrix")
923
+    es <- as(as(as(es, "dMatrix"), "generalMatrix"), "CsparseMatrix")
924 924
   }
925 925
 
926 926
   rownames(es) <- names(geneSets)
... ...
@@ -955,7 +955,7 @@ plage <- function(X, geneSets, parallel.sz, verbose=TRUE,
955 955
     
956 956
     es <- do.call(rbind, es)
957 957
     
958
-    es <- as(es, "dgCMatrix")
958
+    es <- as(as(as(es, "dMatrix"), "generalMatrix"), "CsparseMatrix")
959 959
     
960 960
   } else {
961 961
     
962 962
new file mode 100644
... ...
@@ -0,0 +1,3 @@
1
+.onLoad <- function(libname, pkgname) {
2
+  options(Matrix.warnDeprecatedCoerce = 2)
3
+}
... ...
@@ -9,7 +9,7 @@ test_sparseMethods <- function(){
9 9
   gene.sets <- list("my_list1"= paste0("gene_", 1:2),
10 10
                     "my_list2"= paste0("gene_", 3:4))
11 11
   
12
-  M <- as(m, "dgCMatrix")
12
+  M <- as(as(as(m, "dMatrix"), "generalMatrix"), "CsparseMatrix")
13 13
   
14 14
   checkEqualsNumeric(gsva(m, gene.sets), gsva(M, gene.sets))
15 15
   checkEqualsNumeric(gsva(m, gene.sets, method="plage"), gsva(M, gene.sets, method="plage"))