... | ... |
@@ -215,9 +215,9 @@ |
215 | 215 |
} |
216 | 216 |
|
217 | 217 |
#' Combine a list of SingleCellExperiment objects as one SingleCellExperiment object |
218 |
-#' @param sceList A list contains \link[SingleCellExperiment]{SingleCellExperiment} objects. |
|
219 |
-#' Currently, combineSCE function only support combining SCE objects with assay in dgCMatrix format. |
|
220 |
-#' It does not support combining SCE with assay in delayedArray format. |
|
218 |
+#' @param sceList A list contains \link[SingleCellExperiment]{SingleCellExperiment} objects. |
|
219 |
+#' Currently, combineSCE function only support combining SCE objects with assay in dgCMatrix format. |
|
220 |
+#' It does not support combining SCE with assay in delayedArray format. |
|
221 | 221 |
#' @param by.r Specifications of the columns used for merging rowData. See 'Details'. |
222 | 222 |
#' @param by.c Specifications of the columns used for merging colData. See 'Details'. |
223 | 223 |
#' @param combined logical; if TRUE, it will combine the list of SingleCellExperiment objects. See 'Details'. |
... | ... |
@@ -228,6 +228,9 @@ |
228 | 228 |
#' @export |
229 | 229 |
|
230 | 230 |
combineSCE <- function(sceList, by.r, by.c, combined){ |
231 |
+ if(length(sceList) == 1){ |
|
232 |
+ return(sceList[[1]]) |
|
233 |
+ } |
|
231 | 234 |
## rowData |
232 | 235 |
newFeList <- .mergeRowDataSCE(sceList, by.r) |
233 | 236 |
## colData |
... | ... |
@@ -6,8 +6,8 @@ |
6 | 6 |
#' @param useAssay character. A string specifying which assay to use for the |
7 | 7 |
#' MAST calculations. Default \code{"logcounts"}. |
8 | 8 |
#' @param method A single character for specific differential expression |
9 |
-#' analysis method. Choose from \code{'MAST'}, \code{'DESeq2'}, \code{'Limma'}, |
|
10 |
-#' and \code{'wilcox'}. Default \code{"wilcox"}. |
|
9 |
+#' analysis method. Choose from \code{'wilcox'}, \code{'MAST'}, \code{'DESeq2'}, |
|
10 |
+#' \code{'Limma'}, and \code{'ANOVA'}. Default \code{"wilcox"}. |
|
11 | 11 |
#' @param cluster One single character to specify a column in |
12 | 12 |
#' \code{colData(inSCE)} for the clustering label. Alternatively, a vector or |
13 | 13 |
#' a factor is also acceptable. Default \code{"cluster"}. |
... | ... |
@@ -33,7 +33,8 @@ |
33 | 33 |
#' @export |
34 | 34 |
#' @author Yichen Wang |
35 | 35 |
findMarkerDiffExp <- function(inSCE, useAssay = 'logcounts', |
36 |
- method = c('wilcox', 'MAST', "DESeq2", "Limma"), |
|
36 |
+ method = c('wilcox', 'MAST', "DESeq2", "Limma", |
|
37 |
+ "ANOVA"), |
|
37 | 38 |
cluster = 'cluster', covariates = NULL, |
38 | 39 |
log2fcThreshold = 0.25, fdrThreshold = 0.05, |
39 | 40 |
minClustExprPerc = 0.6, maxCtrlExprPerc = 0.4, |
... | ... |
@@ -24,7 +24,7 @@ importMultipleSources <- function(allImportEntries, delayedArray = FALSE) { |
24 | 24 |
delayedArray = delayedArray |
25 | 25 |
) |
26 | 26 |
} |
27 |
- |
|
27 |
+ |
|
28 | 28 |
} else if (entry$type == "cellRanger3") { |
29 | 29 |
if (is.null(entry$params$cellRangerDirs)) { |
30 | 30 |
newSce <- importCellRangerV3Sample( |
... | ... |
@@ -93,11 +93,10 @@ importMultipleSources <- function(allImportEntries, delayedArray = FALSE) { |
93 | 93 |
SummarizedExperiment::assay(newSce, assay) <- DelayedArray::DelayedArray(SummarizedExperiment::assay(newSce, assay)) |
94 | 94 |
} |
95 | 95 |
} |
96 |
- |
|
96 |
+ |
|
97 | 97 |
} |
98 | 98 |
sceObjs = c(sceObjs, list(newSce)) |
99 | 99 |
} |
100 |
- |
|
101 | 100 |
return(combineSCE(sceList = sceObjs, |
102 | 101 |
by.r = Reduce(base::intersect, lapply(sceObjs, function(x) { colnames(rowData(x))})), |
103 | 102 |
by.c = Reduce(base::intersect, lapply(sceObjs, function(x) { colnames(colData(x))})), |
... | ... |
@@ -201,7 +201,7 @@ shinyServer(function(input, output, session) { |
201 | 201 |
} |
202 | 202 |
} |
203 | 203 |
} |
204 |
- |
|
204 |
+ |
|
205 | 205 |
output[[inputId]] <- renderUI({ |
206 | 206 |
selectInput( |
207 | 207 |
inputId = inputId, |
... | ... |
@@ -221,11 +221,23 @@ shinyServer(function(input, output, session) { |
221 | 221 |
updateSelectInputTag(session, "clustScranSNNMat", label = "Select Input Matrix:", |
222 | 222 |
choices = expDataNames(vals$counts), |
223 | 223 |
recommended = "redDims", redDims = TRUE) |
224 |
- updateSelectInputTag(session, "deAssay", recommended = c("normalized", "scaled")) |
|
225 |
- updateSelectInputTag(session, "fmAssay", recommended = c("normalized", "scaled")) |
|
224 |
+ if (is.null(input$deMethod)) { |
|
225 |
+ updateSelectInputTag(session, "deAssay", recommended = c("normalized")) |
|
226 |
+ } else if (input$deMethod == "DESeq2") { |
|
227 |
+ updateSelectInputTag(session, "deAssay", recommended = c("raw")) |
|
228 |
+ } else { |
|
229 |
+ updateSelectInputTag(session, "deAssay", recommended = c("normalized")) |
|
230 |
+ } |
|
231 |
+ if (is.null(input$fmMethod)) { |
|
232 |
+ updateSelectInputTag(session, "fmAssay", recommended = c("normalized")) |
|
233 |
+ } else if (input$fmMethod == "DESeq2") { |
|
234 |
+ updateSelectInputTag(session, "fmAssay", recommended = c("raw")) |
|
235 |
+ } else { |
|
236 |
+ updateSelectInputTag(session, "fmAssay", recommended = c("normalized")) |
|
237 |
+ } |
|
226 | 238 |
updateSelectInputTag(session, "fmHMAssay", choices = currassays, selected = input$fmAssay) |
227 | 239 |
updateSelectInputTag(session, "pathwayAssay", recommended = c("normalized", "scaled")) |
228 |
- |
|
240 |
+ |
|
229 | 241 |
#modifyAssaySelect conditions |
230 | 242 |
if(input$assayModifyAction == "log" || input$assayModifyAction == "log1p"){ |
231 | 243 |
updateSelectInputTag(session, "modifyAssaySelect", recommended = c("raw", "normalized")) |
... | ... |
@@ -233,9 +245,9 @@ shinyServer(function(input, output, session) { |
233 | 245 |
else if(input$assayModifyAction == "z.score"){ |
234 | 246 |
updateSelectInputTag(session, "modifyAssaySelect", recommended = "normalized") |
235 | 247 |
} |
236 |
- |
|
248 |
+ |
|
237 | 249 |
updateSelectInputTag(session, "normalizeAssaySelect", label = "Select assay to normalize:", recommended = "raw") |
238 |
- |
|
250 |
+ |
|
239 | 251 |
updateSelectInputTag(session, "seuratSelectNormalizationAssay", choices = currassays, showTags = FALSE) |
240 | 252 |
updateSelectInputTag(session, "assaySelectFS_Norm", recommended = c("normalized", "scaled")) |
241 | 253 |
updateSelectInputTag(session, "filterAssaySelect", choices = currassays) |
... | ... |
@@ -272,7 +284,7 @@ shinyServer(function(input, output, session) { |
272 | 284 |
choices = assayNames(vals$counts), |
273 | 285 |
recommended = bc.recommended) |
274 | 286 |
} |
275 |
- |
|
287 |
+ |
|
276 | 288 |
|
277 | 289 |
observeEvent(vals$counts, { |
278 | 290 |
# vals$counts |
... | ... |
@@ -843,7 +855,6 @@ shinyServer(function(input, output, session) { |
843 | 855 |
} else { |
844 | 856 |
vals$original <- sceObj |
845 | 857 |
} |
846 |
- |
|
847 | 858 |
# clear table and empty reactive |
848 | 859 |
for (entry in allImportEntries$samples) { |
849 | 860 |
removeUI(selector = paste0("#", entry$id)) |
... | ... |
@@ -851,20 +862,21 @@ shinyServer(function(input, output, session) { |
851 | 862 |
allImportEntries$samples <- list() |
852 | 863 |
|
853 | 864 |
# Add sample variable if it was not included |
854 |
- if(is.null(colData(vals$original)$sample)) { |
|
865 |
+ if (!"sample" %in% names(colData(vals$original)) && |
|
866 |
+ !"Sample" %in% names(colData(vals$original))) { |
|
855 | 867 |
colData(vals$original)$sample = "sample" |
856 | 868 |
} |
857 | 869 |
|
858 | 870 |
if (!is.null(vals$original)) { |
859 | 871 |
vals$counts <- vals$original |
860 |
- |
|
861 | 872 |
#store assayType information in the metadata |
862 |
- vals$counts <- expSetDataTag( |
|
863 |
- inSCE = vals$counts, |
|
864 |
- assayType = "raw", |
|
865 |
- assays = assayNames(vals$counts), |
|
866 |
- append = FALSE) |
|
867 |
- |
|
873 |
+ if (!"assayType" %in% names(metadata(vals$counts))) { |
|
874 |
+ vals$counts <- expSetDataTag( |
|
875 |
+ inSCE = vals$counts, |
|
876 |
+ assayType = "raw", |
|
877 |
+ assays = assayNames(vals$counts), |
|
878 |
+ append = FALSE) |
|
879 |
+ } |
|
868 | 880 |
# ToDo: Remove these automatic updates and replace with |
869 | 881 |
# observeEvents functions that activate upon the tab selection |
870 | 882 |
updateColDataNames() |
... | ... |
@@ -1263,11 +1275,11 @@ shinyServer(function(input, output, session) { |
1263 | 1275 |
collectionName = qcCollName, |
1264 | 1276 |
useAssay = input$qcAssaySelect, |
1265 | 1277 |
paramsList = paramsList) |
1266 |
- vals$counts <- expSetDataTag( |
|
1267 |
- inSCE = vals$counts, |
|
1268 |
- assayType = "raw", |
|
1269 |
- assays = assayNames(vals$counts), |
|
1270 |
- append = FALSE) |
|
1278 |
+ #vals$counts <- expSetDataTag( |
|
1279 |
+ # inSCE = vals$counts, |
|
1280 |
+ # assayType = "raw", |
|
1281 |
+ # assays = assayNames(vals$counts), |
|
1282 |
+ # append = FALSE) |
|
1271 | 1283 |
# redDimList <- strsplit(reducedDimNames(vals$counts), " ") |
1272 | 1284 |
# run getUMAP |
1273 | 1285 |
message(paste0(date(), " ... Running 'UMAP'")) |
... | ... |
@@ -3005,7 +3017,8 @@ shinyServer(function(input, output, session) { |
3005 | 3017 |
nStart = input$clustKMeansNStart, |
3006 | 3018 |
algorithm = algo, |
3007 | 3019 |
clusterName = saveClusterName) |
3008 |
- updateSelectInput(session, "clustVisReddim", input$clustKMeansReddim) |
|
3020 |
+ updateSelectInput(session, "clustVisReddim", |
|
3021 |
+ selected = input$clustKMeansReddim) |
|
3009 | 3022 |
} else if (input$clustAlgo %in% seq(10, 12)) { |
3010 | 3023 |
# Seurat |
3011 | 3024 |
if(input$clustSeuratReddim == ""){ |
... | ... |
@@ -3045,7 +3058,8 @@ shinyServer(function(input, output, session) { |
3045 | 3058 |
algorithm = algo, |
3046 | 3059 |
groupSingletons = input$clustSeuratGrpSgltn, |
3047 | 3060 |
resolution = input$clustSeuratRes) |
3048 |
- updateSelectInput(session, "clustVisReddim", input$clustSeuratReddim) |
|
3061 |
+ updateSelectInput(session, "clustVisReddim", |
|
3062 |
+ selected = input$clustSeuratReddim) |
|
3049 | 3063 |
} |
3050 | 3064 |
updateColDataNames() |
3051 | 3065 |
clustResults$names <- c(clustResults$names, saveClusterName) |
... | ... |
@@ -3652,7 +3666,7 @@ shinyServer(function(input, output, session) { |
3652 | 3666 |
}else if(input$TypeSelect_Colorby == "Expression Assays"){ |
3653 | 3667 |
a <- plotSCEDimReduceFeatures(vals$counts, feature = input$GeneSelect_Assays_Colorby, |
3654 | 3668 |
reducedDimName = input$QuickAccess, useAssay = input$AdvancedMethodSelect_Colorby, |
3655 |
- xlab = xname, ylab = yname, legendTitle = legendname, title = input$adjustitle, |
|
3669 |
+ xlab = xname, ylab = yname, legendTitle = legendname, title = input$adjusttitle, |
|
3656 | 3670 |
groupBy = pltVars$groupby, bin = pltVars$bin, transparency = input$adjustalpha, |
3657 | 3671 |
colorLow = input$lowColor, colorMid = input$midColor, colorHigh = input$highColor, |
3658 | 3672 |
dotSize = input$adjustsize, combinePlot = "none", axisSize = input$adjustaxissize, |
... | ... |
@@ -5080,51 +5094,64 @@ shinyServer(function(input, output, session) { |
5080 | 5094 |
#----------------------------------------------------------------------------- |
5081 | 5095 |
# Page 5.1: Differential Expression #### |
5082 | 5096 |
#----------------------------------------------------------------------------- |
5083 |
- ## DE - Thresholding Vis #### |
|
5097 |
+ observeEvent(input$deMethod, { |
|
5098 |
+ if (!is.null(vals$counts)) { |
|
5099 |
+ if (is.null(input$deMethod)) { |
|
5100 |
+ updateSelectInputTag(session, "deAssay", recommended = c("normalized")) |
|
5101 |
+ } else if (input$deMethod == "DESeq2") { |
|
5102 |
+ updateSelectInputTag(session, "deAssay", recommended = c("raw")) |
|
5103 |
+ } else { |
|
5104 |
+ updateSelectInputTag(session, "deAssay", recommended = c("normalized")) |
|
5105 |
+ } |
|
5106 |
+ } |
|
5107 |
+ }) |
|
5084 | 5108 |
|
5109 |
+ ## DE - Thresholding Vis #### |
|
5085 | 5110 |
observeEvent(input$deViewThresh, { |
5086 | 5111 |
if (!is.null(vals$counts) && |
5087 | 5112 |
!is.null(input$deAssay)) { |
5088 | 5113 |
shinyjs::showElement(id= "deThreshpanel") |
5089 |
- } |
|
5090 |
- }) |
|
5091 |
- |
|
5092 |
- # Threshold adapting plot |
|
5093 |
- observeEvent(input$deAssay, { |
|
5094 |
- if(!is.null(vals$counts)){ |
|
5095 |
- # MAST style sanity check for whether logged or not |
|
5096 |
- x <- expData(vals$counts, input$deAssay) |
|
5097 |
- if (!all(floor(x) == x, na.rm = TRUE) & max(x, na.rm = TRUE) < |
|
5098 |
- 100) { |
|
5099 |
- output$deSanityWarnThresh <- renderText("") |
|
5100 |
- isLogged <- TRUE |
|
5101 |
- } else { |
|
5102 |
- output$deSanityWarnThresh <- renderText("Selected assay seems not logged (MAST style sanity check). Forcing to plot by automatically applying log-transformation. ") |
|
5103 |
- isLogged <- FALSE |
|
5104 |
- } |
|
5105 |
- thres.grob <- plotMASTThresholdGenes(inSCE = vals$counts, |
|
5106 |
- useAssay = input$deAssay, |
|
5107 |
- check_sanity = FALSE, |
|
5108 |
- isLogged = isLogged, |
|
5109 |
- doPlot = FALSE) |
|
5110 |
- nSub <- tail(strsplit(thres.grob$childrenOrder, split = '-'), |
|
5111 |
- n = 1)[[1]][3] |
|
5112 |
- plotHeight <- ceiling(as.numeric(nSub) / 4) * 240 |
|
5113 |
- |
|
5114 |
- output$deThreshPlotDiv <- renderUI({ |
|
5115 |
- div( |
|
5116 |
- style = paste0("height: ", plotHeight, "px;"), |
|
5117 |
- plotOutput("deThreshplot")) |
|
5114 |
+ withProgress(message = "Plotting thresholding...", max = 1, value = 1, { |
|
5115 |
+ withBusyIndicatorServer("deViewThresh", { |
|
5116 |
+ # MAST style sanity check for whether logged or not |
|
5117 |
+ x <- expData(vals$counts, input$deAssay) |
|
5118 |
+ if (!all(floor(x) == x, na.rm = TRUE) & max(x, na.rm = TRUE) < |
|
5119 |
+ 100) { |
|
5120 |
+ output$deSanityWarnThresh <- renderText("") |
|
5121 |
+ isLogged <- TRUE |
|
5122 |
+ } else { |
|
5123 |
+ output$deSanityWarnThresh <- renderText("Selected assay seems not logged (MAST style sanity check). Forcing to plot by automatically applying log-transformation. ") |
|
5124 |
+ isLogged <- FALSE |
|
5125 |
+ } |
|
5126 |
+ suppressMessages({ |
|
5127 |
+ thres.grob <- plotMASTThresholdGenes(inSCE = vals$counts, |
|
5128 |
+ useAssay = input$deAssay, |
|
5129 |
+ check_sanity = FALSE, |
|
5130 |
+ isLogged = isLogged, |
|
5131 |
+ doPlot = FALSE) |
|
5132 |
+ }) |
|
5133 |
+ nSub <- tail(strsplit(thres.grob$childrenOrder, split = '-'), |
|
5134 |
+ n = 1)[[1]][3] |
|
5135 |
+ plotHeight <- ceiling(as.numeric(nSub) / 4) * 240 |
|
5136 |
+ |
|
5137 |
+ output$deThreshPlotDiv <- renderUI({ |
|
5138 |
+ div( |
|
5139 |
+ style = paste0("height: ", plotHeight, "px;"), |
|
5140 |
+ plotOutput("deThreshplot")) |
|
5141 |
+ }) |
|
5142 |
+ output$deThreshplot <- renderPlot({ |
|
5143 |
+ grid.draw(thres.grob) |
|
5144 |
+ }, height = plotHeight) |
|
5145 |
+ updateActionButton(session, "deViewThresh", "Refresh") |
|
5146 |
+ }) |
|
5118 | 5147 |
}) |
5119 |
- output$deThreshplot <- renderPlot({ |
|
5120 |
- grid.draw(thres.grob) |
|
5121 |
- }, height = plotHeight) |
|
5122 | 5148 |
} |
5123 | 5149 |
|
5124 | 5150 |
}) |
5125 | 5151 |
|
5126 | 5152 |
observeEvent(input$deHideThresh, { |
5127 | 5153 |
shinyjs::hideElement(id= "deThreshpanel") |
5154 |
+ updateActionButton(session, "deViewThresh", "View Thresholding") |
|
5128 | 5155 |
}) |
5129 | 5156 |
|
5130 | 5157 |
## DE - condition determination method1 #### |
... | ... |
@@ -5443,7 +5470,8 @@ shinyServer(function(input, output, session) { |
5443 | 5470 |
|
5444 | 5471 |
# Data table |
5445 | 5472 |
output$deResult <- DT::renderDataTable({ |
5446 |
- if(!is.null(input$deResSel)){ |
|
5473 |
+ if(!is.null(input$deResSel) && |
|
5474 |
+ !is.null(vals$counts)){ |
|
5447 | 5475 |
metadata(vals$counts)$diffExp[[input$deResSel]]$result |
5448 | 5476 |
} |
5449 | 5477 |
}, filter = 'top') |
... | ... |
@@ -5476,7 +5504,8 @@ shinyServer(function(input, output, session) { |
5476 | 5504 |
|
5477 | 5505 |
observeEvent(input$dePlotVio, { |
5478 | 5506 |
if(!is.null(input$deResSel) && |
5479 |
- !input$deResSel == ""){ |
|
5507 |
+ !input$deResSel == "" && |
|
5508 |
+ !is.null(vals$counts)){ |
|
5480 | 5509 |
sce <- vals$counts |
5481 | 5510 |
useResult <- input$deResSel |
5482 | 5511 |
nrow <- input$deVioNRow |
... | ... |
@@ -5514,7 +5543,8 @@ shinyServer(function(input, output, session) { |
5514 | 5543 |
|
5515 | 5544 |
observeEvent(input$dePlotReg, { |
5516 | 5545 |
if(!is.null(input$deResSel) && |
5517 |
- !input$deResSel == ""){ |
|
5546 |
+ !input$deResSel == "" && |
|
5547 |
+ !is.null(vals$counts)){ |
|
5518 | 5548 |
sce <- vals$counts |
5519 | 5549 |
useResult <- input$deResSel |
5520 | 5550 |
nrow <- input$deRegNRow |
... | ... |
@@ -5584,6 +5614,17 @@ shinyServer(function(input, output, session) { |
5584 | 5614 |
#----------------------------------------------------------------------------- |
5585 | 5615 |
# Page 5.2: Find Marker #### |
5586 | 5616 |
#----------------------------------------------------------------------------- |
5617 |
+ observeEvent(input$fmMethod, { |
|
5618 |
+ if (!is.null(vals$counts)) { |
|
5619 |
+ if (is.null(input$fmMethod)) { |
|
5620 |
+ updateSelectInputTag(session, "fmAssay", recommended = c("normalized")) |
|
5621 |
+ } else if (input$fmMethod == "DESeq2") { |
|
5622 |
+ updateSelectInputTag(session, "fmAssay", recommended = c("raw")) |
|
5623 |
+ } else { |
|
5624 |
+ updateSelectInputTag(session, "fmAssay", recommended = c("normalized")) |
|
5625 |
+ } |
|
5626 |
+ } |
|
5627 |
+ }) |
|
5587 | 5628 |
# findMarker RUN #### |
5588 | 5629 |
observeEvent(input$runFM, { |
5589 | 5630 |
if (is.null(vals$counts)){ |
... | ... |
@@ -5604,6 +5645,7 @@ shinyServer(function(input, output, session) { |
5604 | 5645 |
fdrThreshold = input$fmFDR) |
5605 | 5646 |
shinyalert::shinyalert("Success", "Find Marker completed.", |
5606 | 5647 |
"success") |
5648 |
+ updateFMPlot() |
|
5607 | 5649 |
}) |
5608 | 5650 |
} |
5609 | 5651 |
}) |
... | ... |
@@ -5615,7 +5657,7 @@ shinyServer(function(input, output, session) { |
5615 | 5657 |
fullTable[,5] <- as.factor(fullTable[,5]) |
5616 | 5658 |
fullTable |
5617 | 5659 |
} |
5618 |
- }, filter = "top") |
|
5660 |
+ }, filter = "top", options = list(scrollX = TRUE)) |
|
5619 | 5661 |
|
5620 | 5662 |
observe({ |
5621 | 5663 |
if (!is.null(vals$counts) && |
... | ... |
@@ -5646,51 +5688,53 @@ shinyServer(function(input, output, session) { |
5646 | 5688 |
} |
5647 | 5689 |
}) |
5648 | 5690 |
|
5649 |
- # output$fmHMAssayUI <- renderUI({ |
|
5650 |
- # if(!is.null(vals$counts)){ |
|
5651 |
- # allAssay <- assayNames(vals$counts) |
|
5652 |
- # selectInput('fmHMAssay', "Assay to plot", allAssay, |
|
5653 |
- # selected = input$fmAssay) |
|
5654 |
- # } |
|
5655 |
- # }) |
|
5656 |
- |
|
5657 | 5691 |
observeEvent(input$plotFM, { |
5692 |
+ updateFMPlot() |
|
5693 |
+ }) |
|
5694 |
+ |
|
5695 |
+ updateFMPlot <- function() { |
|
5658 | 5696 |
if(!is.null(vals$counts) && |
5659 | 5697 |
'findMarker' %in% names(metadata(vals$counts))){ |
5660 | 5698 |
withBusyIndicatorServer("plotFM", { |
5661 |
- if(isTRUE(input$fmUseTopN) |
|
5662 |
- && is.na(input$fmTopN)){ |
|
5663 |
- stop("Top N marker must be a numeric non-empty value") |
|
5664 |
- } |
|
5665 |
- if(is.na(input$fmHMFC)){ |
|
5666 |
- stop("Log2FC must be a numeric non-empty value!") |
|
5667 |
- } |
|
5668 |
- if(is.na(input$fmHMFDR)){ |
|
5669 |
- stop("FDR must be a numeric non-empty value!") |
|
5670 |
- } |
|
5671 |
- inSCE <- vals$counts |
|
5672 |
- orderBy <- input$fmHMOrder |
|
5673 |
- log2fcThreshold <- input$fmHMFC |
|
5674 |
- fdrThreshold <- input$fmHMFDR |
|
5675 |
- decreasing <- input$fmHMdec |
|
5676 |
- rowDataName <- input$fmHMrowData |
|
5677 |
- colDataName <- input$fmHMcolData |
|
5678 |
- if(!isTRUE(input$fmUseTopN)) { |
|
5679 |
- topN <- NULL |
|
5680 |
- } else { |
|
5681 |
- topN <- input$fmTopN |
|
5682 |
- } |
|
5683 |
- # Take value before rendering plot, so that the plot doesnt auto re-render |
|
5684 |
- # while we tweak the parameter |
|
5685 |
- output$fmHeatmap <- renderPlot({ |
|
5686 |
- plotMarkerDiffExp(inSCE = inSCE, orderBy = orderBy, |
|
5687 |
- log2fcThreshold = log2fcThreshold, topN = topN, |
|
5688 |
- fdrThreshold = fdrThreshold, decreasing = decreasing, |
|
5689 |
- rowDataName = rowDataName, colDataName = colDataName) |
|
5690 |
- }) |
|
5699 |
+ withProgress(message = "Updating marker heatmap...", max = 1, value = 1, { |
|
5700 |
+ if(isTRUE(input$fmUseTopN) |
|
5701 |
+ && is.na(input$fmTopN)){ |
|
5702 |
+ stop("Top N marker must be a numeric non-empty value") |
|
5703 |
+ } |
|
5704 |
+ if(is.na(input$fmHMFC)){ |
|
5705 |
+ stop("Log2FC must be a numeric non-empty value!") |
|
5706 |
+ } |
|
5707 |
+ if(is.na(input$fmHMFDR)){ |
|
5708 |
+ stop("FDR must be a numeric non-empty value!") |
|
5709 |
+ } |
|
5710 |
+ inSCE <- vals$counts |
|
5711 |
+ orderBy <- input$fmHMOrder |
|
5712 |
+ log2fcThreshold <- input$fmHMFC |
|
5713 |
+ fdrThreshold <- input$fmHMFDR |
|
5714 |
+ decreasing <- input$fmHMdec |
|
5715 |
+ rowDataName <- input$fmHMrowData |
|
5716 |
+ colDataName <- input$fmHMcolData |
|
5717 |
+ if(!isTRUE(input$fmUseTopN)) { |
|
5718 |
+ topN <- NULL |
|
5719 |
+ } else { |
|
5720 |
+ topN <- input$fmTopN |
|
5721 |
+ } |
|
5722 |
+ # Take value before rendering plot, so that the plot doesn't auto |
|
5723 |
+ # re-render while we tweak the parameter |
|
5724 |
+ output$fmHeatmap <- renderPlot({ |
|
5725 |
+ plotMarkerDiffExp(inSCE = inSCE, |
|
5726 |
+ orderBy = orderBy, |
|
5727 |
+ log2fcThreshold = log2fcThreshold, |
|
5728 |
+ topN = topN, |
|
5729 |
+ fdrThreshold = fdrThreshold, |
|
5730 |
+ decreasing = decreasing, |
|
5731 |
+ rowDataName = rowDataName, |
|
5732 |
+ colDataName = colDataName) |
|
5733 |
+ }) |
|
5734 |
+ }) |
|
5691 | 5735 |
}) |
5692 | 5736 |
} |
5693 |
- }) |
|
5737 |
+ } |
|
5694 | 5738 |
|
5695 | 5739 |
#----------------------------------------------------------------------------- |
5696 | 5740 |
# Page 6: Pathway Activity Analysis |
... | ... |
@@ -7820,8 +7864,9 @@ shinyServer(function(input, output, session) { |
7820 | 7864 |
} |
7821 | 7865 |
|
7822 | 7866 |
if (input$exportChoice == "rds") { |
7823 |
- filename = paste("SCE-", Sys.Date(), ".rds", sep = "") |
|
7824 |
- saveRDS(vals$counts, paste(exportPath, "/", filename, sep = "")) |
|
7867 |
+ filename = paste0("SCE_", strftime(Sys.time(), format = "%y%m%d_%H%m"), |
|
7868 |
+ ".rds") |
|
7869 |
+ saveRDS(vals$counts, paste0(exportPath, "/", filename)) |
|
7825 | 7870 |
} else if (input$exportChoice == "annData") { |
7826 | 7871 |
exportassay <- input$exportAssay |
7827 | 7872 |
compression <- input$compression |
... | ... |
@@ -7831,7 +7876,9 @@ shinyServer(function(input, output, session) { |
7831 | 7876 |
exportSCEtoAnnData(sce=vals$counts, |
7832 | 7877 |
useAssay = exportassay, |
7833 | 7878 |
outputDir=exportPath, |
7834 |
- prefix = paste("SCE-", Sys.Date(),sep = ""), |
|
7879 |
+ prefix = paste0("SCE-", |
|
7880 |
+ strftime(Sys.time(), |
|
7881 |
+ format = "%y%m%d_%H%m")), |
|
7835 | 7882 |
overwrite=overwrite, |
7836 | 7883 |
compression = compression, |
7837 | 7884 |
compressionOpts = compressionOpts, |
... | ... |
@@ -7843,7 +7890,9 @@ shinyServer(function(input, output, session) { |
7843 | 7890 |
outputDir=exportPath, |
7844 | 7891 |
overwrite=overwrite, |
7845 | 7892 |
gzipped=gzipped, |
7846 |
- sample = paste("SCE-", Sys.Date(),sep = "")) |
|
7893 |
+ sample = paste0("SCE-", |
|
7894 |
+ strftime(Sys.time(), |
|
7895 |
+ format = "%y%m%d_%H%m"))) |
|
7847 | 7896 |
} |
7848 | 7897 |
}) |
7849 | 7898 |
}) |
... | ... |
@@ -8,18 +8,15 @@ shinyPanelDiffex <- fluidPage( |
8 | 8 |
panel( |
9 | 9 |
style = "margin:2px;", |
10 | 10 |
h3("Method and Matrix"), |
11 |
- p("For 'MAST', 'Limma' and 'ANOVA', log-transformed count matrix is preferred; for 'DESeq2', count matrix is preferred.", |
|
12 |
- style = "color:grey;"), |
|
13 | 11 |
fluidRow( |
14 | 12 |
column( |
15 | 13 |
4, |
16 | 14 |
selectInput('deMethod', "Choose analysis method", |
17 |
- c('MAST', 'DESeq2', 'Limma', 'ANOVA')) |
|
15 |
+ c('wilcox', 'MAST', 'DESeq2', 'Limma', 'ANOVA')) |
|
18 | 16 |
), |
19 | 17 |
column( |
20 | 18 |
4, |
21 | 19 |
uiOutput("deAssay") |
22 |
- #selectInput("deAssay", "Select Assay:", currassays) |
|
23 | 20 |
) |
24 | 21 |
), |
25 | 22 |
useShinyjs(), |
... | ... |
@@ -142,7 +139,7 @@ shinyPanelDiffex <- fluidPage( |
142 | 139 |
width = 3, |
143 | 140 |
numericInput("deFCThresh", |
144 | 141 |
"Output Log2FC Absolute value greater than:", |
145 |
- min = 0, step = 0.05, value = 1) |
|
142 |
+ min = 0, step = 0.05, value = 0.5) |
|
146 | 143 |
), |
147 | 144 |
column( |
148 | 145 |
width = 3, |
... | ... |
@@ -6,12 +6,9 @@ shinyPanelfindMarker <- fluidPage( |
6 | 6 |
"(help)", target = "_blank"), |
7 | 7 |
sidebarLayout( |
8 | 8 |
sidebarPanel( |
9 |
- p("For 'MAST' and 'Limma', log-transformed count matrix is preferred; for 'DESeq2', count matrix is preferred.", |
|
10 |
- style = "color:grey;"), |
|
11 |
- uiOutput('fmAssay'), |
|
12 |
- #selectInput('fmAssay', "Select Assay", currassays), |
|
13 | 9 |
selectInput('fmMethod', "Select Differential Expression Method", |
14 |
- c("MAST", "DESeq2", "Limma")), |
|
10 |
+ c("wilcox", "MAST", "DESeq2", "Limma", "ANOVA")), |
|
11 |
+ uiOutput('fmAssay'), |
|
15 | 12 |
selectInput("fmCluster", "Cluster Annotation", clusterChoice), |
16 | 13 |
numericInput("fmLogFC", "Log2FC greater than", |
17 | 14 |
value = 0.25, min = 0, step = 0.05), |
... | ... |
@@ -7,8 +7,8 @@ |
7 | 7 |
combineSCE(sceList, by.r, by.c, combined) |
8 | 8 |
} |
9 | 9 |
\arguments{ |
10 |
-\item{sceList}{A list contains \link[SingleCellExperiment]{SingleCellExperiment} objects. |
|
11 |
-Currently, combineSCE function only support combining SCE objects with assay in dgCMatrix format. |
|
10 |
+\item{sceList}{A list contains \link[SingleCellExperiment]{SingleCellExperiment} objects. |
|
11 |
+Currently, combineSCE function only support combining SCE objects with assay in dgCMatrix format. |
|
12 | 12 |
It does not support combining SCE with assay in delayedArray format.} |
13 | 13 |
|
14 | 14 |
\item{by.r}{Specifications of the columns used for merging rowData. See 'Details'.} |
... | ... |
@@ -10,7 +10,7 @@ on each cluster against all the others.} |
10 | 10 |
findMarkerDiffExp( |
11 | 11 |
inSCE, |
12 | 12 |
useAssay = "logcounts", |
13 |
- method = c("wilcox", "MAST", "DESeq2", "Limma"), |
|
13 |
+ method = c("wilcox", "MAST", "DESeq2", "Limma", "ANOVA"), |
|
14 | 14 |
cluster = "cluster", |
15 | 15 |
covariates = NULL, |
16 | 16 |
log2fcThreshold = 0.25, |
... | ... |
@@ -27,8 +27,8 @@ findMarkerDiffExp( |
27 | 27 |
MAST calculations. Default \code{"logcounts"}.} |
28 | 28 |
|
29 | 29 |
\item{method}{A single character for specific differential expression |
30 |
-analysis method. Choose from \code{'MAST'}, \code{'DESeq2'}, \code{'Limma'}, |
|
31 |
-and \code{'wilcox'}. Default \code{"wilcox"}.} |
|
30 |
+analysis method. Choose from \code{'wilcox'}, \code{'MAST'}, \code{'DESeq2'}, |
|
31 |
+\code{'Limma'}, and \code{'ANOVA'}. Default \code{"wilcox"}.} |
|
32 | 32 |
|
33 | 33 |
\item{cluster}{One single character to specify a column in |
34 | 34 |
\code{colData(inSCE)} for the clustering label. Alternatively, a vector or |