Browse code

local BiocCheck error fix

Yichen Wang authored on 10/05/2021 22:58:10
Showing1 changed files
... ...
@@ -1,25 +1,21 @@
1
-#' Compute Z-Score
2
-#'
3
-#' Computes Z-Score from an input count matrix using the formula ((x-mean(x))/sd(x))
4
-#' for each gene across all cells. The input count matrix can either be a base matrix,
5
-#' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6
-#' package to efficiently compute the Z-Score matrix.
7
-#'
8
-#' @param counts matrix (base matrix, dgCMatrix or DelayedMatrix)
9
-#'
10
-#' @return z-score computed counts matrix (DelayedMatrix)
11
-#' @export
12
-#'
13
-#' @examples
14
-#'
15
-#' data(sce_chcl, package = "scds")
16
-#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17
-#'
18
-computeZScore <- function(counts) {
19
-    if (!methods::is(counts, "DelayedArray")) {
20
-        counts <- DelayedArray::DelayedArray(counts)
21
-    }
22
-    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
23
-    counts[base::is.nan(counts)] <- 0
24
-    return(counts)
25
-}
1
+#' Compute Z-Score
2
+#'
3
+#' Computes Z-Score from an input count matrix using the formula
4
+#' ((x-mean(x))/sd(x)) for each gene across all cells. The input count matrix
5
+#' can either be a base matrix, dgCMatrix or a DelayedMatrix. Computations are
6
+#' performed using DelayedMatrixStats package to efficiently compute the
7
+#' Z-Score matrix.
8
+#' @param counts matrix (base matrix, dgCMatrix or DelayedMatrix)
9
+#' @return z-score computed counts matrix (DelayedMatrix)
10
+#' @export
11
+#' @examples
12
+#' data(sce_chcl, package = "scds")
13
+#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
14
+computeZScore <- function(counts) {
15
+    if (!methods::is(counts, "DelayedArray")) {
16
+        counts <- DelayedArray::DelayedArray(counts)
17
+    }
18
+    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
19
+    counts[base::is.nan(counts)] <- 0
20
+    return(counts)
21
+}
Browse code

Fixed 'dgeMatrix' unable to store error

Irzam Sarfraz authored on 02/12/2020 10:03:45
Showing1 changed files
... ...
@@ -16,12 +16,10 @@
16 16
 #' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17 17
 #'
18 18
 computeZScore <- function(counts) {
19
-    #inputClass <- class(counts)[1]
20 19
     if (!methods::is(counts, "DelayedArray")) {
21 20
         counts <- DelayedArray::DelayedArray(counts)
22 21
     }
23 22
     counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
24 23
     counts[base::is.nan(counts)] <- 0
25
-    #counts <- as(counts, inputClass)
26 24
     return(counts)
27 25
 }
Browse code

Minor fixes

Irzam Sarfraz authored on 01/12/2020 22:44:36
Showing1 changed files
... ...
@@ -5,7 +5,7 @@
5 5
 #' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6 6
 #' package to efficiently compute the Z-Score matrix.
7 7
 #'
8
-#' @param counts matrix (base matrix, dgCMatrix or DelaymedMatrix)
8
+#' @param counts matrix (base matrix, dgCMatrix or DelayedMatrix)
9 9
 #'
10 10
 #' @return z-score computed counts matrix (DelayedMatrix)
11 11
 #' @export
... ...
@@ -16,10 +16,12 @@
16 16
 #' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17 17
 #'
18 18
 computeZScore <- function(counts) {
19
+    #inputClass <- class(counts)[1]
19 20
     if (!methods::is(counts, "DelayedArray")) {
20 21
         counts <- DelayedArray::DelayedArray(counts)
21 22
     }
22 23
     counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
23 24
     counts[base::is.nan(counts)] <- 0
25
+    #counts <- as(counts, inputClass)
24 26
     return(counts)
25 27
 }
Browse code

Merge devel branch (Oct 5) into master branch

Yusuke Koga authored on 09/10/2020 17:57:06
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,25 @@
1
+#' Compute Z-Score
2
+#'
3
+#' Computes Z-Score from an input count matrix using the formula ((x-mean(x))/sd(x))
4
+#' for each gene across all cells. The input count matrix can either be a base matrix,
5
+#' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6
+#' package to efficiently compute the Z-Score matrix.
7
+#'
8
+#' @param counts matrix (base matrix, dgCMatrix or DelaymedMatrix)
9
+#'
10
+#' @return z-score computed counts matrix (DelayedMatrix)
11
+#' @export
12
+#'
13
+#' @examples
14
+#'
15
+#' data(sce_chcl, package = "scds")
16
+#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17
+#'
18
+computeZScore <- function(counts) {
19
+    if (!methods::is(counts, "DelayedArray")) {
20
+        counts <- DelayedArray::DelayedArray(counts)
21
+    }
22
+    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
23
+    counts[base::is.nan(counts)] <- 0
24
+    return(counts)
25
+}
Browse code

Revert "Sctk documentation "

Joshua D. Campbell authored on 09/06/2020 23:22:05 • GitHub committed on 09/06/2020 23:22:05
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-#' Compute Z-Score
2
-#'
3
-#' Computes Z-Score from an input count matrix using the formula ((x-mean(x))/sd(x))
4
-#' for each gene across all cells. The input count matrix can either be a base matrix,
5
-#' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6
-#' package to efficiently compute the Z-Score matrix.
7
-#'
8
-#' @param counts matrix (base matrix, dgCMatrix or DelaymedMatrix)
9
-#'
10
-#' @return z-score computed counts matrix (DelayedMatrix)
11
-#' @export
12
-#'
13
-#' @examples
14
-#'
15
-#' data(sce_chcl, package = "scds")
16
-#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17
-#'
18
-computeZScore <- function(counts) {
19
-    if (!methods::is(counts, "DelayedArray")) {
20
-        counts <- DelayedArray::DelayedArray(counts)
21
-    }
22
-    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
23
-    counts[base::is.nan(counts)] <- 0
24
-    return(counts)
25
-}
Browse code

