|
a |
|
b/Figures/Heatmap_Figure5C.R |
|
|
1 |
|
|
|
2 |
|
|
|
3 |
################################################ |
|
|
4 |
# File Name:Heatmap_Figure5C.R |
|
|
5 |
# Author: Baoyan Bai |
|
|
6 |
|
|
|
7 |
|
|
|
8 |
################################################# |
|
|
9 |
|
|
|
10 |
###plot heatmap for de-histone genes identified with the new filter (Figure 5C) |
|
|
11 |
###load required libraries |
|
|
12 |
###expression data: output from CIBERSORTx |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
library(pheatmap) |
|
|
16 |
library(dplyr) |
|
|
17 |
library(plyr) |
|
|
18 |
library(RColorBrewer) |
|
|
19 |
setwd("~/Desktop/FL/Ankush_CIBERSORT") |
|
|
20 |
|
|
|
21 |
###import expression data and remove samples not relative |
|
|
22 |
match_names<- read.csv(file="hgnc-symbol-check.csv",sep=";", header=T) |
|
|
23 |
flciber<- read.csv(file="CIBERSORTxHiRes_LM4_protein_coding_fl_Normal_Bcells_Window20.txt",header=T, sep="\t", stringsAsFactors = F) |
|
|
24 |
samples.exp<- flciber[!grepl("BC", names(flciber))] |
|
|
25 |
samples.exp.76<- select(samples.exp,-c("JP6_2", "P34_1", "P35_1")) |
|
|
26 |
|
|
|
27 |
samples.hist.76<- subset(samples.exp.76, Gene %in% match_names$Input) |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
##update gene names |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
samples.hist.76$Gene[match(match_names$Input, samples.hist.76$Gene)]<- match_names$Approved.symbol |
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
hist.new.matrix<- samples.hist.76[,2:77] |
|
|
38 |
row.names(hist.new.matrix)<- samples.hist.76$Gene |
|
|
39 |
|
|
|
40 |
###clinical information |
|
|
41 |
clinic.anno.clean<- read.table(file="clinic_infor.text",sep="\t") |
|
|
42 |
|
|
|
43 |
|
|
|
44 |
###correct P23 POD24 status |
|
|
45 |
clinic.anno.clean$POD24[rownames(clinic.anno.clean)=="P23_1"]<- "No" |
|
|
46 |
clinic.anno.clean$POD24[rownames(clinic.anno.clean)=="P23_2"]<- "No" |
|
|
47 |
clinic.anno.clean$POD24[rownames(clinic.anno.clean)=="P23_3"]<- "No" |
|
|
48 |
|
|
|
49 |
aka3 = list(POD24 = c(No = "grey", Yes="black"), |
|
|
50 |
Type= c(pre = "dark cyan", relapse="#fbb4ae", transform="purple", Naive= "#7570B3",GC="#E7298A", Memory="#66A61E"), |
|
|
51 |
|
|
|
52 |
Group =c(nFL="#998EC3",tFL= "#F1A340", Tonsil="white"), |
|
|
53 |
EZH2=c(Wt = "grey", Mut="black")) |
|
|
54 |
|
|
|
55 |
brewer.pal(n = 8, name = "Dark2") |
|
|
56 |
|
|
|
57 |
#####new colors |
|
|
58 |
paletteLength <- 100 |
|
|
59 |
mycolor<- colorRampPalette(c("blue", "yellow"))(7) |
|
|
60 |
pdf(file="hist_heatmap_20230912_scale_color.pdf", width=10, height=6.5) |
|
|
61 |
pheatmap(log(hist.new.matrix), annotation_col = clinic.anno.clean, annotation_colors = aka3, |
|
|
62 |
fontsize = 6, show_colnames = F, scale ="row", |
|
|
63 |
color = mycolor) |
|
|
64 |
|
|
|
65 |
dev.off() |
|
|
66 |
|
|
|
67 |
###Add mutation status of histone genes |
|
|
68 |
library(reshape) |
|
|
69 |
flreseq<- read.csv(file="../fl_latest/16_combined/fl44_reseq_final_060619.txt", sep="\t",header=T, stringsAsFactors = F) |
|
|
70 |
flreseq.76<-subset(flreseq, SAMPLE %in% names(hist.new.matrix)) |
|
|
71 |
flreseq.76.hist4<- subset(flreseq.76, SYMBOL %in% c("HIST1H1B", "HIST1H1C","HIST1H1D", "HIST1H1E")) |
|
|
72 |
flreseq.76.hist4.coding<- flreseq.76.hist4 %>% filter(Region=="Coding")%>% filter(VARIANT!="Silent") |
|
|
73 |
|
|
|
74 |
|
|
|
75 |
summ.1<-ddply(flreseq.76.hist4.coding, .(SAMPLE, SYMBOL), summarise, n=length(SYMBOL)) |
|
|
76 |
summ.cast<-cast(summ.1, SAMPLE~SYMBOL, value="n") |
|
|
77 |
###samples without mutations |
|
|
78 |
missing.samples<- setdiff(names(hist.new.matrix),summ.cast$SAMPLE) |
|
|
79 |
####add these info to summ.cast |
|
|
80 |
summ.total<- summ.cast %>% add_row(SAMPLE = missing.samples, HIST1H1B = c(NA), HIST1H1C=c(NA), HIST1H1D=c(NA),HIST1H1E=c(NA)) |
|
|
81 |
names(summ.total)<-c("SAMPLE", "H1-5","H1-2","H1-3","H1-4") |
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
summ.total[2:5][!is.na(summ.total[2:5])]<- "Mut" |
|
|
86 |
summ.total[2:5][is.na(summ.total[2:5])]<- "WT" |
|
|
87 |
|
|
|
88 |
his_info<-summ.total[2:5] |
|
|
89 |
row.names(his_info)<- summ.total$SAMPLE |
|
|
90 |
|
|
|
91 |
clinic.all<- merge(clinic.anno.clean, his_info, by="row.names") |
|
|
92 |
clinic.all.clean<- clinic.all[2:9] |
|
|
93 |
row.names(clinic.all.clean)<-clinic.all$Row.names |
|
|
94 |
|
|
|
95 |
aka4 = list(POD24 = c(No = "grey", Yes="black"), |
|
|
96 |
Type= c(pre = "dark cyan", relapse="#fbb4ae", transform="purple", Naive= "#7570B3",GC="#E7298A", Memory="#66A61E"), |
|
|
97 |
|
|
|
98 |
Group =c(nFL="#998EC3",tFL= "#F1A340", Tonsil="white"), |
|
|
99 |
`EZH2`=c(WT = "green", Mut="red"), |
|
|
100 |
`H1-5`=c(WT = "green", Mut="red"), |
|
|
101 |
`H1-2`=c(WT = "green", Mut="red"), |
|
|
102 |
`H1-3`=c(WT = "green", Mut="red"), |
|
|
103 |
`H1-4`=c(WT = "green", Mut="red")) |
|
|
104 |
clinic.all.clean<- clinic.all.clean[, c(6,7,8,5,1,2,3,4)] |
|
|
105 |
names(clinic.all.clean)[5]<-"EZH2" |
|
|
106 |
|
|
|
107 |
pdf(file="hist_heatmap_20230918_scale_color.pdf", width=10, height=6.5) |
|
|
108 |
pheatmap(log(hist.new.matrix), annotation_col = clinic.all.clean, annotation_colors = aka4, |
|
|
109 |
fontsize = 6, show_colnames = F, scale ="row", |
|
|
110 |
color = mycolor) |
|
|
111 |
dev.off() |