Thank you for the Package!
The DotPlot_scCustom is not behaving as expected. Currenlty only genes can be plotted. Not the numeric variables in the meta data such as module scores in a seurat metadata. Seurat's Default DotPlot works same with the same synatx as shown in the code below
Looking at the source code, DotPlot use the Gene_Present function first to cross check the supplied list of 'features'.
features_list <- Gene_Present(data = seurat_object, gene_list = features,omit_warn = TRUE, print_msg = FALSE, case_check_msg = TRUE)[[1]]
> DotPlot_scCustom
function (seurat_object, features, colors_use = viridis_plasma_dark_high,
remove_axis_titles = TRUE, x_lab_rotate = FALSE, y_lab_rotate = FALSE,
facet_label_rotate = FALSE, flip_axes = FALSE, ...)
{
Is_Seurat(seurat_object = seurat_object)
features_list <- Gene_Present(data = seurat_object, gene_list = features,
omit_warn = TRUE, print_msg = FALSE, case_check_msg = TRUE)[[1]]
However, Gene_Present function only checks for rownames of the Default Assay matrix in Seurat and do not look for meta data columns. (possible_features <- rownames(x = GetAssayData(object = data, assay = assay)))
> Gene_Present
function (data, gene_list, case_check = TRUE, case_check_msg = TRUE,
print_msg = TRUE, omit_warn = TRUE, return_none = FALSE,
seurat_assay = NULL)
{
accepted_types <- c("data.frame", "dgCMatrix", "dgTMatrix",
"tibble")
if ((class(x = data)[[1]] == "Seurat")) {
assay <- seurat_assay %||% DefaultAssay(object = data)
possible_features <- rownames(x = GetAssayData(object = data,
assay = assay))
Using FetchData function from Seurat might be better as it already looks at both meta data and the assay matrix for the supplied vars. As to other object classes I do not have experience with them.
> head(pbmc3k.final[[]])
orig.ident nCount_RNA nFeature_RNA seurat_annotations percent.mt RNA_snn_res.0.5 seurat_clusters
AAACATACAACCAC pbmc3k 2419 779 Memory CD4 T 3.0177759 1 1
AAACATTGAGCTAC pbmc3k 4903 1352 B 3.7935958 3 3
AAACATTGATCAGC pbmc3k 3147 1129 Memory CD4 T 0.8897363 1 1
AAACCGTGCTTCCG pbmc3k 2639 960 CD14+ Mono 1.7430845 2 2
AAACCGTGTATGCG pbmc3k 980 521 NK 1.2244898 6 6
AAACGCACTGGTAC pbmc3k 2163 781 Memory CD4 T 1.6643551 1 1
> DotPlot(pbmc3k.final, features = c("nCount_RNA","percent.mt"))
> pbmc3k.final <- AddModuleScore(pbmc3k.final, features = list(c("MRC1","CSF1R","CD68","CD14")), name = "Gene_Sig")
Warning: The following features are not present in the object: MRC1, not searching for symbol synonyms
> DotPlot(pbmc3k.final, features = c("Gene_Sig1","percent.mt"))
> DotPlot_scCustom(pbmc3k.final, features = c("Gene_Sig1","percent.mt"))
Error in Gene_Present(data = seurat_object, gene_list = features, omit_warn = TRUE, :
No requested features found.
sessionInfo() output
> sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.6 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] scCustomize_0.7.0 Seurat_4.1.1 sp_1.4-7 SeuratObject_4.1.0
loaded via a namespace (and not attached):
[1] utf8_1.2.2 reticulate_1.25 tidyselect_1.1.2 htmlwidgets_1.5.4
[5] grid_4.2.0 Rtsne_0.16 devtools_2.4.3 munsell_0.5.0
[9] codetools_0.2-18 ica_1.0-2 future_1.25.0 miniUI_0.1.1.1
[13] withr_2.5.0 spatstat.random_2.2-0 colorspace_2.0-3 progressr_0.10.0
[17] Biobase_2.56.0 rstudioapi_0.13 stats4_4.2.0 SingleCellExperiment_1.18.0
[21] ROCR_1.0-11 ggsignif_0.6.3 tensor_1.5 listenv_0.8.0
[25] labeling_0.4.2 MatrixGenerics_1.8.0 GenomeInfoDbData_1.2.8 polyclip_1.10-0
[29] farver_2.1.0 pheatmap_1.0.12 rprojroot_2.0.3 parallelly_1.31.1
[33] vctrs_0.4.1 generics_0.1.2 dittoSeq_1.9.0 R6_2.5.1
[37] GenomeInfoDb_1.32.2 ggbeeswarm_0.6.0 bitops_1.0-7 spatstat.utils_2.3-1
[41] cachem_1.0.6 DelayedArray_0.22.0 assertthat_0.2.1 promises_1.2.0.1
[45] scales_1.2.0 rgeos_0.5-9 beeswarm_0.4.0 gtable_0.3.0
[49] globals_0.15.0 processx_3.5.3 goftest_1.2-3 rlang_1.0.2
[53] GlobalOptions_0.1.2 splines_4.2.0 rstatix_0.7.0 lazyeval_0.2.2
[57] spatstat.geom_2.4-0 broom_0.8.0 reshape2_1.4.4 abind_1.4-5
[61] backports_1.4.1 httpuv_1.6.5 tools_4.2.0 usethis_2.1.5
[65] ggplot2_3.3.6 ellipsis_0.3.2 spatstat.core_2.4-4 RColorBrewer_1.1-3
[69] BiocGenerics_0.42.0 sessioninfo_1.2.2 ggridges_0.5.3 Rcpp_1.0.8.3
[73] plyr_1.8.7 zlibbioc_1.42.0 purrr_0.3.4 RCurl_1.98-1.6
[77] ps_1.7.0 prettyunits_1.1.1 ggpubr_0.4.0 rpart_4.1.16
[81] deldir_1.0-6 pbapply_1.5-0 viridis_0.6.2 cowplot_1.1.1
[85] S4Vectors_0.34.0 zoo_1.8-10 SummarizedExperiment_1.26.1 ggrepel_0.9.1
[89] cluster_2.1.3 fs_1.5.2 magrittr_2.0.3 data.table_1.14.2
[93] scattermore_0.8 circlize_0.4.15 lmtest_0.9-40 RANN_2.6.1
[97] fitdistrplus_1.1-8 matrixStats_0.62.0 pkgload_1.2.4 patchwork_1.1.1
[101] mime_0.12 xtable_1.8-4 IRanges_2.30.0 gridExtra_2.3
[105] shape_1.4.6 testthat_3.1.4 compiler_4.2.0 tibble_3.1.7
[109] colorway_0.2.0 KernSmooth_2.23-20 crayon_1.5.1 htmltools_0.5.2
[113] mgcv_1.8-40 later_1.3.0 ggprism_1.0.3.9000 tidyr_1.2.0
[117] lubridate_1.8.0 DBI_1.1.2 MASS_7.3-57 Matrix_1.4-1
[121] car_3.0-13 brio_1.1.3 cli_3.3.0 parallel_4.2.0
[125] igraph_1.3.1 GenomicRanges_1.48.0 forcats_0.5.1 pkgconfig_2.0.3
[129] plotly_4.10.0 spatstat.sparse_2.1-1 paletteer_1.4.0 vipor_0.4.5
[133] XVector_0.36.0 snakecase_0.11.0 stringr_1.4.0 callr_3.7.0
[137] digest_0.6.29 sctransform_0.3.3 RcppAnnoy_0.0.19 janitor_2.1.0
[141] spatstat.data_2.2-0 leiden_0.4.2 uwot_0.1.11 curl_4.3.2
[145] shiny_1.7.1 lifecycle_1.0.1 nlme_3.1-157 jsonlite_1.8.0
[149] carData_3.0-5 desc_1.4.1 viridisLite_0.4.0 fansi_1.0.3
[153] pillar_1.7.0 lattice_0.20-45 fastmap_1.1.0 httr_1.4.3
[157] pkgbuild_1.3.1 survival_3.3-1 glue_1.6.2 remotes_2.4.2
[161] png_0.1-7 stringi_1.7.6 rematch2_2.1.2 memoise_2.0.1
[165] dplyr_1.0.9 irlba_2.3.5 future.apply_1.9.0 ```
</details>