update plotSCEHeatmap functionality

Yichen Wang authored on 08/05/2020 21:18:33
Showing1 changed files
... ...
@@ -1,25 +1,25 @@
1
-#' Compute Z-Score
2
-#'
3
-#' Computes Z-Score from an input count matrix using the formula ((x-mean(x))/sd(x))
4
-#' for each gene across all cells. The input count matrix can either be a base matrix,
5
-#' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6
-#' package to efficiently compute the Z-Score matrix. 
7
-#'
8
-#' @param counts matrix (base matrix, dgCMatrix or DelaymedMatrix)
9
-#'
10
-#' @return z-score computed counts matrix (DelayedMatrix)
11
-#' @export
12
-#'
13
-#' @examples
14
-#' 
15
-#' data(sce_chcl, package = "scds")
16
-#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17
-#' 
18
-computeZScore <- function(counts) {
19
-    if (!methods::is(counts, "DelayedArray")) {
20
-        counts <- DelayedArray(counts)
21
-    }
22
-    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
23
-    counts[base::is.nan(counts)] <- 0
24
-    return(counts)
25
-}
1
+#' Compute Z-Score
2
+#'
3
+#' Computes Z-Score from an input count matrix using the formula ((x-mean(x))/sd(x))
4
+#' for each gene across all cells. The input count matrix can either be a base matrix,
5
+#' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6
+#' package to efficiently compute the Z-Score matrix.
7
+#'
8
+#' @param counts matrix (base matrix, dgCMatrix or DelaymedMatrix)
9
+#'
10
+#' @return z-score computed counts matrix (DelayedMatrix)
11
+#' @export
12
+#'
13
+#' @examples
14
+#'
15
+#' data(sce_chcl, package = "scds")
16
+#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17
+#'
18
+computeZScore <- function(counts) {
19
+    if (!methods::is(counts, "DelayedArray")) {
20
+        counts <- DelayedArray::DelayedArray(counts)
21
+    }
22
+    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
23
+    counts[base::is.nan(counts)] <- 0
24
+    return(counts)
25
+}
Browse code

Minor refactoring

irzamsarfraz authored on 02/05/2020 10:31:27
Showing1 changed files
... ...
@@ -12,12 +12,9 @@
12 12
 #'
13 13
 #' @examples
14 14
 #' 
15
-#' library(TENxPBMCData)
16
-#' sce <- TENxPBMCData("pbmc3k")
17
-#' rownames(sce) <- rowData(sce)$Symbol_TENx
18
-#' colnames(sce) <- colData(sce)$Barcode
19
-#' assay(sce, "countsZScore") <- computeZScore(assay(sce, "counts"))
20
-#'
15
+#' data(sce_chcl, package = "scds")
16
+#' assay(sce_chcl, "countsZScore") <- computeZScore(assay(sce_chcl, "counts"))
17
+#' 
21 18
 computeZScore <- function(counts) {
22 19
     if (!methods::is(counts, "DelayedArray")) {
23 20
         counts <- DelayedArray(counts)
Browse code

Minor changes for travis build

irzamsarfraz authored on 01/05/2020 17:16:53
Showing1 changed files
... ...
@@ -19,10 +19,10 @@
19 19
 #' assay(sce, "countsZScore") <- computeZScore(assay(sce, "counts"))
20 20
 #'
21 21
 computeZScore <- function(counts) {
22
-    if (!is(counts, "DelayedArray")) {
22
+    if (!methods::is(counts, "DelayedArray")) {
23 23
         counts <- DelayedArray(counts)
24 24
     }
25 25
     counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
26
-    counts[is.nan(counts)] <- 0
26
+    counts[base::is.nan(counts)] <- 0
27 27
     return(counts)
28 28
 }
Browse code

Updated normalization subtab

irzamsarfraz authored on 08/04/2020 09:14:16
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,28 @@
1
+#' Compute Z-Score
2
+#'
3
+#' Computes Z-Score from an input count matrix using the formula ((x-mean(x))/sd(x))
4
+#' for each gene across all cells. The input count matrix can either be a base matrix,
5
+#' dgCMatrix or a DelayedMatrix. Computations are performed using DelayedMatrixStats
6
+#' package to efficiently compute the Z-Score matrix. 
7
+#'
8
+#' @param counts matrix (base matrix, dgCMatrix or DelaymedMatrix)
9
+#'
10
+#' @return z-score computed counts matrix (DelayedMatrix)
11
+#' @export
12
+#'
13
+#' @examples
14
+#' 
15
+#' library(TENxPBMCData)
16
+#' sce <- TENxPBMCData("pbmc3k")
17
+#' rownames(sce) <- rowData(sce)$Symbol_TENx
18
+#' colnames(sce) <- colData(sce)$Barcode
19
+#' assay(sce, "countsZScore") <- computeZScore(assay(sce, "counts"))
20
+#'
21
+computeZScore <- function(counts) {
22
+    if (!is(counts, "DelayedArray")) {
23
+        counts <- DelayedArray(counts)
24
+    }
25
+    counts <- (counts - DelayedMatrixStats::rowMeans2(counts)) / DelayedMatrixStats::rowSds(counts)
26
+    counts[is.nan(counts)] <- 0
27
+    return(counts)
28
+}