Browse code

Merge branch 'pablo-rodr-bio2-gridReduce'

Robert Castelo authored on 19/11/2021 11:39:28
Showing6 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: GSVA
2
-Version: 1.43.0
2
+Version: 1.43.1
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"),
... ...
@@ -58,7 +58,7 @@ importFrom(DelayedArray, rowAutoGrid,
58 58
 			  defaultAutoGrid,
59 59
 			  currentBlockId,
60 60
 			  read_block, 
61
-			  viewportReduce,
61
+			  gridReduce,
62 62
 			  write_block,
63 63
 			  close,
64 64
 			  t)
... ...
@@ -852,12 +852,12 @@ ssgsea <- function(X, geneSets, alpha=0.25, parallel.sz,
852 852
 
853 853
   n <- ncol(X)
854 854
   
855
-  if(is(X, "dgCMatrix")){
856
-    R <- t(sparseMatrixStats::colRanks(X, ties.method = "average"))
857
-    mode(R) <- "integer"
858
-  } else {
859
-    R <- apply(X, 2, function(x, p) as.integer(rank(x)))
860
-  }
855
+  print("Calculating ranks...")
856
+  
857
+  R <- t(sparseMatrixStats::colRanks(X, ties.method = "average"))
858
+  mode(R) <- "integer"
859
+
860
+  print("Calculating absolute values from ranks...")
861 861
   
862 862
   Ra <- abs(R)^alpha
863 863
   
... ...
@@ -872,9 +872,11 @@ ssgsea <- function(X, geneSets, alpha=0.25, parallel.sz,
872 872
   
873 873
   
874 874
   if (normalization) {
875
+    print("Normalizing...")
875 876
     ## normalize enrichment scores by using the entire data set, as indicated
876 877
     ## by Barbie et al., 2009, online methods, pg. 2
877
-    es <- apply(es, 2, function(x, es) x / (range(es)[2] - range(es)[1]), es)
878
+    # es <- apply(es, 2, function(x, es) x / (range(es)[2] - range(es)[1]), es)
879
+    es <- es[,1:n] / (range(es)[2] - range(es)[1])
878 880
   }
879 881
   
880 882
   if (length(geneSets) == 1)
... ...
@@ -139,7 +139,7 @@ rankHDF5 <- function(X){
139 139
     write_block(sink, grid, block)
140 140
   }
141 141
   
142
-  sink <- viewportReduce(colRanks_byBlock, grid, sink)
142
+  sink <- gridReduce(colRanks_byBlock, grid, sink)
143 143
   close(sink)
144 144
   res <- as(sink, "DelayedArray")
145 145
   res
... ...
@@ -55,16 +55,20 @@
55 55
 }
56 56
 
57 57
 .left-side, .main-sidebar {
58
-  padding-top: 75px;
58
+  top: auto;
59
+  padding-top: 0px;
59 60
 }
60 61
 
61 62
 .main-header {
62
-  max-height: 75px;
63
+  min-height: 75px;
63 64
   }
64 65
 
65 66
 .main-header .logo {
66 67
   height: 75px;
67
-  
68
+}
69
+
70
+.content-wrapper {
71
+  padding-top: 20px;
68 72
 }
69 73
 
70 74
 .run-btn {
... ...
@@ -1,6 +1,6 @@
1 1
 test_delayed <- function(){
2 2
   
3
-  set.seed(1001)
3
+  # set.seed(1001)
4 4
   m <- matrix(runif(10000), 1000, 100)
5 5
   rownames(m) <- paste0("gene_", 1:1000)
6 6
   colnames(m) <- paste0("cell_", 1:100)