Browse code

Fixed some bugs in the reports including using correct assay for UMAP and tSNE generation

Joshua D. Campbell authored on 20/09/2021 22:44:15
Showing 2 changed files

... ...
@@ -112,24 +112,25 @@ opts_chunk$set(
112 112
 Reduced dimensional 2-D plots created by algorithms such as tSNE and UMAP are useful for visualizing the relationship between cells. Each point on the plot represents a single cell. Cells closer together on the plot have more similar expression profiles across all genes. The tabs below show the `r reducedDimName` dimensions colored by different variables. The *Cluster* tab colors cells by the `r K` subpopulation labels identified by celda_CG, The *Sample Labels* tab colors cells by the sample label supplied to celda_CG. If no sample label was supplied to celda_CG, then all cells will be the same color. The *Cell Annotations* tab contains colors points by other pre-specified cell-level annotations.
113 113
 
114 114
 ### Clusters
115
-```{r celda_clusters, fig.height = 9, fig.width = 9}
115
+```{r celda_clusters}
116 116
 plotDimReduceCluster(sce, reducedDimName = reducedDimName, labelClusters = TRUE)
117 117
 ```
118 118
 
119 119
 ### Sample Labels
120
-```{r celda_samples, fig.height = 9, fig.width = 9}
120
+```{r celda_samples}
121 121
 plotSCEDimReduceColData(
122 122
   altExp(sce),
123 123
   reducedDimName = reducedDimName,
124 124
   colorBy = "celda_sample_label",
125
-  labelClusters = FALSE
125
+  labelClusters = FALSE,
126
+  dotSize = 0.5
126 127
 )
127 128
 ```
128 129
 
129 130
 
130 131
 ### Cell Annotations {.tabset .tabset-fade}
131 132
 
132
-```{r celda_cellAnnot, results = "asis", fig.height = 9, fig.width = 10}
133
+```{r celda_cellAnnot, results = "asis"}
133 134
 if (!is.null(cellAnnotFinal)) {
134 135
   for (i in seq_along(cellAnnotFinal)) {
135 136
     cat(sprintf(tab4, cellAnnotFinal[i]))
... ...
@@ -139,11 +140,11 @@ if (!is.null(cellAnnotFinal)) {
139 140
     print(
140 141
       plotSCEDimReduceColData(
141 142
         altExp(sce),
142
-        sample = sce$sample,
143 143
         colorBy = cellAnnotFinal[i],
144 144
         conditionClass = conditionClass,
145 145
         reducedDim = reducedDimName,
146
-        labelClusters = plotLabels[i]
146
+        labelClusters = plotLabels[i],
147
+        dotSize = 0.5
147 148
       )
148 149
     )
149 150
     cat(space)
... ...
@@ -141,7 +141,7 @@ grid.arrange(p1, p2,  ncol = 2)
141 141
 ```
142 142
 
143 143
 
144
-## Determining the number of cell populaitons (K)
144
+## Determining the number of cell populations (K)
145 145
 The ```recursiveSplitCell``` function fits different celda models for a range of ```K``` values from `r initialK` to `r maxK`. The number of modules is set to ```L``` and the module labels from the ```recursiveSplitModule``` output are used for initialization. Similarly, the first model is fit with ```r paste0("K = ", initialK)```. Then the `celda_C` model is used to split each cell population into two new cell populations and the likelihood is re-calculated. The split that produced the best overall likelihood out of all splits is used for the next model with `K+1` cell populations. Perplexity and RPC are calculated as described in the previous section. The elbow can be used as a good starting point for possible choices of ```K```. Lastly, the final model is selected and the modules and cells are reordered using hierarchical clustering so that more similar modules and cell populations will have more similar values of L and K, respectively. Different choices for ```K``` are also visualized in reduced dimensional plots in the next section.
146 146
 
147 147
 ```{r cell_split}
... ...
@@ -182,7 +182,7 @@ Reduced dimensional 2-D plots created by algorithms such as tSNE and UMAP are us
182 182
 
183 183
 ### tSNE {.tabset .tabset-fade}
184 184
 ```{r dimreduce_tsne, results = "asis"}
185
-sce <- celdaTsne(sce)
185
+sce <- celdaTsne(sce, useAssay = useAssay, altExpName = altExpName)
186 186
 tsne <- reducedDim(altExp(sce, altExpName), "celda_tSNE")
187 187
 for (i in seq.int(initialK, maxK)) {
188 188
   cat(sprintf(tab4, paste0("K = ", i)))
... ...
@@ -202,7 +202,7 @@ for (i in seq.int(initialK, maxK)) {
202 202
 
203 203
 ### UMAP {.tabset .tabset-fade}
204 204
 ```{r dimreduce_umap, results = "asis"}
205
-sce <- celdaUmap(sce)
205
+sce <- celdaUmap(sce, useAssay = useAssay, altExpName = altExpName)
206 206
 umap <- reducedDim(altExp(sce, altExpName), "celda_UMAP")
207 207
 for (i in seq.int(initialK, maxK)) {
208 208
   cat(sprintf(tab4, paste0("K = ", i)))