library(grid)
library(circlize)
library(ComplexHeatmap)
sp = read.csv("common_splicing.csv", header=TRUE, sep=,)
psi = read.csv("common_psi.csv", header=TRUE, sep=,)
fpkm = read.csv("common_fpkm.csv", header=TRUE, sep=,)
rownames(sp) = sp$GeneName
sp = subset(sp, select=-GeneName)
rownames(fpkm) = fpkm$GeneName
fpkm = subset(fpkm, select = - GeneName)
df1 = data.frame(type = c(rep("Mutant", 3), rep("Wild Type", 9)))
df2 = data.frame(type = c(rep("Alternative Acceptor", 14), rep("Alternative Donor", 13), rep("Cassette", 110)))
mu_wild1 = HeatmapAnnotation(df = df1, col = list(type = c("Mutant" = "darkseagreen3", "Wild Type" = "khaki")), show_legend = FALSE)
mu_wild2 = HeatmapAnnotation(df = df1, col = list(type = c("Mutant" = "darkseagreen3", "Wild Type" = "khaki")), show_legend = TRUE)
kind = HeatmapAnnotation(df = df2, show_legend = TRUE, col = list(type = c("Alternative Acceptor" = "purple", "Alternative Donor" = "black", "Cassette" = "green")), which = "row")
ha = rowAnnotation(row_barplot = row_anno_barplot(psi, ylim=c(0,100), border = FALSE, bar_width=1, axis=TRUE), width=unit(2,"cm"))
pushViewport(viewport(layout=grid.layout(nr=1, nc=2)))
pushViewport(viewport(layout.pos.row=1, layout.pos.col=1))
ht_list = kind + Heatmap(fpkm, name = "fpkm", column_title = "Gene Expression", cluster_columns = FALSE, cluster_rows = FALSE, show_row_names = TRUE, top_annotation = mu_wild1)
draw(ht_list, newpage=FALSE)
upViewport()
pushViewport(viewport(layout.pos.row = 1, layout.pos.col = 2))
ht_list = Heatmap(sp, name = "psi%", column_title = "Splicing Events", col=colorRamp2(c(0,100), c("blue", "red")), cluster_columns = FALSE, cluster_rows = FALSE, show_row_names = FALSE, top_annotation = mu_wild2) + ha
draw(ht_list, newpage = FALSE)
