survival

作者: 天道昭然 | 来源:发表于2020-02-28 10:43 被阅读0次
      rt=read.table("survivalInput.txt",header=T,sep="\t")
      rt$futime=rt$futime/365       #如果以月为单位,除以30;以年为单位,除以365
      a=rt[,"gene"]<median(rt[,"gene"])
      #median(rt[,"gene"]) > min(rt[,"gene"]))#判断是否只有一组
      diff=survdiff(Surv(futime, fustat) ~a,data = rt)
      pValue=1-pchisq(diff$chisq,df=1)
      pValue=round(pValue,5)
      fit <- survfit(Surv(futime, fustat) ~ a, data = rt)
      summary(fit)    #查看五年生存率
      pdf(file=paste(“gene,".pdf",sep = ""))
      plot(fit, lty = 2:3,col=c("red","blue"),xlab="time (year)",ylab="surival rate",  main=paste("surival curve (p=", pValue ,")",sep=""))
     legend("topright", c(paste("gene," high expression",sep = ""), paste("gene"," low expression",sep = "")), lty = 2:3, col=c("red","blue"))
     dev.off()
    

    相关文章

      网友评论

          本文标题:survival

          本文链接:https://www.haomeiwen.com/subject/giykhhtx.html