生信星球培训第九十六期

某个基因与生存相关性曲线绘制

2021-01-12  本文已影响0人  Hayley笔记

某个基因与生存相关性曲线绘制

学习R包ggstatsplotsurvivalsurvminer

rm(list = ls()) 
library(readr)
dat <- read_csv("Desktop/007/BLCA_93663_50_50.csv")
View(dat)
library(ggstatsplot)
#查看高/低表达组的表达情况,x也可以是状态或生存日期等
ggbetweenstats(data=dat,x = Group,  y = 'Expression')
ggsave('Group_Expression_ARHGAP18.png')
Group_Expression_ARHGAP18.png
ggbetweenstats(data=dat,x = Status,  y = 'Expression')
ggsave('Status_Expression_ARHGAP18.png')
Status_Expression_ARHGAP18.png
#生存曲线绘制
library(ggplot2)
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)
ggsave('Survival_ARHGAP18_in_BLCA.png')
Survival_ARHGAP18_in_BLCA.png
ggsurvplot(sfit,palette = c("#E7B800","#2E9FDF"),
           risk.table = TRUE,pval = TRUE,
           conf.int = TRUE,xlab = "Time in months",
           ggtheme = theme_light(),
           ncensor.plot = TRUE)
ggsave('Survival1_ARHGAP18_in_BLCA.png')
Survival1_ARHGAP18_in_BLCA.png
上一篇 下一篇

猜你喜欢

热点阅读