首先調(diào)取Xena網(wǎng)頁的TCGA數(shù)據(jù)做Cox生存分析,數(shù)據(jù)可以通過hiplot官網(wǎng)自主研發(fā)的ucsc-xena-shiny直接在線獲取
訪問https://hiplot.com.cn/advance/ucsc-xena-shiny
然后全屏
顯示,點擊Qucik PanCan Analysis
下方的TCGA:Molcular Profile Cox Analysis
輸入一個你想要的基因丹弱,比如RAC3
妄荔,Select Measure for plot
可以設置OS
咧党,PFI
呛谜,DSS
和DFI
,然后點上方的搜索??鸯檬,就可以看到出的圖了
繼續(xù)往下滾動鼠標,就可以看到數(shù)據(jù)了螺垢,而且還可以下載
得到數(shù)據(jù)以后就可以用R畫圖了喧务,注意赖歌,這里的HR和CI都是Log過的結果,跟別的地方計算的Cox結果有些不一樣功茴,可能是方法不一樣吧庐冯,是因為網(wǎng)站計算的HR結果相差太大了嗎?
由于是log過的結果坎穿,所以森林圖的X軸不再是HR=1為分界線了展父,而是以log2HR=
0
為分界線。玲昧。栖茉。
unicox <- read_csv("~/Desktop/RAC3_mRNA_OS_pancan_unicox.csv") ##加載csv數(shù)據(jù)
library(ggplot2)
ggplot(RAC3_mRNA_OS_pancan_unicox, aes(HR_log, cancer, col=Type))+ ##定義X軸和Y軸,以類型分類
geom_point(size=2.5)+ #固定點的大小
geom_errorbarh(aes(xmax =upper_95_log, xmin = lower_95_log), height = 0.4)+ ##設置95%CI區(qū)間酌呆,就是誤差線
scale_x_continuous(limits= c(-2, 2), breaks= seq(-1, 1, 1))+ ##設置X軸范圍衡载,分割點從-1到1,以1為分界隙袁,具體分界看數(shù)字分布
geom_vline(aes(xintercept = 0))+ #以0為分界線
xlab('HR(95%CI)') + ylab(' ')+ #定義標簽
theme_bw(base_size = 12)+ #主題和字體
scale_color_manual(values = c("gray", "steelblue", "red")) #設置顏色
ggplot(RAC3_mRNA_OS_pancan_unicox, aes(HR_log, cancer, col=Type,shape=Type))+ #設置不同的形狀
geom_point(size=3)+
geom_errorbarh(aes(xmax =upper_95_log, xmin = lower_95_log), height = 0.4)+
scale_x_continuous(limits= c(-2, 2), breaks= seq(-1, 1, 1))+
geom_vline(aes(xintercept = 0))+
xlab('HR(95%CI)') + ylab(' ')+
theme_bw(base_size = 12)+
scale_color_manual(values = c("gray", "steelblue", "red"))
# 以-log10P值定義點的大小痰娱,點越大,P值越小菩收,越有統(tǒng)計學意義
ggplot(RAC3_mRNA_OS_pancan_unicox, aes(HR_log, cancer, col=Type,shape=Type))+
geom_point(aes(size=-log10(p.value)))+
geom_errorbarh(aes(xmax =upper_95_log, xmin = lower_95_log), height = 0.4)+
scale_x_continuous(limits= c(-2, 2), breaks= seq(-1, 1, 1))+
geom_vline(aes(xintercept = 0))+
xlab('HR(95%CI)') + ylab(' ')+
theme_bw(base_size = 12)+
scale_color_manual(values = c("gray", "steelblue", "red"))
再加一個形狀
ggplot(RAC3_mRNA_OS_pancan_unicox, aes(HR_log, cancer, col=Type,shape=Type))+
geom_point(aes(size=-log10(p.value)))+
geom_errorbarh(aes(xmax =upper_95_log, xmin = lower_95_log), height = 0.4)+
scale_x_continuous(limits= c(-2, 2), breaks= seq(-1, 1, 1))+
geom_vline(aes(xintercept = 0))+
xlab('HR(95%CI)') + ylab(' ')+
theme_bw(base_size = 12)+
scale_color_manual(values = c("gray", "steelblue", "red"))
#排個序可好
ggplot(RAC3_mRNA_OS_pancan_unicox, aes(HR_log, reorder(cancer,HR_log), col=Type,shape=Type))+
geom_point(aes(size=-log10(p.value)))+
geom_errorbarh(aes(xmax =upper_95_log, xmin = lower_95_log), height = 0.4)+
scale_x_continuous(limits= c(-2, 2), breaks= seq(-1, 1, 1))+
geom_vline(aes(xintercept = 0))+
xlab('HR(95%CI)') + ylab(' ')+
theme_bw(base_size = 12)+
scale_color_manual(values = c("gray", "steelblue", "red"))
##換個排序也行
ggplot(RAC3_mRNA_OS_pancan_unicox, aes(HR_log, reorder(cancer,-HR_log), col=Type,shape=Type))+
geom_point(aes(size=-log10(p.value)))+
geom_errorbarh(aes(xmax =upper_95_log, xmin = lower_95_log), height = 0.4)+
scale_x_continuous(limits= c(-2, 2), breaks= seq(-1, 1, 1))+
geom_vline(aes(xintercept = 0))+
xlab('HR(95%CI)') + ylab(' ')+
theme_bw(base_size = 12)+
scale_color_manual(values = c("gray", "steelblue", "red"))
更多定制梨睁,等你發(fā)現(xiàn)。娜饵。坡贺。