This is the R Markdown for Extended Dat Fig10, which consists of 5 parts.
library("ComplexHeatmap")
library(circlize)
cluster=read.table("Icluster4_sp_126.xls",sep="\t",header=T,stringsAsFactors=F)
rownames(cluster)=cluster$Sample
cluster=cluster[cluster$Sample!="T502",]
pth=read.table("our_pathway_alter_206_Arv_v2.xls",sep="\t",stringsAsFactors=F,header=T,check.names=F)
sorder=cluster$Sample[order(cluster$icluster)]
pth_sub=pth[,sorder]
ht=hclust(dist(pth_sub))
pth_sub=pth_sub[order(rowSums(pth_sub),decreasing=T),]
pth_sub[pth_sub==0]="No"
pth_sub[pth_sub==1]="YES"
#heatmap
ha1 = HeatmapAnnotation(df =data.frame(icluster=cluster[sorder,2]),col = list(icluster = c("1"="#E69F00","2"="#0072B2","3"="forestgreen","4"="red")))
#pdf("Figure6A_v2.pdf",width=20,height = 4)
ht1=Heatmap(as.matrix(pth_sub),top_annotation=ha1,cluster_columns = F,cluster_rows = F,col =c("white","black"),show_column_names = F,show_row_names = T,name="",width=unit(40, "cm"),row_dend_width = unit(20, "mm"),rect_gp = gpar(col="grey"),heatmap_legend_param=list(title = "pathway", color_bar = "discrete"))
draw(ht1)
#dev.off()
pri=read.table("Primary_pathway_alter_114_Arv_v2.xls",sep="\t",header=T,stringsAsFactors=F,row.names=1)
meta=read.table("Metastic_pathway_alter_150_Arv_v2.xls",sep="\t",header=T,stringsAsFactors=F,row.names=1)
our=read.table("our_pathway_alter_206_Arv_v2.xls",sep="\t",header=T,stringsAsFactors=F,row.names=1)
Freq_n=cbind(our[,2],cbind(pri[rownames(our),2],meta[rownames(our),2]))
rownames(Freq_n)=rownames(our)
colnames(Freq_n)=c("CPGEA(206)","Primary(TCGA_CP-114)","Metastic(SU2C-150)")
Freq_n=Freq_n[order(rowSums(Freq_n),decreasing = T),]
#pdf("Extend_figure9_Pathway_alter_cnv_mut_Arv_v2.pdf",height=7,width=16)
bar=barplot(t(Freq_n),beside = T,ylim=c(0,1),col=c("#414487","#B85C23","#D79744"),ylab="Frequency of Alteration",names.arg=rep("",nrow(Freq_n)),main="CNV+Mutation")
text(bar[seq(3,length(bar),by=3)],-0.02,labels = rownames(Freq_n),xpd=T,srt=25,pos=2)
legend("topright",legend = c("CPGEA(206)","Primary(TCGA_CP-114)","Metastic(SU2C-150)"),col=c("#414487","#B85C23","#D79744"),pch=15,bty="n")
#dev.off()
pth_tab=read.table("Pathway_coding_noncoding_change_Arv_v2.xls",sep="\t",check.names = F,header=T,stringsAsFactors=F)
Freq_n=pth_tab[,c(4,2,6)]
Freq_n=Freq_n[order(rowSums(Freq_n),decreasing = T),]
#pdf("Extend_Figure9_pathway_alter_coding_noncoding_Arv_v2.pdf",height=7,width=8)
bar=barplot(t(Freq_n),ylim=c(0,1),col=RColorBrewer::brewer.pal(8, name = "Dark2")[1:3],ylab="Frequency of Alteration",names.arg = rep("",nrow(Freq_n)),main="186 Samples")
text(bar,-0.02,labels = rownames(Freq_n),xpd=T,srt=25,pos=2)
legend("topright",legend =c("Coding_change(cnv+fs+mut)","Coding_Noncoding_change","Noncoding_change(sv+dmr+ncd"),col=RColorBrewer::brewer.pal(8, name = "Dark2")[1:3],pch=15,bty="n")