来自老大哔哩哔哩-生信技能树的R语言视频-P8 任意基因任意癌症表达量分组的生存分析的学习笔记。如下链接可直接跳转视频https://www.bilibili.com/video/av25643438?p=8
网页工具做生存分析:OncoLnc. 网址:http://www.oncolnc.org/
任意基因任意癌症表达量分组的生存分析
进入OncoLnc
网站,如下图输入感兴趣的基因

如下图所示,可以看到这个BRCA1这个基因在左侧栏中的癌症种类中的Cox regression
结果

在下面生成生存分析图,logrank p-value10的-6次方,显著

点击click Here可以下载数据,自己可以在R中下载。

下载的文件LGG_672_50_50.csv读进Rstudio里面。
用包ggstatplot画图,据说这个包是能画出非常好看的图图,所以很有必要后期在继续学习
a <- read.table('LGG_672_50_50.csv',header = T,sep=',',fill = T)
colnames(a)
dat <- a
library(ggstatsplot)
ggbetweenstats(data=dat,x=Group,y=Expression)

用ggplot2
绘图包进行绘图
ggplot(dat,aes(x=Group,y=Expression))+
geom_point()

同样是ggplot绘图包,加颜色的话仅仅是在aes后面加了函数color = Group
library(ggplot2)
ggplot(dat,aes(x=Group,y=Expression,color = Group))+
geom_point()

另一个绘图包ggpubr
library(ggpubr)
p2 <- ggboxplot(dat, x = "Group", y = "Expression",
color = "Group", palette =c("#00AFBB", "#E7B800"),
add = "jitter")
p2

library(survival)
library(survminer)
table(dat$Status)
dat$Status=ifelse(dat$Status=='Dead',1,0)
sfit <- survfit(Surv(Days,Status)~Group, data=dat)
sfit
summary(sfit)
ggsurvplot(sfit,conf.int = F,pval = TRUE)

网友评论