satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.31k stars 920 forks source link

Average expression heatmap returns NA #2737

Closed kvshams closed 4 years ago

kvshams commented 4 years ago

I am trying to generate heatmap for average expression of genes to a list of genes. The figure returns NA instead of gene list. TopFeatures works perfectly fine

epi_cluster.averages <- AverageExpression(epi_subset, return.seurat = TRUE, add.ident = "group")
Tight_juctionGenes <- Tight_juctionGenes[Tight_juctionGenes %in% rownames(epi_cluster.averages )]
##length(Tight_juctionGenes)
##16
DoHeatmap(epi_cluster.averages, features = Tight_juctionGenes,  size = 3, draw.lines = FALSE)

image

sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 19.04

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /home/svellari/anaconda2/lib/libmkl_rt.so

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

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

other attached packages:
 [1] viridis_0.5.1               viridisLite_0.3.0          
 [3] KernSmooth_2.23-16          fields_10.3                
 [5] maps_3.3.0                  spam_2.5-1                 
 [7] dotCall64_1.0-0             DoubletFinder_2.0.2        
 [9] future_1.15.1               singlecellmethods_0.1.0    
[11] Seurat_3.1.2.9002           DropletUtils_1.4.3         
[13] SingleCellExperiment_1.6.0  SummarizedExperiment_1.14.1
[15] DelayedArray_0.10.0         BiocParallel_1.18.1        
[17] matrixStats_0.55.0          Biobase_2.44.0             
[19] GenomicRanges_1.36.1        GenomeInfoDb_1.20.0        
[21] IRanges_2.18.3              S4Vectors_0.22.1           
[23] BiocGenerics_0.30.0         ggrastr_0.1.7              
[25] harmony_1.0                 RcppArmadillo_0.9.800.3.0  
[27] Rcpp_1.0.3                  patchwork_1.0.0            
[29] scales_1.1.0                RColorBrewer_1.1-2         
[31] data.table_1.12.8           tidyr_1.0.0                
[33] ggrepel_0.8.1               ggplot2_3.2.1              
[35] dplyr_0.8.3                 Matrix_1.2-18              
[37] magrittr_1.5                ggthemes_4.2.0             
[39] reticulate_1.14            

loaded via a namespace (and not attached):
  [1] uuid_0.1-2             backports_1.1.5        sn_1.5-4              
  [4] plyr_1.8.5             igraph_1.2.4.2         repr_1.0.2            
  [7] lazyeval_0.2.2         splines_3.6.1          listenv_0.8.0         
 [10] TH.data_1.0-10         digest_0.6.23          htmltools_0.4.0       
 [13] gdata_2.18.0           cluster_2.1.0          ROCR_1.0-7            
 [16] limma_3.40.6           globals_0.12.5         RcppParallel_4.4.4    
 [19] R.utils_2.9.2          sandwich_2.5-1         colorspace_1.4-1      
 [22] rappdirs_0.3.1         crayon_1.3.4           RCurl_1.95-4.12       
 [25] jsonlite_1.6           zeallot_0.1.0          survival_3.1-8        
 [28] zoo_1.8-6              ape_5.3                glue_1.3.1            
 [31] gtable_0.3.0           zlibbioc_1.30.0        XVector_0.24.0        
 [34] leiden_0.3.1           Rhdf5lib_1.6.3         future.apply_1.3.0    
 [37] HDF5Array_1.12.3       mvtnorm_1.0-11         edgeR_3.26.8          
 [40] bibtex_0.4.2.2         metap_1.2              plotrix_3.7-7         
 [43] dqrng_0.2.1            rsvd_1.0.2             SDMTools_1.1-221.2    
 [46] tsne_0.1-3             htmlwidgets_1.5.1      httr_1.4.1            
 [49] gplots_3.0.3           TFisher_0.2.0          ica_1.0-2             
 [52] farver_2.0.1           pkgconfig_2.0.3        R.methodsS3_1.7.1     
 [55] uwot_0.1.5             locfit_1.5-9.1         labeling_0.3          
 [58] tidyselect_0.2.5       rlang_0.4.2            reshape2_1.4.3        
 [61] munsell_0.5.0          tools_3.6.1            ggridges_0.5.1        
 [64] evaluate_0.14          stringr_1.4.0          npsurv_0.4-0          
 [67] fitdistrplus_1.0-14    caTools_1.18.0         purrr_0.3.3           
 [70] RANN_2.6.1             pbapply_1.4-2          nlme_3.1-143          
 [73] R.oo_1.23.0            compiler_3.6.1         plotly_4.9.1          
 [76] png_0.1-7              lsei_1.2-0             tibble_2.1.3          
 [79] stringi_1.4.3          RSpectra_0.16-0        lattice_0.20-38       
 [82] IRdisplay_0.7.0        multtest_2.40.0        vctrs_0.2.1           
 [85] mutoss_0.1-12          pillar_1.4.3           lifecycle_0.1.0       
 [88] Rdpack_0.11-1          lmtest_0.9-37          RcppAnnoy_0.0.14      
 [91] cowplot_1.0.0          bitops_1.0-6           irlba_2.3.3           
 [94] gbRd_0.4-11            R6_2.4.1               gridExtra_2.3         
 [97] codetools_0.2-16       MASS_7.3-51.5          gtools_3.8.1          
[100] assertthat_0.2.1       rhdf5_2.28.1           withr_2.1.2           
[103] sctransform_0.2.1      mnormt_1.5-5           multcomp_1.4-11       
[106] GenomeInfoDbData_1.2.1 IRkernel_1.1           Cairo_1.5-10          
[109] Rtsne_0.15             pbdZMQ_0.3-3           numDeriv_2016.8-1.1   
[112] base64enc_0.1-3     
satijalab commented 4 years ago

You need to run ScaleData on the averaged objects before generating the heatmap. Alternately, you can specify that the heatmap should plot from the data slot. That should fix your problem, please feel free to reopen if this does not work.

kvshams commented 4 years ago

Thanks for the reply. I tried with the ScaleData too and get the same issue


DoHeatmap(epi_cluster.averages, features = Tight_juctionGenes,  size = 3, draw.lines = FALSE) ```
hansong798 commented 2 years ago

Is your feature list ordered or factor? I solved this problem by removing ordering!