library(RColorBrewer)
library(Seurat)
## Attaching SeuratObject
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(RColorBrewer)
library(pheatmap)
library(ComplexHeatmap)
## Loading required package: grid
## ========================================
## ComplexHeatmap version 2.6.2
## Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
## Github page: https://github.com/jokergoo/ComplexHeatmap
## Documentation: http://jokergoo.github.io/ComplexHeatmap-reference
##
## If you use it in published research, please cite:
## Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
## genomic data. Bioinformatics 2016.
##
## This message can be suppressed by:
## suppressPackageStartupMessages(library(ComplexHeatmap))
## ========================================
## ! pheatmap() has been masked by ComplexHeatmap::pheatmap(). 90% of the arguments
## in the original pheatmap() are identically supported in the new function. You
## can still use the original function by explicitly calling pheatmap::pheatmap().
##
## Attaching package: 'ComplexHeatmap'
## The following object is masked from 'package:pheatmap':
##
## pheatmap
library(ggplot2)
pbmc <- readRDS("/mnt/nectar_volume/home/eraz0001/pbmc_human/pbmcauc.rds")
par(mar=c(1,5,1,1))
display.brewer.all(type="seq")

par(mar=c(1,5,1,1))
display.brewer.all(type="div")

par(mar=c(1,5,1,1))
display.brewer.all(n=10, exact.n=FALSE)

pbmc.markers <- FindAllMarkers(pbmc, only.pos = TRUE, min.pct = 0.25, logfc.threshold = 0.25)
## Calculating cluster C0
## Calculating cluster C1
## Calculating cluster C2
## Calculating cluster C3
## Calculating cluster C4
## Calculating cluster C5
## Calculating cluster C6
## Calculating cluster C7
## Calculating cluster C8
## Calculating cluster C9
pbmc.markers %>%
group_by(cluster) %>%
top_n(n = 10, wt = avg_log2FC) -> top10
mapal <- colorRampPalette(RColorBrewer::brewer.pal(11,"BrBG"))(256)
DoHeatmap(pbmc, features = top10$gene)+ scale_fill_gradientn(colours = rev(mapal))
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.

sessionInfo()
## R version 4.0.2 (2020-06-22)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
##
## Matrix products: default
## BLAS: /mnt/nectar_volume/software/apps/R/4.0.2/lib/R/lib/libRblas.so
## LAPACK: /mnt/nectar_volume/software/apps/R/4.0.2/lib/R/lib/libRlapack.so
##
## locale:
## [1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
## [5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
## [7] LC_PAPER=en_AU.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] grid stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] ggplot2_3.3.6 ComplexHeatmap_2.6.2 pheatmap_1.0.12
## [4] dplyr_1.0.8 SeuratObject_4.0.4 Seurat_4.1.0
## [7] RColorBrewer_1.1-2
##
## loaded via a namespace (and not attached):
## [1] Rtsne_0.15 colorspace_2.0-2 rjson_0.2.21
## [4] deldir_1.0-6 ellipsis_0.3.2 ggridges_0.5.3
## [7] circlize_0.4.14 GlobalOptions_0.1.2 clue_0.3-60
## [10] rstudioapi_0.13 spatstat.data_2.1-2 farver_2.1.0
## [13] leiden_0.3.9 listenv_0.8.0 ggrepel_0.9.1
## [16] fansi_1.0.2 codetools_0.2-16 splines_4.0.2
## [19] knitr_1.39 polyclip_1.10-0 jsonlite_1.7.3
## [22] Cairo_1.5-14 ica_1.0-2 cluster_2.1.3
## [25] png_0.1-7 uwot_0.1.11 shiny_1.7.1
## [28] sctransform_0.3.3 spatstat.sparse_2.1-0 compiler_4.0.2
## [31] httr_1.4.2 assertthat_0.2.1 Matrix_1.4-0
## [34] fastmap_1.1.0 lazyeval_0.2.2 limma_3.46.0
## [37] cli_3.2.0 later_1.3.0 htmltools_0.5.2
## [40] tools_4.0.2 igraph_1.2.11 gtable_0.3.0
## [43] glue_1.6.1 RANN_2.6.1 reshape2_1.4.4
## [46] Rcpp_1.0.8 scattermore_0.7 jquerylib_0.1.4
## [49] vctrs_0.3.8 nlme_3.1-148 lmtest_0.9-39
## [52] xfun_0.30 stringr_1.4.0 globals_0.14.0
## [55] mime_0.12 miniUI_0.1.1.1 lifecycle_1.0.1
## [58] irlba_2.3.5 goftest_1.2-3 future_1.23.0
## [61] MASS_7.3-51.6 zoo_1.8-9 scales_1.1.1
## [64] spatstat.core_2.3-2 promises_1.2.0.1 spatstat.utils_2.3-0
## [67] parallel_4.0.2 yaml_2.2.2 reticulate_1.24
## [70] pbapply_1.5-0 gridExtra_2.3 sass_0.4.0
## [73] rpart_4.1-15 stringi_1.7.6 highr_0.9
## [76] S4Vectors_0.28.1 BiocGenerics_0.36.1 shape_1.4.6
## [79] rlang_1.0.2 pkgconfig_2.0.3 matrixStats_0.61.0
## [82] evaluate_0.15 lattice_0.20-41 ROCR_1.0-11
## [85] purrr_0.3.4 tensor_1.5 labeling_0.4.2
## [88] patchwork_1.1.1 htmlwidgets_1.5.4 cowplot_1.1.1
## [91] tidyselect_1.1.2 parallelly_1.30.0 RcppAnnoy_0.0.19
## [94] plyr_1.8.6 magrittr_2.0.2 R6_2.5.1
## [97] IRanges_2.24.1 generics_0.1.2 DBI_1.1.2
## [100] withr_2.4.3 mgcv_1.8-31 pillar_1.7.0
## [103] fitdistrplus_1.1-6 survival_3.1-12 abind_1.4-5
## [106] tibble_3.1.6 future.apply_1.8.1 crayon_1.4.2
## [109] KernSmooth_2.23-17 utf8_1.2.2 spatstat.geom_2.3-1
## [112] plotly_4.10.0 rmarkdown_2.14 GetoptLong_1.0.5
## [115] data.table_1.14.2 digest_0.6.29 xtable_1.8-4
## [118] tidyr_1.2.0 httpuv_1.6.5 stats4_4.0.2
## [121] munsell_0.5.0 viridisLite_0.4.0 bslib_0.3.1