# R script to generate heatmap data from RPKM analysis of respiratorty genes # Lots of help from these two sites: # https://bioconductor.statistik.tu-dortmund.de/packages/3.1/bioc/vignettes/ComplexHeatmap/inst/doc/ComplexHeatmap.html # http://www.sthda.com/english/wiki/static-and-interactive-heatmap-in-r-unsupervised-machine-learning # clear existing settings and data rm(list=ls()) # required libraries require(ComplexHeatmap) #require(RColorBrewer) data <- read.csv("~/Dropbox/Thrash_Lab/GoM_hypoxia_assemblies/Manuscript/supplemental_information/resp_gene_RPKM3.csv", header=T, row.names = 1) # Ignore text columns in the heatplot dat.tmp <- data dat.tmp$Bin <- NULL dat.tmp$Group <- NULL dat.tmp$System <- NULL # Plot three separate layers- the heatplot, the system annotations, and the bin designations Heatmap(dat.tmp, width = unit(8, "cm"), name = "Gene RPKM", row_names_side = "left", row_names_gp = gpar(fontsize = 7), col = colorRampPalette(c("lightyellow", "blue"))(52), #column_title = "Samples", column_title_side = "bottom", #row_title = "Gene RPKM", cluster_rows = FALSE, cluster_columns = FALSE, split = data$System, combined_name_fun = NULL ) + Heatmap(data$System, name="Process", col=c("aerobic respiration"="cyan", "DNRA"="maroon", "N2O reduction"="purple", "nitrate reduction"="red", "nitrite reduction"="magenta", "sulfur reduction"="orange"), width = unit(6, "mm") ) + Heatmap(data$Group, name="Group", col=c("SAR202"="grey","SAR406"="blue", "MGII"="dark green", "ACD39"="yellow", "PAUC34f"="pink"), #col=c("43-1"="grey","43-2"="grey","43"="grey","45"="blue","45-1"="blue","45-2"="blue","51-1"="blue", # "15"="dark green","17"="dark green","14"="dark green","18"="dark green","38"="dark green", # "13"="yellow","50"="pink","48"="pink"), width = unit(6, "mm") )