Browse code

removed filterFeatureSparse()

pablo-rodr-bio2 authored on 03/05/2021 12:24:35
Showing 3 changed files

... ...
@@ -1,5 +1,5 @@
1 1
 Package: GSVA
2
-Version: 1.39.27
2
+Version: 1.39.28
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"),
... ...
@@ -86,13 +86,10 @@ setMethod("gsva", signature(expr="SingleCellExperiment", gset.idx.list="list"),
86 86
   }
87 87
   expr <- assays(se)[[annotation]]
88 88
   
89
-  ## filter genes according to verious criteria,
89
+  ## filter genes according to various criteria,
90 90
   ## e.g., constant expression
91
-  if(is(expr, "dgCMatrix")){
92
-    expr <- .filterFeaturesSparse(expr, method)
93
-  } else {
94
-    expr <- .filterFeatures(expr, method)
95
-  }
91
+  
92
+  expr <- .filterFeatures(expr, method)
96 93
   
97 94
   ## map to the actual features for which expression data is available
98 95
   mapped.gset.idx.list <- .mapGeneSetsToFeatures(gset.idx.list, rownames(expr))
... ...
@@ -144,7 +141,7 @@ setMethod("gsva", signature(expr="dgCMatrix", gset.idx.list="list"),
144 141
   
145 142
   ## filter genes according to verious criteria,
146 143
   ## e.g., constant expression
147
-  expr <- .filterFeaturesSparse(expr, method)
144
+  expr <- .filterFeatures(expr, method)
148 145
   
149 146
   ## map to the actual features for which expression data is available
150 147
   mapped.gset.idx.list <- .mapGeneSetsToFeatures(gset.idx.list, rownames(expr))
... ...
@@ -66,27 +66,3 @@
66 66
   m@x <- unlist(x, use.names=FALSE)
67 67
   m
68 68
 }
69
-
70
-## filter out genes which non-zero values have
71
-## constant expression values
72
-.filterFeaturesSparse <- function(expr, method) {
73
-  
74
-  sdGenes <- sapply(.sparseToList(expr, 1), sd)
75
-  
76
-  if (any(sdGenes == 0) || any(is.na(sdGenes))) {
77
-    warning(sum(sdGenes == 0 | is.na(sdGenes)),
78
-            " genes with constant expression values throuhgout the samples.")
79
-    if (method != "ssgsea") {
80
-      warning("Since argument method!=\"ssgsea\", genes with constant expression values are discarded.")
81
-      expr <- expr[sdGenes > 0 & !is.na(sdGenes), ]
82
-    }
83
-  }
84
-  
85
-  if (nrow(expr) < 2)
86
-    stop("Less than two genes in the input assay object\n")
87
-  
88
-  if(is.null(rownames(expr)))
89
-    stop("The input assay object doesn't have rownames\n")
90
-  
91
-  expr
92
-}