Heatmap with foldchange displayed
Using heatmap(), I cannot get the foldChange to display properly. It looks the same as without fold change. I followed tutorial 15.4 and I believe my gene_list is equivalent.
I am using following csv: DESeq2_kallisto_MM003_MM007_MM011_vs_MM027_MM031_MM035-DEG_list.csv
library(clusterProfiler)
organism = "org.Hs.eg.db"
library(organism, character.only = TRUE)
# in this overrepresentation analysis, we define DEGs as
# log FC > 2 and padj < 0.05
# reading in input from deseq2
df = read.csv(as.character(file))
# we want the log2 fold change
original_gene_list <- df$log2FoldChange
# name the vector
names(original_gene_list) <- df$X
# omit any NA values
gene_list<-na.omit(original_gene_list)
# sort the list in decreasing order (required for clusterProfiler)
gene_list = sort(gene_list, decreasing = TRUE)
# Exctract significant results (padj < 0.05)
sig_genes_df = subset(df, padj < 0.05)
# From significant results, we want to filter on log2fold change
genes <- sig_genes_df$log2FoldChange
# Name the vector
names(genes) <- sig_genes_df$X
# omit NA values
genes <- na.omit(genes)
# filter on min log2fold change (log2FoldChange > 2)
genes <- names(genes)[abs(genes) > 2]
go_enrich <- enrichGO(gene = genes,
universe = names(gene_list),
OrgDb = organism,
keyType = 'SYMBOL',
readable = T,
ont = "BP",
pvalueCutoff = 0.05,
qvalueCutoff = 0.10,
pAdjustMethod = 'none')
library(enrichplot)
heatplot(go_enrich, showCategory = 5)

heatplot(go_enrich, foldChange=gene_list, showCategory=5)

It works well with me:

In the tutorial, I was wondering if the issue was that it used EntrezIDs whereas I used Symbol. However, my code worked on your computer.
Would you mind showing what you have for:
- sessionInfo()
- go_enrich
- gene_list
sessionInfo() R version 4.2.1 (2022-06-23 ucrt) 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.utf8 LC_CTYPE=Chinese (Simplified)_China.utf8 LC_MONETARY=Chinese (Simplified)_China.utf8 LC_NUMERIC=C LC_TIME=Chinese (Simplified)_China.utf8
attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base
other attached packages: [1] enrichplot_1.17.2.991 org.Hs.eg.db_3.15.0 AnnotationDbi_1.58.0 IRanges_2.30.0 S4Vectors_0.34.0 Biobase_2.56.0 BiocGenerics_0.42.0 clusterProfiler_4.5.3
loaded via a namespace (and not attached):
[1] ggtree_3.4.2 fgsea_1.22.0 colorspace_2.0-3 gson_0.0.7 ellipsis_0.3.2 qvalue_2.28.0 XVector_0.36.0 fs_1.5.2 aplot_0.1.6 farver_2.1.1
[11] remotes_2.4.2 graphlayouts_0.8.1 ggrepel_0.9.1 bit64_4.0.5 scatterpie_0.1.8 fansi_1.0.3 KEGG.db_1.0 codetools_0.2-18 splines_4.2.1 cachem_1.0.6
[21] GOSemSim_2.22.0 polyclip_1.10-0 pkgload_1.3.0 jsonlite_1.8.0 DOyulab.db_0.1.0 GO.db_3.15.0 png_0.1-7 ggforce_0.3.3 shiny_1.7.2 compiler_4.2.1
[31] httr_1.4.4 lazyeval_0.2.2 assertthat_0.2.1 Matrix_1.4-1 fastmap_1.1.0 cli_3.3.0 later_1.3.0 tweenr_2.0.0 htmltools_0.5.3 prettyunits_1.1.1
[41] tools_4.2.1 igraph_1.3.4 gtable_0.3.0 glue_1.6.2 GenomeInfoDbData_1.2.8 reshape2_1.4.4 dplyr_1.0.9 fastmatch_1.1-3 Rcpp_1.0.8.3 vctrs_0.4.1
[51] Biostrings_2.64.0 nlme_3.1-159 ape_5.6-2 ggraph_2.0.6 stringr_1.4.0 ps_1.7.1 mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.1 devtools_2.4.4
[61] DOSE_3.23.2 zlibbioc_1.42.0 MASS_7.3-58.1 scales_1.2.0 tidygraph_1.2.1 promises_1.2.0.1 parallel_4.2.1 RColorBrewer_1.1-3 curl_4.3.2 memoise_2.0.1
[71] gridExtra_2.3 ggfun_0.0.6 ggplot2_3.3.6 downloader_0.4 yulab.utils_0.0.5 stringi_1.7.6 RSQLite_2.2.14 tidytree_0.4.0 pkgbuild_1.3.1 BiocParallel_1.30.3
[81] GenomeInfoDb_1.32.3 rlang_1.0.4 pkgconfig_2.0.3 bitops_1.0-7 lattice_0.20-45 purrr_0.3.4 labeling_0.4.2 treeio_1.20.2 patchwork_1.1.1 htmlwidgets_1.5.4
[91] shadowtext_0.1.2 bit_4.0.4 processx_3.7.0 tidyselect_1.1.2 plyr_1.8.7 magrittr_2.0.3 R6_2.5.1 generics_0.1.3 profvis_0.3.7 DBI_1.1.3
[101] pillar_1.8.0 withr_2.5.0 KEGGREST_1.36.3 RCurl_1.98-1.7 tibble_3.1.8 crayon_1.5.1 utf8_1.2.2 urlchecker_1.0.1 viridis_0.6.2 usethis_2.1.6
[111] grid_4.2.1 data.table_1.14.2 blob_1.2.3 callr_3.7.1 digest_0.6.29 xtable_1.8-4 tidyr_1.2.0 httpuv_1.6.5 gridGraphics_0.5-1 munsell_0.5.0
[121] ggplotify_0.1.0 viridisLite_0.4.0 sessioninfo_1.2.2
This has nothing to do with the version of the software, you should check that you have executed your code correctly.
Thank you! I'm not sure why my code would execute differently. Would you mind showing:
- go_enrich object
- gene_list
I just want to make sure our results after running the enrichment anaylsis are truly the same.
@suekn Please provide your email.