@@ -50,7 +50,7 @@ DT::datatable(NULL)
5050```
5151
5252``` {r, section_gen_info_1, eval="exp_info" %in% section, echo=FALSE, results = "asis"}
53- knitr::asis_output("# All Modules ")
53+ knitr::asis_output("# General information ")
5454```
5555
5656``` {r, section_gen_info_2, eval="exp_info" %in% section, echo=FALSE, results = "asis"}
@@ -135,7 +135,7 @@ if(nrow(workflow_params) > 0)
135135
136136
137137``` {r, section_gen_info_14, eval=TRUE, echo=FALSE, results = "asis"}
138- knitr::asis_output("## Experiment information {.panelset}")
138+ knitr::asis_output("## Cell/spot populations {.panelset}")
139139```
140140
141141``` {r, section_gen_info_14a, eval="exp_pca" %in% section, echo=FALSE, results = "asis"}
@@ -172,6 +172,12 @@ knitr::asis_output("A UMAP showing the cell/spot classes.")
172172
173173``` {r section_gen_info_17, echo=FALSE, eval="exp_umap" %in% section, echo=FALSE, results = "asis"}
174174DimPlot_used_params <- as.list(formals(Seurat::DimPlot))
175+ for(i in names(DimPlot_used_params)){
176+ if(is.null(DimPlot_used_params[[i]]) || as.character(DimPlot_used_params[[i]])[1] == "deprecated"){
177+ DimPlot_used_params <- DimPlot_used_params[names(DimPlot_used_params) != i]
178+ }
179+ }
180+
175181for(i in names(DimPlot_params)){
176182 DimPlot_used_params[[i]] <- DimPlot_params[[i]]}
177183DimPlot_used_params$object <- seurat_object
@@ -191,6 +197,12 @@ knitr::asis_output("A UMAP showing the cell/spot classes according to origin.")
191197
192198``` {r section_gen_info_17_1, echo=FALSE, eval="exp_umap" %in% section, echo=FALSE, results = "asis"}
193199DimPlot_used_params <- as.list(formals(Seurat::DimPlot))
200+ for(i in names(DimPlot_used_params)){
201+ if(is.null(DimPlot_used_params[[i]]) || as.character(DimPlot_used_params[[i]])[1] == "deprecated"){
202+ DimPlot_used_params <- DimPlot_used_params[names(DimPlot_used_params) != i]
203+ }
204+ }
205+
194206for(i in names(DimPlot_params)){
195207 DimPlot_used_params[[i]] <- DimPlot_params[[i]]}
196208DimPlot_used_params$object <- seurat_object
@@ -293,12 +305,13 @@ colnames(df) <- c("Origin", "Cell_Identity")
293305df$Origin <- factor(df$Origin)
294306df$Cell_Identity <- factor(df$Cell_Identity)
295307Cell_Identity <- Origin <- Count <- NULL
296- ggplot2::ggplot(df, mapping = ggplot2::aes(x=Cell_Identity, fill=Origin)) +
308+ ggplot2::ggplot(df, mapping = ggplot2::aes(x=Cell_Identity, fill=Origin, by = Cell_Identity )) +
297309 ggplot2::geom_bar(position="fill") +
298- ggplot2::labs(x="Cell Identity", y="Count ") +
310+ ggplot2::labs(x="Cell Identity", y="Fraction ") +
299311 ggplot2::theme_minimal() +
300312 ggplot2::coord_flip() +
301- ggplot2::theme(legend.position = "none")
313+ ggplot2::theme(legend.position = "none") +
314+ ggplot2::geom_text(stat = ggstats::StatProp, position = ggplot2::position_fill(.5), size=2)
302315
303316df <- as.data.frame(cbind(seurat_object@meta.data$orig.ident, Idents(seurat_object)))
304317colnames(df) <- c("Origin", "Cell_Identity")
@@ -307,24 +320,23 @@ df$Cell_Identity <- factor(df$Cell_Identity)
307320Cell_Identity <- Origin <- Count <- NULL
308321ggplot2::ggplot(df, mapping = ggplot2::aes(x=Origin, fill=Cell_Identity, by = Origin)) +
309322 ggplot2::geom_bar(position="fill") +
310- ggplot2::labs(x="fill ", y="Cell_Identity") +
323+ ggplot2::labs(x="Origin ", y="Cell_Identity") +
311324 ggplot2::theme_minimal() +
312325 ggplot2::geom_text(stat = ggstats::StatProp, position = ggplot2::position_fill(.5), size=2)
313326```
314327
315328
316329
317- ``` {r, section_gen_info_17d_1 , eval="exp_pop_table_by_ori" %in% section, echo=FALSE, results = "asis"}
330+ ``` {r, section_gen_info_17d_2 , eval="exp_pop_table_by_ori" %in% section, echo=FALSE, results = "asis"}
318331knitr::asis_output("### Population table by origin")
319332```
320333
321- ``` {r, section_gen_info_17e_1 , eval="exp_pop_table_by_ori" %in% section, echo=FALSE, results = "asis"}
334+ ``` {r, section_gen_info_17e_2 , eval="exp_pop_table_by_ori" %in% section, echo=FALSE, results = "asis"}
322335knitr::asis_output("The size of each cell population according to the corresponding sample/origin. Raw counts")
323336```
324337
325- ``` {r section_gen_info_17f_1, echo=FALSE, eval="exp_pop_table_by_ori" %in% section, echo=FALSE, results = "asis"}
326- df <- as.data.frame(cbind(seurat_object@meta.data$orig.ident, Idents(seurat_object)))
327- colnames(df) <- c("Origin", "Cell_Identity")
338+ ``` {r section_gen_info_17f_2, echo=FALSE, eval="exp_pop_table_by_ori" %in% section, echo=FALSE, results = "asis"}
339+ df <- data.frame(Origin=seurat_object@meta.data$orig.ident, Cell_Identity=Idents(seurat_object))
328340df <- table(df$Cell_Identity, df$Origin)
329341DT::datatable(
330342 df,
@@ -339,9 +351,6 @@ DT::datatable(
339351
340352
341353
342-
343-
344-
345354``` {r, section_gen_info_18, eval="exp_spatial_dist" %in% section, echo=FALSE, results = "asis"}
346355knitr::asis_output("### Spatial distribution")
347356```
@@ -351,11 +360,8 @@ knitr::asis_output("The spatial distribution of counts and features.")
351360```
352361
353362``` {r section_gen_info_20, echo=FALSE, eval="exp_spatial_dist" %in% section, echo=FALSE, results = "asis"}
354- SpatialFeaturePlot_used_params <- as.list(formals(Seurat::SpatialFeaturePlot))
355- for(i in names(SpatialFeaturePlot_params)){
356- SpatialFeaturePlot_used_params[[i]] <- SpatialFeaturePlot_params[[i]]}
357363
358- SpatialFeaturePlot_used_params $object <- seurat_object
364+ SpatialFeaturePlot_params $object <- seurat_object
359365
360366if(length(grep("^[Mm][Tt]-", rownames(seurat_object))) > 0 )
361367 seurat_object[["pctMito"]] <- PercentageFeatureSet(seurat_object, pattern = "^[Mm][Tt]-")
@@ -366,8 +372,8 @@ if(length(grep("^[Rr][Pp][Ll]", rownames(seurat_object))) > 0)
366372var_qc <- grep("(^nFeature)|(^nCount)|(^pctMito)|(^pctRibo)", colnames(seurat_object@meta.data), perl = TRUE, value = TRUE)
367373
368374for(feat in var_qc){
369- SpatialFeaturePlot_used_params $features <- feat
370- tryerror <- try(base::do.call(Seurat::SpatialFeaturePlot, SpatialFeaturePlot_used_params )) # got some Error in `FetchData()`...
375+ SpatialFeaturePlot_params $features <- feat
376+ tryerror <- try(base::do.call(Seurat::SpatialFeaturePlot, SpatialFeaturePlot_params )) # got some Error in `FetchData()`...
371377 if(!inherits(tryerror, "try-error")){
372378 print(tryerror)
373379 }
@@ -387,15 +393,10 @@ identities <- grep("seurat_clusters",
387393 colnames(seurat_object@meta.data), perl=TRUE, val=TRUE)
388394
389395if(length(identities)){
390- SpatialDimPlot_used_params <- as.list(formals(Seurat::SpatialDimPlot))
391-
392- for(i in names(SpatialDimPlot_params)){
393- SpatialDimPlot_used_params[[i]] <- SpatialDimPlot_params[[i]]
394- }
395396
396- SpatialDimPlot_used_params $object <- seurat_object
397+ SpatialDimPlot_params $object <- seurat_object
397398
398- print(base::do.call(Seurat::SpatialDimPlot, SpatialDimPlot_used_params ))
399+ print(base::do.call(Seurat::SpatialDimPlot, SpatialDimPlot_params ))
399400
400401}
401402
@@ -433,7 +434,6 @@ knitr::asis_output("### Module genes")
433434```
434435
435436
436-
437437``` {r, section_gen_info_30, eval="exp_genes" %in% section, echo=FALSE, results = "asis"}
438438knitr::asis_output("This section provides information about gene contained in modules.")
439439```
@@ -497,14 +497,10 @@ knitr::asis_output("Mean expression of gene across cell/spot populations for eac
497497
498498``` {r section_gen_info_38, echo=FALSE, eval="exp_mean_1" %in% section}
499499
500- plot_multi_profiles_used_params <- as.list(formals(plot_multi_profiles))
501- for(i in names(plot_multi_profiles_params))
502- plot_multi_profiles_used_params[[i]] <- plot_multi_profiles_params[[i]]
500+ plot_multi_profiles_params$data <- cluster_set
501+ plot_multi_profiles_params$ident <- Idents(seurat_object)
503502
504- plot_multi_profiles_used_params$data <- cluster_set
505- plot_multi_profiles_used_params$ident <- Idents(seurat_object)
506-
507- print(base::do.call(plot_multi_profiles, plot_multi_profiles_used_params))
503+ print(base::do.call(plot_multi_profiles, plot_multi_profiles_params))
508504```
509505
510506``` {r, section_gen_info_39, eval="exp_mean_2" %in% section, echo=FALSE, results = "asis"}
@@ -516,10 +512,8 @@ knitr::asis_output("Mean expression of gene across cell/spot populations for eac
516512```
517513
518514``` {r section_gen_info_41, echo=FALSE, eval="exp_mean_2" %in% section}
519- plot_profiles_used_params <- as.list(formals(plot_profiles))
520- for(i in names(plot_profiles_params))
521- plot_profiles_used_params[[i]] <- plot_profiles_params[[i]]
522- plot_profiles_used_params$data <- cluster_set
523- plot_profiles_used_params$ident <- Idents(seurat_object)
524- print(base::do.call(plot_profiles, plot_profiles_used_params))
515+
516+ plot_profiles_params$data <- cluster_set
517+ plot_profiles_params$ident <- Idents(seurat_object)
518+ print(base::do.call(plot_profiles, plot_profiles_params))
525519```
0 commit comments