... | ... |
@@ -3,11 +3,11 @@ |
3 | 3 |
#' @export |
4 | 4 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
5 | 5 |
#' @return Sum-scaled normalized matrix. |
6 |
-#' |
|
6 |
+#' |
|
7 | 7 |
#' @examples |
8 | 8 |
#' ei <- matrix(0:20,nrow = 7) |
9 | 9 |
#' eo <- SUM_FN(ei) |
10 |
-#' |
|
10 |
+#' |
|
11 | 11 |
SUM_FN = function (ei) { |
12 | 12 |
scales = colSums(ei) |
13 | 13 |
eo = t(t(ei) * mean(scales) / scales) |
... | ... |
@@ -21,11 +21,11 @@ SUM_FN = function (ei) { |
21 | 21 |
#' @export |
22 | 22 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
23 | 23 |
#' @return TMM normalized matrix. |
24 |
-#' |
|
24 |
+#' |
|
25 | 25 |
#' @examples |
26 | 26 |
#' ei <- matrix(0:20,nrow = 7) |
27 | 27 |
#' eo <- TMM_FN(ei) |
28 |
-#' |
|
28 |
+#' |
|
29 | 29 |
TMM_FN = function(ei) { |
30 | 30 |
size_fac = calcNormFactors(ei, method = "TMM") |
31 | 31 |
scales = (colSums(ei) * size_fac) |
... | ... |
@@ -39,11 +39,11 @@ TMM_FN = function(ei) { |
39 | 39 |
#' @export |
40 | 40 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
41 | 41 |
#' @return RLE normalized matrix. |
42 |
-#' |
|
42 |
+#' |
|
43 | 43 |
#' @examples |
44 | 44 |
#' ei <- matrix(0:20,nrow = 7) |
45 | 45 |
#' eo <- DESEQ_FN(ei) |
46 |
-#' |
|
46 |
+#' |
|
47 | 47 |
DESEQ_FN = function(ei) { |
48 | 48 |
size_fac = calcNormFactors(ei, method = "RLE") |
49 | 49 |
scales = (colSums(ei) * size_fac) |
... | ... |
@@ -57,11 +57,11 @@ DESEQ_FN = function(ei) { |
57 | 57 |
#' @export |
58 | 58 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
59 | 59 |
#' @return UQ normalized matrix. |
60 |
-#' |
|
60 |
+#' |
|
61 | 61 |
#' @examples |
62 | 62 |
#' ei <- matrix(0:20,nrow = 7) |
63 | 63 |
#' eo <- UQ_FN(ei) |
64 |
-#' |
|
64 |
+#' |
|
65 | 65 |
UQ_FN = function(ei) { |
66 | 66 |
size_fac = calcNormFactors(ei, method = "upperquartile") |
67 | 67 |
scales = (colSums(ei) * size_fac) |
... | ... |
@@ -71,30 +71,30 @@ UQ_FN = function(ei) { |
71 | 71 |
|
72 | 72 |
#' Full-quantile normalization wrapper function |
73 | 73 |
#' @importFrom aroma.light normalizeQuantileRank.matrix |
74 |
-#' @details SCONE "scaling" wrapper for |
|
74 |
+#' @details SCONE "scaling" wrapper for |
|
75 | 75 |
#' \code{\link[aroma.light]{normalizeQuantileRank.matrix}}). |
76 | 76 |
#' @export |
77 | 77 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
78 | 78 |
#' @return Full-quantile normalized matrix. |
79 |
-#' |
|
79 |
+#' |
|
80 | 80 |
#' @examples |
81 | 81 |
#' ei <- matrix(0:20,nrow = 7) |
82 | 82 |
#' eo <- FQ_FN(ei) |
83 |
-#' |
|
83 |
+#' |
|
84 | 84 |
FQ_FN = function(ei) { |
85 | 85 |
eo = normalizeQuantileRank.matrix(ei) |
86 | 86 |
return(eo) |
87 | 87 |
} |
88 | 88 |
|
89 | 89 |
#' @rdname FQ_FN |
90 |
-#' @details Unlike FQ_FN, FQT_FN handles ties carefully (see |
|
90 |
+#' @details Unlike FQ_FN, FQT_FN handles ties carefully (see |
|
91 | 91 |
#' \code{\link[limma]{normalizeQuantiles}} for details). |
92 | 92 |
#' @export |
93 |
-#' |
|
93 |
+#' |
|
94 | 94 |
#' @examples |
95 | 95 |
#' ei <- matrix(0:20,nrow = 7) |
96 | 96 |
#' eo <- FQT_FN(ei) |
97 |
-#' |
|
97 |
+#' |
|
98 | 98 |
FQT_FN = function(ei) { |
99 | 99 |
eo = normalizeQuantileRank.matrix(ei, ties = TRUE) |
100 | 100 |
return(eo) |
... | ... |
@@ -103,16 +103,16 @@ FQT_FN = function(ei) { |
103 | 103 |
#' Centered log-ratio (CLR) normalization wrapper function |
104 | 104 |
#' @importFrom compositions clr |
105 | 105 |
#' @importFrom matrixStats colMedians |
106 |
-#' @details SCONE scaling wrapper for |
|
106 |
+#' @details SCONE scaling wrapper for |
|
107 | 107 |
#' \code{\link[compositions]{clr}}). |
108 | 108 |
#' @export |
109 | 109 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
110 | 110 |
#' @return CLR normalized matrix. |
111 |
-#' |
|
111 |
+#' |
|
112 | 112 |
#' @examples |
113 | 113 |
#' ei <- matrix(0:20,nrow = 7) |
114 | 114 |
#' eo <- CLR_FN(ei) |
115 |
-#' |
|
115 |
+#' |
|
116 | 116 |
CLR_FN = function (ei) |
117 | 117 |
{ |
118 | 118 |
scale_mat <- t(clr(t(ei))) - log(ei) |
... | ... |
@@ -123,18 +123,21 @@ CLR_FN = function (ei) |
123 | 123 |
} |
124 | 124 |
|
125 | 125 |
#' Simple deconvolution normalization wrapper |
126 |
-#' @importFrom scran computeSumFactors |
|
127 | 126 |
#' @details SCONE scaling wrapper for \code{\link[scran]{computeSumFactors}}). |
128 | 127 |
#' @export |
129 | 128 |
#' @param ei Numerical matrix. (rows = genes, cols = samples). |
130 | 129 |
#' @return scran normalized matrix. |
131 |
-#' |
|
130 |
+#' |
|
132 | 131 |
#' @examples |
133 | 132 |
#' ei <- matrix(0:76,nrow = 7) |
134 | 133 |
#' eo <- SCRAN_FN(ei) |
135 |
-#' |
|
134 |
+#' |
|
136 | 135 |
SCRAN_FN = function(ei){ |
137 |
- scales = computeSumFactors(ei, sizes = ceiling(sqrt(ncol(ei)))) |
|
136 |
+ if (!requireNamespace("scran", quietly = TRUE)) { |
|
137 |
+ stop("scran package needed for SCRAN_FN()") |
|
138 |
+ } |
|
139 |
+ |
|
140 |
+ scales = scran::computeSumFactors(ei, sizes = ceiling(sqrt(ncol(ei)))) |
|
138 | 141 |
eo = t(t(ei) * mean(scales) / scales) |
139 | 142 |
return(eo) |
140 |
-} |
|
141 | 143 |
\ No newline at end of file |
144 |
+} |
... | ... |
@@ -19,10 +19,10 @@ Full-quantile normalized matrix. |
19 | 19 |
Full-quantile normalization wrapper function |
20 | 20 |
} |
21 | 21 |
\details{ |
22 |
-SCONE "scaling" wrapper for |
|
22 |
+SCONE "scaling" wrapper for |
|
23 | 23 |
\code{\link[aroma.light]{normalizeQuantileRank.matrix}}). |
24 | 24 |
|
25 |
-Unlike FQ_FN, FQT_FN handles ties carefully (see |
|
25 |
+Unlike FQ_FN, FQT_FN handles ties carefully (see |
|
26 | 26 |
\code{\link[limma]{normalizeQuantiles}} for details). |
27 | 27 |
} |
28 | 28 |
\examples{ |