... | ... |
@@ -60,6 +60,7 @@ importFrom(grDevices,pdf) |
60 | 60 |
importFrom(graphics,abline) |
61 | 61 |
importFrom(graphics,arrows) |
62 | 62 |
importFrom(graphics,barplot) |
63 |
+importFrom(graphics,boxplot) |
|
63 | 64 |
importFrom(graphics,hist) |
64 | 65 |
importFrom(graphics,legend) |
65 | 66 |
importFrom(graphics,lines) |
... | ... |
@@ -91,6 +92,7 @@ importFrom(stats,dist) |
91 | 92 |
importFrom(stats,dnbinom) |
92 | 93 |
importFrom(stats,fitted.values) |
93 | 94 |
importFrom(stats,glm) |
95 |
+importFrom(stats,lm) |
|
94 | 96 |
importFrom(stats,mad) |
95 | 97 |
importFrom(stats,median) |
96 | 98 |
importFrom(stats,model.matrix) |
... | ... |
@@ -101,7 +103,10 @@ importFrom(stats,prcomp) |
101 | 103 |
importFrom(stats,quantile) |
102 | 104 |
importFrom(stats,quasibinomial) |
103 | 105 |
importFrom(stats,sd) |
106 |
+importFrom(stats,setNames) |
|
107 |
+importFrom(stats,var) |
|
104 | 108 |
importFrom(utils,capture.output) |
105 | 109 |
importFrom(utils,head) |
106 | 110 |
importFrom(utils,sessionInfo) |
111 |
+importFrom(utils,write.csv) |
|
107 | 112 |
importFrom(utils,write.table) |
... | ... |
@@ -33,7 +33,8 @@ TMM_FN = function(ei) { |
33 | 33 |
return(eo) |
34 | 34 |
} |
35 | 35 |
|
36 |
-#' Relative log-expression (RLE; DESeq) scaling normalization wrapper function |
|
36 |
+#' Relative log-expression (RLE; DESeq) scaling normalization wrapper |
|
37 |
+#' function |
|
37 | 38 |
#' @importFrom edgeR calcNormFactors |
38 | 39 |
#' @details SCONE scaling wrapper for \code{\link[edgeR]{calcNormFactors}}). |
39 | 40 |
#' @export |
... | ... |
@@ -24,6 +24,9 @@ |
24 | 24 |
#' |
25 | 25 |
#' @importFrom RColorBrewer brewer.pal |
26 | 26 |
#' @importFrom rARPACK svds |
27 |
+#' @importFrom graphics boxplot |
|
28 |
+#' @importFrom utils write.csv |
|
29 |
+#' @importFrom stats setNames var |
|
27 | 30 |
#' @export |
28 | 31 |
#' |
29 | 32 |
#' @return An object that represents the SCONE report app. |
... | ... |
@@ -66,15 +69,15 @@ sconeReport = function(x, methods, |
66 | 69 |
stop("reshape2 package needed for sconeReport()") |
67 | 70 |
} |
68 | 71 |
|
69 |
- if (!require("plotly", quietly = TRUE)) { |
|
72 |
+ if (!requireNamespace("plotly", quietly = TRUE)) { |
|
70 | 73 |
stop("plotly package needed for sconeReport()") |
71 | 74 |
} |
72 | 75 |
|
73 |
- if (!require("visNetwork", quietly = TRUE)) { |
|
76 |
+ if (!requireNamespace("visNetwork", quietly = TRUE)) { |
|
74 | 77 |
stop("visNetwork package needed for sconeReport()") |
75 | 78 |
} |
76 | 79 |
|
77 |
- if (!require("ggplot2", quietly = TRUE)) { |
|
80 |
+ if (!requireNamespace("ggplot2", quietly = TRUE)) { |
|
78 | 81 |
stop("ggplot2 package needed for sconeReport()") |
79 | 82 |
} |
80 | 83 |
|
... | ... |
@@ -223,18 +226,18 @@ sconeReport = function(x, methods, |
223 | 226 |
), |
224 | 227 |
shiny::tabPanel("PCA", |
225 | 228 |
shiny::br(), |
226 |
- shiny::p(paste0("This panel shows principal ", |
|
229 |
+ shiny::p(paste0("This panel shows principal ", |
|
227 | 230 |
"component analysis ", |
228 | 231 |
"(PCA) results", |
229 | 232 |
" on different subsets ", |
230 | 233 |
"of genes.")), |
231 | 234 |
shiny::br(), |
232 |
- shiny::h6("Variance Explained (All Genes)"), |
|
235 |
+ shiny::h6("Variance Explained (All Genes)"), |
|
233 | 236 |
shiny::p(paste0("Use this plot", |
234 | 237 |
" to decide on the ", |
235 | 238 |
"dimensionality of the reduced", |
236 | 239 |
" spaced used for evaluation.")), |
237 |
- shiny::plotOutput("plot_scree",width = "650px", |
|
240 |
+ shiny::plotOutput("plot_scree",width = "650px", |
|
238 | 241 |
height = "400px"), |
239 | 242 |
shiny::br(), |
240 | 243 |
shiny::h6("2D (All Genes)"), |
... | ... |
@@ -264,7 +267,7 @@ sconeReport = function(x, methods, |
264 | 267 |
), |
265 | 268 |
shiny::tabPanel("QC", |
266 | 269 |
shiny::br(), |
267 |
- shiny::p(paste0("This panel shows the absolute", |
|
270 |
+ shiny::p(paste0("This panel shows the absolute", |
|
268 | 271 |
" correlations between", |
269 | 272 |
" Principal", |
270 | 273 |
" Components (PCs) of", |
... | ... |
@@ -326,7 +329,7 @@ sconeReport = function(x, methods, |
326 | 329 |
), |
327 | 330 |
shiny::tabPanel("Control Genes", |
328 | 331 |
shiny::br(), |
329 |
- shiny::p(paste0("Heatmap of control genes, ", |
|
332 |
+ shiny::p(paste0("Heatmap of control genes, ", |
|
330 | 333 |
"colored by all", |
331 | 334 |
" three categories.")), |
332 | 335 |
shiny::br(), |
... | ... |
@@ -56,6 +56,7 @@ |
56 | 56 |
#' @importFrom cluster silhouette |
57 | 57 |
#' @importFrom rARPACK svds |
58 | 58 |
#' @importFrom matrixStats rowMedians colMedians colIQRs |
59 |
+#' @importFrom stats lm |
|
59 | 60 |
#' |
60 | 61 |
#' @export |
61 | 62 |
#' |
... | ... |
@@ -269,7 +270,8 @@ score_matrix <- function(expr, |
269 | 270 |
# Max cor with quality factors. |
270 | 271 |
if (!is.null(qc_factors)) { |
271 | 272 |
EXP_QC_COR <- |
272 |
- EXP_QC_COR + cond_w * (1 - sum(unlist(apply(proj[is_cond,], 2, function(y) { |
|
273 |
+ EXP_QC_COR + cond_w * (1 - sum(unlist(apply(proj[is_cond,], 2, |
|
274 |
+ function(y) { |
|
273 | 275 |
lm(y ~ qc_factors[is_cond,])$residual |
274 | 276 |
})) ^ 2) / sum(scale(proj[is_cond,], scale = FALSE) ^ 2)) |
275 | 277 |
} |
... | ... |
@@ -277,7 +279,8 @@ score_matrix <- function(expr, |
277 | 279 |
# Max cor with UV factors. |
278 | 280 |
if (!is.null(uv_factors)) { |
279 | 281 |
EXP_UV_COR <- |
280 |
- EXP_UV_COR + cond_w * (1 - sum(unlist(apply(proj[is_cond,], 2, function(y) { |
|
282 |
+ EXP_UV_COR + cond_w * (1 - sum(unlist(apply(proj[is_cond,], 2, |
|
283 |
+ function(y) { |
|
281 | 284 |
lm(y ~ uv_factors[is_cond,])$residual |
282 | 285 |
})) ^ 2) / sum(scale(proj[is_cond,], scale = FALSE) ^ 2)) |
283 | 286 |
} |
... | ... |
@@ -285,7 +288,8 @@ score_matrix <- function(expr, |
285 | 288 |
# Max cor with WV factors. |
286 | 289 |
if (!is.null(wv_factors)) { |
287 | 290 |
EXP_WV_COR <- |
288 |
- EXP_WV_COR + cond_w * (1 - sum(unlist(apply(proj[is_cond,], 2, function(y) { |
|
291 |
+ EXP_WV_COR + cond_w * (1 - sum(unlist(apply(proj[is_cond,], 2, |
|
292 |
+ function(y) { |
|
289 | 293 |
lm(y ~ wv_factors[is_cond,])$residual |
290 | 294 |
})) ^ 2) / sum(scale(proj[is_cond,], scale = FALSE) ^ 2)) |
291 | 295 |
} |
... | ... |
@@ -296,8 +296,8 @@ impute_null <- function(expression,impute_args) { |
296 | 296 |
#' \item{p_nodrop}{ 1 - the probability P(drop|Y), useful as weights in |
297 | 297 |
#' weighted PCA} \item{expected_state}{ the expected |
298 | 298 |
#' value E[Z] (1 = "on")} \item{loglik}{ the log-likelihood} |
299 |
-#' \item{convergence}{for all genes, 0 if the algorithm converged and 1 if maxiter was |
|
300 |
-#' reached} } |
|
299 |
+#' \item{convergence}{for all genes, 0 if the algorithm converged and |
|
300 |
+#' 1 if maxiter was reached} } |
|
301 | 301 |
#' |
302 | 302 |
#' @examples |
303 | 303 |
#' mat <- matrix(rpois(1000, lambda = 3), ncol=10) |
... | ... |
@@ -1,3 +1,10 @@ |
1 |
+Changes in version 1.1.3 (2018-10-19) |
|
2 |
+======================== |
|
3 |
+ |
|
4 |
+* Modified COR scores to reflect R^2 for regression on UV/WV/QC rather than max correlation. |
|
5 |
+* Bug fix for shiny report. |
|
6 |
+* Updated vignette. |
|
7 |
+ |
|
1 | 8 |
Changes in version 1.1.2 (2017-7-3) |
2 | 9 |
======================== |
3 | 10 |
|
... | ... |
@@ -2,7 +2,8 @@ |
2 | 2 |
% Please edit documentation in R/SCONE_DEFAULTS.R |
3 | 3 |
\name{DESEQ_FN} |
4 | 4 |
\alias{DESEQ_FN} |
5 |
-\title{Relative log-expression (RLE; DESeq) scaling normalization wrapper function} |
|
5 |
+\title{Relative log-expression (RLE; DESeq) scaling normalization wrapper |
|
6 |
+function} |
|
6 | 7 |
\usage{ |
7 | 8 |
DESEQ_FN(ei) |
8 | 9 |
} |
... | ... |
@@ -13,7 +14,8 @@ DESEQ_FN(ei) |
13 | 14 |
RLE normalized matrix. |
14 | 15 |
} |
15 | 16 |
\description{ |
16 |
-Relative log-expression (RLE; DESeq) scaling normalization wrapper function |
|
17 |
+Relative log-expression (RLE; DESeq) scaling normalization wrapper |
|
18 |
+function |
|
17 | 19 |
} |
18 | 20 |
\details{ |
19 | 21 |
SCONE scaling wrapper for \code{\link[edgeR]{calcNormFactors}}). |
... | ... |
@@ -40,8 +40,8 @@ a list with the following elements: \itemize{ \item{W}{ coefficients |
40 | 40 |
\item{p_nodrop}{ 1 - the probability P(drop|Y), useful as weights in |
41 | 41 |
weighted PCA} \item{expected_state}{ the expected |
42 | 42 |
value E[Z] (1 = "on")} \item{loglik}{ the log-likelihood} |
43 |
- \item{convergence}{for all genes, 0 if the algorithm converged and 1 if maxiter was |
|
44 |
- reached} } |
|
43 |
+ \item{convergence}{for all genes, 0 if the algorithm converged and |
|
44 |
+ 1 if maxiter was reached} } |
|
45 | 45 |
} |
46 | 46 |
\description{ |
47 | 47 |
This function implements Newton's method for solving zero of |