Browse code

Fix in the report to work with displayName.

Joshua D. Campbell authored on 27/04/2022 14:08:00
Showing 2 changed files

... ...
@@ -281,7 +281,12 @@ for (i in seq.int(1, length(grids) - 1)) {
281 281
 This section displays a table of features in each module and can be used as a quick way to lookup features of interest. The features within each module are ordered from those with highest expression at the top to those with lower expression at the bottom (same as in the heatmaps in the previous tab).
282 282
 
283 283
 ```{r celda_modules_table}
284
-table <- featureModuleTable(sce)
284
+table <- featureModuleTable(
285
+    sce,
286
+    useAssay = useAssay,
287
+    altExpName = altExpName,
288
+    displayName = displayName
289
+  )
285 290
 kable(table, style = "html", row.names = FALSE) %>%
286 291
   kable_styling(bootstrap_options = "striped") %>%
287 292
   scroll_box(width = "100%", height = "800px")
... ...
@@ -291,6 +296,7 @@ if (!is.null(moduleFileName)) {
291 296
     sce,
292 297
     useAssay = useAssay,
293 298
     altExpName = altExpName,
299
+    displayName = displayName,
294 300
     outputFile = moduleFileName
295 301
   )
296 302
 }
... ...
@@ -316,7 +322,6 @@ if (!is.null(features)) {
316 322
         sce,
317 323
         reducedDimName = "celda_UMAP",
318 324
         features = rownames(sce)[ix],
319
-        displayName = displayName,
320 325
         colorHigh = "red",
321 326
         colorMid = "grey",
322 327
         colorLow = "blue",
... ...
@@ -157,7 +157,7 @@ plotGridSearchPerplexity(moduleSplit, altExpName = altExpName, sep = 10)
157 157
 The perplexity alone often does not show a clear elbow or "leveling off". However, the rate of perplexity change (RPC) can be more informative to determine when adding new modules does not add much additional information [Zhao et al., 2015](https://doi.org/10.1186/1471-2105-16-S13-S8){target="_blank"}). An RPC closer to zero indicates that the addition of new modules or cell clusters is not substantially decreasing the perplexity. The RPC of models can be visualized using function `plotRPC`:
158 158
 
159 159
 ```{r module_split_rpc, message = FALSE, warning = FALSE}
160
-plotRPC(moduleSplit, altExpName = altExpName, sep = 10, n = 30)
160
+plotRPC(moduleSplit, altExpName = altExpName)
161 161
 ```
162 162
 
163 163
 In this case, we will choose an `L` of 80 as the RPC curve tends to level off at this point:
... ...
@@ -182,7 +182,7 @@ The perplexities and RPC of models can be visualized using the same functions `p
182 182
 
183 183
 ```{r cell_split_perplexity, warning = FALSE}
184 184
 plotGridSearchPerplexity(sce)
185
-plotRPC(sce)
185
+plotRPC(sce, , altExpName = altExpName)
186 186
 ```
187 187
 
188 188
 The perplexity continues to decrease with larger values of `K`. The RPC generally levels off between 13 and 16 and we choose the model with `K = 14` for downstream analysis. The follow code selects the final `celda_CG` model with `L = 80` and `K = 14`:
... ...
@@ -410,7 +410,7 @@ All of the parameters in this function are the same that were used throughout th
410 410
 The second report takes in as input an SCE object with a fitted `celda_CG` model and systematically generates several plots that facilitate exploratory analysis including cell subpopulation cluster labels on 2-D embeddings, user-specified annotations on 2-D embeddings, module heatmaps, module probabilities, expression of marker genes on 2-D embeddings, and the celda probability map. The report can be generated with the following code:
411 411
 
412 412
 ```{r report_results, eval = FALSE}
413
-reportCeldaCGPlotResults(sce, reducedDimName = "celda_UMAP", features = markers, useAssay = useAssay, altExpName = altExpName, cellAnnot = c("total", "detected", "decontX_contamination", "subsets_mito_percent"), cellAnnotLabel = "scDblFinder_class")
413
+reportCeldaCGPlotResults(sce, reducedDimName = "celda_UMAP", features = markers, useAssay = useAssay, altExpName = altExpName, cellAnnot = c("total", "detected", "decontX_contamination", "subsets_mito_percent"), cellAnnotLabel = "scDblFinder_doublet_call")
414 414
 ```
415 415
 
416 416
 User-supplied annotations to plot on the 2-D embedding can be specified through the `cellAnnot` and `cellAnnotLabel` variables. Both parameters will allow for plotting of variables stored in the colData of the SCE on the 2-D embedding plot specified by `reducedDimName` parameter. For `cellAnnot`, integer and numeric variables will be plotted as as continuous variables while factors and characters will be plotted as categorical variables. For `cellAnnotLabel`, all variables will be coerced to a factor and the labels of the categories will be plotted on the scatter plot.