Figure ED1 - Heatmap

This is a heatmap and cluster analysis of the adult bulk RNA sequencing data to show cell type specificity.

tpm <- read.csv("../1.align/expression/TPM.csv", stringsAsFactors = TRUE, row.names = 1)
metadata <- read.csv("metadata.csv", stringsAsFactors = TRUE)
metadata$Trt <- factor(metadata$Trt, levels=c("SAL","LPS"))
metadata$condition1 <- as.factor(paste(metadata$Group, metadata$Region, metadata$Trt, sep = "."))
metadata$condition2 <- factor(paste(metadata$Group, metadata$Trt, sep = "."), levels=c("CON.SAL", "CON.LPS", "MIA.SAL", "MIA.LPS"))
rownames(metadata) <- metadata$ID
all.equal(colnames(tpm), as.character(metadata$ID))
## [1] TRUE
genes <- gsub("\\..*","",rownames(tpm))
symbols <- mapIds(org.Mm.eg.db, keys=genes, column="SYMBOL", keytype="ENSEMBL", multiVals="first")
## 'select()' returned 1:many mapping between keys and columns
log_tpm <- log(tpm+1)
log_tpm$symbol <- symbols

Heatmap

library(pheatmap)
GOI <- c("Hexb", "Tyrobp", "Tmem119", "Fcrls", "Gpr34", "P2ry12", "P2ry13", "Celf4", "Tubb3", "Eno2", "Aqp4", "Gfap", "Aldh1l1", "Mog", "Cldn11", "Olig1", "Lyve1", "Ttr", "Cd163", "Camp", "Cd36", "Clec4d")

p <- log_tpm[match(GOI, log_tpm$symbol),]

pheatmap(p[,1:24], cluster_rows = FALSE, cluster_cols = TRUE, border_color = NA, main = "Heatmap of Cell Type Specific Markers", labels_row = p$symbol)

Cluster

library(ggfortify)
tree = hclust(dist(t(log_tpm[,1:24])), method = "average")
plot(tree, main = "hclust, average log(TPM)", sub="", xlab="", cex.lab = 1, cex.axis = 1, cex.main = 1)

sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] parallel  stats4    stats     graphics  grDevices utils     datasets 
## [8] methods   base     
## 
## other attached packages:
##  [1] ggfortify_0.4.11            pheatmap_1.0.12            
##  [3] org.Mm.eg.db_3.12.0         AnnotationDbi_1.52.0       
##  [5] DESeq2_1.30.1               SummarizedExperiment_1.20.0
##  [7] Biobase_2.50.0              MatrixGenerics_1.2.1       
##  [9] matrixStats_0.58.0          GenomicRanges_1.42.0       
## [11] GenomeInfoDb_1.26.7         IRanges_2.24.1             
## [13] S4Vectors_0.28.1            BiocGenerics_0.36.1        
## [15] cowplot_1.1.1               forcats_0.5.1              
## [17] stringr_1.4.0               dplyr_1.0.6                
## [19] purrr_0.3.4                 readr_1.4.0                
## [21] tidyr_1.1.3                 tibble_3.1.2               
## [23] ggplot2_3.3.3               tidyverse_1.3.1            
## 
## loaded via a namespace (and not attached):
##  [1] bitops_1.0-7           fs_1.5.0               lubridate_1.7.10      
##  [4] bit64_4.0.5            RColorBrewer_1.1-2     httr_1.4.2            
##  [7] tools_4.0.3            backports_1.2.1        bslib_0.2.5.1         
## [10] utf8_1.2.1             R6_2.5.0               DBI_1.1.1             
## [13] colorspace_2.0-1       withr_2.4.2            gridExtra_2.3         
## [16] tidyselect_1.1.1       bit_4.0.4              compiler_4.0.3        
## [19] cli_2.5.0              rvest_1.0.0            xml2_1.3.2            
## [22] DelayedArray_0.16.3    sass_0.4.0             scales_1.1.1          
## [25] genefilter_1.72.1      digest_0.6.27          rmarkdown_2.8         
## [28] XVector_0.30.0         pkgconfig_2.0.3        htmltools_0.5.1.1     
## [31] highr_0.9              fastmap_1.1.0          dbplyr_2.1.1          
## [34] rlang_0.4.11           readxl_1.3.1           rstudioapi_0.13       
## [37] RSQLite_2.2.7          jquerylib_0.1.4        generics_0.1.0        
## [40] jsonlite_1.7.2         BiocParallel_1.24.1    RCurl_1.98-1.3        
## [43] magrittr_2.0.1         GenomeInfoDbData_1.2.4 Matrix_1.3-3          
## [46] Rcpp_1.0.6             munsell_0.5.0          fansi_0.5.0           
## [49] lifecycle_1.0.0        stringi_1.6.2          yaml_2.2.1            
## [52] zlibbioc_1.36.0        blob_1.2.1             grid_4.0.3            
## [55] crayon_1.4.1           lattice_0.20-44        splines_4.0.3         
## [58] haven_2.4.1            annotate_1.68.0        hms_1.1.0             
## [61] locfit_1.5-9.4         knitr_1.33             pillar_1.6.1          
## [64] geneplotter_1.68.0     reprex_2.0.0           XML_3.99-0.6          
## [67] glue_1.4.2             evaluate_0.14          modelr_0.1.8          
## [70] vctrs_0.3.8            cellranger_1.1.0       gtable_0.3.0          
## [73] assertthat_0.2.1       cachem_1.0.5           xfun_0.23             
## [76] xtable_1.8-4           broom_0.7.6            survival_3.2-11       
## [79] memoise_2.0.0          ellipsis_0.3.2