Using pushViewport()
library(grid)
library(circlize)
## ========================================
## circlize version 0.4.5
## CRAN page: https://cran.r-project.org/package=circlize
## Github page: https://github.com/jokergoo/circlize
## Documentation: http://jokergoo.github.io/circlize_book/book/
##
## If you use it in published research, please cite:
## Gu, Z. circlize implements and enhances circular visualization
## in R. Bioinformatics 2014.
## ========================================
library(ComplexHeatmap)
## ========================================
## ComplexHeatmap version 1.20.0
## Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
## Github page: https://github.com/jokergoo/ComplexHeatmap
## Documentation: http://bioconductor.org/packages/ComplexHeatmap/
##
## If you use it in published research, please cite:
## Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional
## genomic data. Bioinformatics 2016.
## ========================================
sp = read.csv("GMSD_BCR_SP.csv", header=TRUE, sep=,)
psi = read.csv("GMSD_BCR_PSI.csv", header=TRUE, sep=,)
fpkm = read.csv("GMSD_BCR_FPKM.csv", header=TRUE, sep=,)
head(sp)
## GeneID X0h X2h X6h X24h
## 1 RAF1 15.38 65.00 92.86 79.10
## 2 RELA 8.33 45.45 84.62 62.96
## 3 PIK3CD 0.00 30.77 75.00 31.25
## 4 PTK2B 0.00 13.64 64.71 8.57
## 5 NFKB2 8.00 20.00 70.59 39.29
## 6 CSK 1.85 17.24 63.41 15.38
head(psi)
## GeneID Delta_PSI
## 1 RAF1 77.48
## 2 RELA 76.29
## 3 PIK3CD 75.00
## 4 PTK2B 64.71
## 5 NFKB2 62.59
## 6 CSK 61.56
head(fpkm)
## GeneID X0h X2h X6h X24h
## 1 RAF1 100 96.89236 113.20271 194.39072
## 2 RELA 100 74.89186 64.47093 119.74007
## 3 PIK3CD 100 68.94503 48.44750 112.38037
## 4 PTK2B 100 70.56294 25.78487 45.47887
## 5 NFKB2 100 66.12597 31.09668 49.06694
## 6 CSK 100 73.98361 45.22943 48.34104
rownames(sp) = sp$GeneID
rownames(psi) = psi$GeneID
rownames(fpkm) = fpkm$GeneID
sp = subset(sp, select=-GeneID)
psi = subset(psi, select=-GeneID)
fpkm = subset(fpkm, select=-GeneID)
h_sp = Heatmap(sp, col=colorRamp2(c(0,100), c("blue", "red")), column_title = "GMSD BCR Splicing Events", show_row_names = TRUE, cluster_columns = FALSE, cluster_rows = FALSE)
h_fpkm = Heatmap(fpkm, col=colorRamp2(c(0,260), c("blue", "red")), column_title = "GMSD BCR Gene Expression", show_row_names = TRUE, cluster_columns = FALSE, cluster_rows = FALSE)
h_hist = 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))
draw(h_fpkm, newpage=FALSE)
upViewport()
pushViewport(viewport(layout.pos.row=1, layout.pos.col=2))
h_sp_psi = 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) + h_hist
draw(h_sp_psi, newpage = FALSE)
