monocle3 icon indicating copy to clipboard operation
monocle3 copied to clipboard

What does the grey color mean in the picture plotted by plot_cells based on one selected gene?

Open XiaoyuLi-smu opened this issue 4 years ago • 5 comments

** If this is a question and not a bug report or enhancement request, please post to our google group at https://groups.google.com/forum/#!forum/monocle-3-users**

Describe the bug A clear and concise description of what the bug is. Why would the colors of the cell in the pic plotted by plot_cells based on selected gene were mostly grey. I'd expect it somewhat like the output from seurat. I also noticed that the gene expression were negative. To Reproduce The code that produced the bug: plot_cells(cds, genes="COL1A1", show_trajectory_graph=F, label_cell_groups=FALSE, label_leaves=FALSE) traceback() After the error, run traceback() in R and post the output:

Expected behavior A clear and concise description of what you expected to happen. image

Screenshots If applicable, add screenshots to help explain your problem. image

sessionInfo(): Run sessionInfo() in R and post the output R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale: [1] LC_COLLATE=Chinese (Simplified)_China.936 [2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936 [4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936

attached base packages: [1] stats4 parallel grid stats graphics grDevices utils
[8] datasets methods base

other attached packages: [1] monocle3_0.2.3.0 SingleCellExperiment_1.10.1 [3] SummarizedExperiment_1.18.2 DelayedArray_0.14.1
[5] matrixStats_0.57.0 GenomicRanges_1.40.0
[7] GenomeInfoDb_1.24.2 IRanges_2.22.2
[9] S4Vectors_0.26.1 Biobase_2.48.0
[11] BiocGenerics_0.34.0 msigdbr_7.2.1
[13] ComplexHeatmap_2.4.3 purrr_0.3.4
[15] patchwork_1.0.1 ggpubr_0.4.0
[17] stringr_1.4.0 dplyr_1.0.2
[19] reshape2_1.4.4 clustree_0.4.3
[21] ggraph_2.0.3 ggplot2_3.3.2
[23] Seurat_3.2.2

loaded via a namespace (and not attached): [1] reticulate_1.18 tidyselect_1.1.0 htmlwidgets_1.5.2
[4] Rtsne_0.15 munsell_0.5.0 codetools_0.2-16
[7] mutoss_0.1-12 ica_1.0-2 future_1.20.1
[10] miniUI_0.1.1.1 withr_2.3.0 colorspace_1.4-1
[13] knitr_1.30 rstudioapi_0.11 ROCR_1.0-11
[16] ggsignif_0.6.0 tensor_1.5 gbRd_0.4-11
[19] listenv_0.8.0 Rdpack_2.0 labeling_0.4.2
[22] GenomeInfoDbData_1.2.3 mnormt_2.0.2 polyclip_1.10-0
[25] farver_2.0.3 parallelly_1.21.0 vctrs_0.3.4
[28] generics_0.1.0 TH.data_1.0-10 xfun_0.18
[31] R6_2.5.0 clue_0.3-57 graphlayouts_0.7.1
[34] rsvd_1.0.3 bitops_1.0-6 spatstat.utils_1.17-0 [37] assertthat_0.2.1 promises_1.1.1 scales_1.1.1
[40] multcomp_1.4-14 nnet_7.3-14 gtable_0.3.0
[43] globals_0.13.1 goftest_1.2-2 tidygraph_1.2.0
[46] sandwich_3.0-0 rlang_0.4.8 GlobalOptions_0.1.2
[49] splines_4.0.3 rstatix_0.6.0 lazyeval_0.2.2
[52] broom_0.7.2 checkmate_2.0.0 yaml_2.2.1
[55] abind_1.4-5 backports_1.2.0 httpuv_1.5.4
[58] Hmisc_4.4-1 tools_4.0.3 ellipsis_0.3.1
[61] RColorBrewer_1.1-2 ggridges_0.5.2 TFisher_0.2.0
[64] Rcpp_1.0.5 plyr_1.8.6 zlibbioc_1.34.0
[67] base64enc_0.1-3 RCurl_1.98-1.2 rpart_4.1-15
[70] deldir_0.2-2 GetoptLong_1.0.4 pbapply_1.4-3
[73] viridis_0.5.1 cowplot_1.1.0 zoo_1.8-8
[76] haven_2.3.1 ggrepel_0.8.2 cluster_2.1.0
[79] tinytex_0.26 magrittr_1.5 ggThemeAssist_0.1.5
[82] data.table_1.13.2 openxlsx_4.2.3 circlize_0.4.10
[85] lmtest_0.9-38 RANN_2.6.1 tmvnsim_1.0-2
[88] mvtnorm_1.1-1 fitdistrplus_1.1-1 hms_0.5.3
[91] mime_0.9 evaluate_0.14 xtable_1.8-4
[94] rio_0.5.16 jpeg_0.1-8.1 readxl_1.3.1
[97] shape_1.4.5 gridExtra_2.3 compiler_4.0.3
[100] tibble_3.0.4 KernSmooth_2.23-17 crayon_1.3.4
[103] htmltools_0.5.0 mgcv_1.8-33 later_1.1.0.1
[106] Formula_1.2-4 tidyr_1.1.2 tweenr_1.0.1
[109] formatR_1.7 MASS_7.3-53 Matrix_1.2-18
[112] car_3.0-10 cli_2.1.0 rbibutils_1.3
[115] metap_1.4 igraph_1.2.6 forcats_0.5.0
[118] pkgconfig_2.0.3 sn_1.6-2 numDeriv_2016.8-1.1
[121] foreign_0.8-80 plotly_4.9.2.1 xml2_1.3.2
[124] XVector_0.28.0 multtest_2.44.0 digest_0.6.27
[127] sctransform_0.3.1 RcppAnnoy_0.0.16 spatstat.data_1.4-3
[130] rmarkdown_2.5 cellranger_1.1.0 leiden_0.3.4
[133] htmlTable_2.1.0 uwot_0.1.8 curl_4.3
[136] shiny_1.5.0 rjson_0.2.20 lifecycle_0.2.0
[139] nlme_3.1-149 jsonlite_1.7.1 carData_3.0-4
[142] viridisLite_0.3.0 limma_3.44.3 fansi_0.4.1
[145] pillar_1.4.6 lattice_0.20-41 fastmap_1.0.1
[148] httr_1.4.2 plotrix_3.7-8 survival_3.2-7
[151] glue_1.4.2 zip_2.1.1 spatstat_1.64-1
[154] png_0.1-7 ggforce_0.3.2 stringi_1.5.3
[157] latticeExtra_0.6-29 mathjaxr_1.0-1 irlba_2.3.3
[160] future.apply_1.6.0
Additional context Add any other context about the problem here.

XiaoyuLi-smu avatar Jan 09 '21 16:01 XiaoyuLi-smu

Hi,

The legend on the right side of the plot shows that cells with zero expression (or less than zero) are colored gray so the gray cells have no expression. Regarding the cells with negative expression, did you log-normalize the expression matrix? If so, those cells have expression less than 1. Does this answer your question?

brgew avatar Mar 29 '21 21:03 brgew

I was experiencing a similar problem and found that when importing a Seurat object (Seurat v3) using the SeuratWrappers function as.cell_data_set, the cds@colData$Size_Factor is set to the sum of UMI counts in each cell.

For plotting functions such as plot_genes_in_pseudotime, when the counts for the genes get divided by the size factor it produces a very small fraction which seems to get rounded to zero in a subsequent step.

You can check if this is also the problem for you by looking at head(cds@colData$Size_Factor). The numbers should be fractions. If they are in the hundreds or thousands (equal to the sum of the UMI counts per cell) then that could be your issue.

I was able to get around it by constructing the cds object piece by piece using the Monocle tutorial instead of using the as.cell_data_set function.

malosreet avatar Apr 14 '21 10:04 malosreet

I am having the same issue as @malosreet described. What should Size_Factor contain? Is it possible to calculate the correct values for Size_Factor instead of having to start over creating the cds object? I would really like to use the already filtered data from my seurat object because I am having trouble finding a good way to filter out low quality cells using monocle.

nsanford0 avatar Oct 14 '21 22:10 nsanford0

Dear all, does anyone found a solution? I have the same issue as @nsanford0 and @malosreet

gabsax avatar Apr 06 '22 11:04 gabsax

Hi I'm a bit of a beginner and have run into the issues @nsanford0 @malosreet and @gabsax have come across. Has anyone found a way to keep the Seurat object rather than the monocle workflow? Thank you in advance!

Edit: For future people, I ran across this comment here https://github.com/satijalab/seurat-wrappers/issues/54#issuecomment-662492183, and have done cds <- moncole3::estimate_size_factors(cds) which seems to have worked. If this was incorrect, please let me know!

Matthew1309 avatar Aug 25 '22 00:08 Matthew1309