zhanghao-njmu / SCP

An end-to-end Single-Cell Pipeline designed to facilitate comprehensive analysis and exploration of single-cell data.
https://zhanghao-njmu.github.io/SCP/
GNU General Public License v3.0
327 stars 70 forks source link

Why is the number of DEGs output by FeatureHeatmap largely lower than that obtained from RunDEtest? #233

Open Sophia409 opened 3 months ago

Sophia409 commented 3 months ago

Hello, SCP team,

I have two unresolved questions and would appreciate your guidance.

Firstly, I noticed that the FeatureHeatmap generates a heatmap with a very small number of genes. As you can see, I obtained 1043 DEGs. Has any adjustment been made in FeatureHeatmap? How can I address this issue?

Secondly, every time I run the RunDEtest function, the output displays a warning message: "Warning in serialize(data, node$con): 'package:stats' may be unused when loaded." What could be the reason for this warning? Is it related to my Windows system? Does it affect the program's speed?

Thank you very much for your response.

Sophia

pancreas_sub <- RunDEtest(srt = myseuratobject, group_by = "treatment",fc.threshold = 1,only.pos = FALSE,assay = 'RNA',max.cells.per.ident=1000)
[2024-04-09 19:07:10.323806] Start DEtest
Workers: 22
Find all markers(wilcox) among 2 groups...
  |                                                                                                                                              |   0%Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
  |==============================================================================================================================================| 100%

[2024-04-09 19:08:38.379661] DEtest done
Elapsed time:1.47 mins
> DEGs <- pancreas_sub@tools$DEtest_treatment$AllMarkers_wilcox
> dim(DEGs)
[1] 13974    10
> DEGs <- DEGs[with(DEGs, avg_log2FC > 0.25 & p_val_adj < 0.05), ]
> dim(DEGs)
[1] 1043   10
> table(DEGs$group1)

