Survival analysis of gene expression
1 2 3 4 5 6 7 8 | tcgaSurvival(
cancer,
genes,
dataType = "FPKM",
location = NULL,
isLocalPath = global_env$isLocalPath,
time = 365
)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | library(survival)
library(survminer)
genes <- c("TP53","ELF3","ARID1A")
survival_df <- tcgaSurvival("CHOL",genes)
df_result <- NULL
for(gene in intersect(colnames(survival_df),genes)){
formula <-as.formula(paste0("Surv(days_to_last_followup,Overall_Survival_Status)~",paste0(gene,collapse = "+")))
diff <- survdiff(formula,data = survival_df)
pVal <- 1 -pchisq(diff$chisq,df =1)
pValue <- signif(pVal,4)
df_result <- rbind(df_result,data.frame(gene=gene,pValue=pValue))
}
lapply(genes, function(gene) {
formula <-as.formula(paste0("Surv(days_to_last_followup,Overall_Survival_Status)~",paste0(gene,collapse = "+")))
fit <- surv_fit(formula, data = survival_df)
return(list(fit=fit,expr=survival_df,legend=c("Mutation","Wild"),title=gene))
})%>%
lapply(function(fit){
dev.new()
res <- ggsurvplot(fit$fit, pval=T, risk.table=F,
risk.table.height = 0.3,
data = fit$expr,
xlab="",
pval.size=7,
font.x = c(18),
font.y = c(18),
font.legend=c(18),
legend.title = fit$legend,
legend.labs = fit$legend,
title=fit$title)
print(res)
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.