Diff of /FigS6A_GTEx_CGA_heatmap.R [000000] .. [8e0848]

Switch to unified view

a b/FigS6A_GTEx_CGA_heatmap.R
1
2
# Plot heatmaps of CGA (this study and CTdatabase) using GTEx data (Figure S6A)
3
4
library(data.table)
5
library(ComplexHeatmap)
6
library(RColorBrewer)
7
library(circlize)
8
9
# load data
10
data <- fread(file = "GTEx_Analysis_v6p_RNA-seq_RNA-SeQCv1.1.8_gene_median_rpkm.txt", data.table = F)
11
12
# CGA list
13
genelist <- as.character(read.table("cga.txt")[,1])
14
15
# import list of CTdatabase antigens and merge to GTEX
16
ctdatabase <- as.character(read.table(file = "CTdatabase.txt", header = FALSE)$V1)
17
18
19
# heatmap of Hemap CGAs
20
mat <- data[data$Description%in%genelist,-c(1:2)]
21
rownames(mat) <- data$Description[data$Description%in%genelist]
22
mat <- log2(mat+0.25)
23
colnames(mat) <- gsub("_", " ", gsub(")", "", colnames(data[data$Description%in%genelist,-c(1:2)])))
24
mat <- t(mat) # transpose
25
26
ht1 <- Heatmap(mat,
27
              column_title = "Hemap cancer-germline antigens",
28
              column_title_gp = gpar(fontsize = 9),
29
              name = "Expression (log2 RPKM)", 
30
              col = colorRamp2(seq(log2(0.25), 9, length.out = 9), (brewer.pal(9, "Reds"))),
31
              rect_gp = gpar(col = "white", lty = 1, lwd = 1),
32
              show_row_names = FALSE,
33
              column_names_gp = gpar(fontsize = 6),
34
              cluster_rows = FALSE,
35
              cluster_columns = TRUE,
36
              heatmap_legend_param = list(title_gp = gpar(fontsize = 7, fontface = "bold"),
37
                                          labels_gp = gpar(fontsize = 7),
38
                                          grid_height = unit(0.2, "cm"),
39
                                          grid_width = unit(2, "mm")),
40
              width = unit(7, "cm")
41
)
42
43
44
45
# heatmap of CTdatabase genes
46
47
mat <- data[data$Description%in%ctdatabase,-c(1:2)]
48
rownames(mat) <- data$Description[data$Description%in%ctdatabase]
49
mat <- log2(mat+0.25)
50
colnames(mat) <- gsub("_", " ", gsub(")", "", colnames(data[data$Description%in%genelist,-c(1:2)])))
51
mat <- t(mat) # transpose
52
53
ht2 <- Heatmap(mat,
54
        column_title = "CTdatabase cancer-germline antigens",
55
        column_title_gp = gpar(fontsize = 9),
56
        name = "Expression (log2 RPKM)", 
57
        col = colorRamp2(seq(log2(0.25), 9, length.out = 9), (brewer.pal(9, "Reds"))),
58
        row_names_side = "right", 
59
        row_names_gp = gpar(fontsize = 6),
60
        show_column_names = FALSE,
61
        cluster_rows = FALSE,
62
        cluster_columns = TRUE,
63
        heatmap_legend_param = list(title_gp = gpar(fontsize = 7, fontface = "bold"),
64
                                    labels_gp = gpar(fontsize = 7),
65
                                    grid_height = unit(0.2, "cm"),
66
                                    grid_width = unit(2, "mm")),
67
        width = unit(7, "cm")
68
)
69
70
pdf("FigureS6A_GTEx_CGA_heatmap.pdf", height = 6, width = 10)
71
draw(ht1 + ht2,
72
     gap = unit(0.5, "cm"),
73
     padding = unit(c(1, 1, 0.2, 0.2), "cm"),
74
     heatmap_legend_side = "bottom"
75
)
76
dev.off()