CKO  WT 
265 778 
> # Annotate features with transcription factors and surface proteins
> pancreas_sub <- AnnotateFeatures(pancreas_sub, species = "Mus_musculus", db = c("TF", "CSPA"))
Species: Mus_musculus
Loading cached db: TF version:AnimalTFDB3 nterm:2 created:2024-04-09 16:37:37.202842
Loading cached db: CSPA version:CSPA nterm:1 created:2024-04-09 16:37:41.725707
> ht <- FeatureHeatmap(
+   srt = pancreas_sub, group.by = "treatment", features = DEGs$gene, feature_split = DEGs$group1,
+   species = "Mus_musculus", db = c("GO_BP", "KEGG", "WikiPathway"), anno_terms = TRUE,
+   feature_annotation = c("TF", "CSPA"), feature_annotation_palcolor = list(c("gold", "steelblue"), c("forestgreen")),
+   height = 5, width = 4, assay = 'RNA'
+ )
Warning in FeatureHeatmap(srt = pancreas_sub, group.by = "treatment", features = DEGs$gene,  :
  The values in the 'counts' slot are non-integer. Set the library size to 1.
[2024-04-09 19:08:40.628809] Start Enrichment
Workers: 22
Species: Mus_musculus
Loading cached db: GO_BP version:3.18.0 nterm:15848 created:2024-04-09 16:45:42.519015
Loading cached db: KEGG version:Release 110.0+/04-09, Apr 24 nterm:355 created:2024-04-09 16:46:53.291743
Loading cached db: WikiPathway version:20240310 nterm:202 created:2024-04-09 16:47:50.634595
Permform enrichment...
  |                                                                                                                                              |   0%Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
Warning in serialize(data, node$con) : 载入时'package:stats'可能无用
  |==============================================================================================================================================| 100%

[2024-04-09 19:10:28.48138] Enrichment done
Elapsed time:1.8 mins
> print(ht$plot)

image

> sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.utf8  LC_CTYPE=Chinese (Simplified)_China.utf8    LC_MONETARY=Chinese (Simplified)_China.utf8
[4] LC_NUMERIC=C                                LC_TIME=Chinese (Simplified)_China.utf8    

time zone: Asia/Shanghai
tzcode source: internal

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

other attached packages:
 [1] sf_1.0-16              ggraph_2.2.1           SCP_0.5.6              Signac_1.13.0          BiocParallel_1.36.0    ggrepel_0.9.3         
 [7] harmony_1.2.0          Rcpp_1.0.10            Matrix_1.6-5           ggdendro_0.2.0         openxlsx_4.2.5.2       clusterProfiler_4.10.1
[13] SeuratWrappers_0.3.1   RColorBrewer_1.1-3     heatmap3_1.1.9         ComplexHeatmap_2.18.0  corrplot_0.92          scRNAtoolVis_0.0.7    
[19] scCustomize_1.1.1      reticulate_1.32.0      scales_1.3.0           ggsci_3.0.0            Hmisc_5.1-1            devtools_2.4.5        
[25] usethis_2.2.3          datapasta_3.1.0        SeuratObject_5.0.1     Seurat_4.3.0.1         patchwork_1.2.0        cowplot_1.1.3         
[31] lubridate_1.9.3        forcats_1.0.0          stringr_1.5.1          dplyr_1.1.3            purrr_1.0.1            readr_2.1.5           
[37] tidyr_1.3.0            tibble_3.2.1           ggplot2_3.5.0          tidyverse_2.0.0       

loaded via a namespace (and not attached):
  [1] IRanges_2.36.0              R.methodsS3_1.8.2           progress_1.2.3              urlchecker_1.0.1            nnet_7.3-19                
  [6] goftest_1.2-3               Biostrings_2.70.3           HDF5Array_1.30.1            vctrs_0.6.2                 spatstat.random_3.1-6      
 [11] proxy_0.4-27                digest_0.6.31               png_0.1-8                   shape_1.4.6.1               slingshot_2.10.0           
 [16] deldir_1.0-9                parallelly_1.37.1           magick_2.8.3                MASS_7.3-60                 reshape2_1.4.4             
 [21] httpuv_1.6.11               foreach_1.5.2               BiocGenerics_0.48.1         qvalue_2.34.0               withr_3.0.0                
 [26] ggrastr_1.0.2               xfun_0.43                   ggfun_0.1.4                 ellipsis_0.3.2              survival_3.5-5             
 [31] proxyC_0.3.4                memoise_2.0.1               ggbeeswarm_0.7.2            janitor_2.2.0               gson_0.1.0                 
 [36] princurve_2.1.6             profvis_0.3.8               systemfonts_1.0.6           ragg_1.3.0                  tidytree_0.4.6             
 [41] zoo_1.8-12                  GlobalOptions_0.1.2         pbapply_1.7-2               R.oo_1.26.0                 prettyunits_1.2.0          
 [46] Formula_1.2-5               rematch2_2.1.2              KEGGREST_1.42.0             promises_1.2.0.1            httr_1.4.7                 
 [51] globals_0.16.3              fitdistrplus_1.1-11         rhdf5filters_1.14.1         rhdf5_2.46.1                rstudioapi_0.16.0          
 [56] units_0.8-5                 miniUI_0.1.1.1              generics_0.1.3              DOSE_3.28.2                 base64enc_0.1-3            
 [61] curl_5.2.1                  S4Vectors_0.40.2            zlibbioc_1.48.2             polyclip_1.10-4             GenomeInfoDbData_1.2.11    
 [66] SparseArray_1.2.4           xtable_1.8-4                doParallel_1.0.17           evaluate_0.23               S4Arrays_1.2.1             
 [71] BiocFileCache_2.10.2        hms_1.1.3                   GenomicRanges_1.54.1        irlba_2.3.5.1               filelock_1.0.3             
 [76] colorspace_2.1-0            ROCR_1.0-11                 spatstat.data_3.0-4         magrittr_2.0.3              lmtest_0.9-40              
 [81] snakecase_0.11.1            later_1.3.1                 viridis_0.6.5               ggtree_3.10.1               lattice_0.21-8             
 [86] spatstat.geom_3.2-5         future.apply_1.11.2         XML_3.99-0.16.1             scattermore_1.2             shadowtext_0.1.3           
 [91] matrixStats_1.0.0           RcppAnnoy_0.0.21            class_7.3-22                pillar_1.9.0                nlme_3.1-162               
 [96] iterators_1.0.14            compiler_4.3.0              stringi_1.7.12              SummarizedExperiment_1.32.0 tensor_1.5                 
[101] plyr_1.8.8                  crayon_1.5.2                abind_1.4-5                 gridGraphics_0.5-1          sp_2.0-0                   
[106] graphlayouts_1.1.1          bit_4.0.5                   fastmatch_1.1-4             textshaping_0.3.7           fastcluster_1.2.3          
[111] codetools_0.2-20            e1071_1.7-14                paletteer_1.6.0             GetoptLong_1.0.5            plotly_4.10.4              
[116] mime_0.12                   splines_4.3.0               circlize_0.4.16             dbplyr_2.5.0                HDO.db_0.99.1              
[121] knitr_1.45                  blob_1.2.4                  utf8_1.2.3                  clue_0.3-65                 fs_1.6.2                   
[126] listenv_0.9.1               checkmate_2.3.0             pkgbuild_1.4.4              ggplotify_0.1.2             tzdb_0.4.0                 
[131] tweenr_2.0.3                pkgconfig_2.0.3             tools_4.3.0                 cachem_1.0.8                R.cache_0.16.0             
[136] RSQLite_2.3.6               viridisLite_0.4.2           DBI_1.2.2                   fastmap_1.1.1               rmarkdown_2.26             
[141] ica_1.0-3                   Rsamtools_2.18.0            ggprism_1.0.5               BiocManager_1.30.22         dotCall64_1.1-1            
[146] RANN_2.6.1                  rpart_4.1.23                snow_0.4-4                  farver_2.1.1                tidygraph_1.3.1            
[151] scatterpie_0.2.1            MatrixGenerics_1.14.0       foreign_0.8-86              cli_3.6.1                   stats4_4.3.0               
[156] leiden_0.4.3.1              lifecycle_1.0.4             uwot_0.1.16                 Biobase_2.62.0              sessioninfo_1.2.2          
[161] backports_1.4.1             timechange_0.3.0            gtable_0.3.4                rjson_0.2.21                ggridges_0.5.6             
[166] progressr_0.14.0            parallel_4.3.0              ape_5.7-1                   jsonlite_1.8.4              bitops_1.0-7               
[171] bit64_4.0.5                 Rtsne_0.16                  yulab.utils_0.1.4           spatstat.utils_3.0-3        zip_2.3.1                  
[176] RcppParallel_5.1.7          GOSemSim_2.28.1             R.utils_2.12.3              lazyeval_0.2.2              shiny_1.8.1                
[181] htmltools_0.5.8             enrichplot_1.22.0           GO.db_3.18.0                sctransform_0.4.0           rappdirs_0.3.3             
[186] glue_1.6.2                  spam_2.10-0                 XVector_0.42.0              RCurl_1.98-1.14             treeio_1.26.0              
[191] ComplexUpset_1.3.3          classInt_0.4-10             gridExtra_2.3               TrajectoryUtils_1.10.1      igraph_2.0.3               
[196] R6_2.5.1                    SingleCellExperiment_1.24.0 RcppRoll_0.3.0              cluster_2.1.4               pkgload_1.3.4              
[201] Rhdf5lib_1.24.2             aplot_0.2.2                 GenomeInfoDb_1.38.8         DelayedArray_0.28.0         tidyselect_1.2.1           
[206] vipor_0.4.7                 htmlTable_2.4.1             xml2_1.3.6                  ggforce_0.4.2               AnnotationDbi_1.64.1       
[211] future_1.33.2               rsvd_1.0.5                  munsell_0.5.1               KernSmooth_2.23-21          data.table_1.14.8          
[216] htmlwidgets_1.6.4           fgsea_1.28.0                biomaRt_2.58.2              rlang_1.1.1                 spatstat.sparse_3.0-2      
[221] spatstat.explore_3.2-3      remotes_2.5.0               Cairo_1.6-2                 ggnewscale_0.4.10           fansi_1.0.4                
[226] beeswarm_0.4.0  
hermespara commented 3 months ago

Hello, I'm not the developer but the FeatureHeatmap function has a parameter that labels a certain number of genes (nlabel) and it's set by default to 20. So only 20 gene names are shown. You can change this parameter and show more gene names