I am using the survival package in R and have a panel of genes that I want to use to determine if these group of genes affect survival.
I towards the end and want to produce the graph, but I keep getting one line graph with what appears confidence lines flanking it.
Has anyone used it for a panel of genes and was able to produce the graph?
Here is my code:
plot(survfit(coxph(Surv(as.numeric(as.character(all_clin$new_death))[ind_clin],all_clin$death_event[ind_clin]) ~ event_rna[ind_gene,ind_tum]
+ event_rna[ind_gene4,ind_tum]
+ event_rna[ind_gene5,ind_tum]
+ event_rna[ind_gene6,ind_tum]
+ event_rna[ind_gene7,ind_tum]
+ event_rna[ind_gene10,ind_tum]
+ event_rna[ind_gene11,ind_tum]
+ event_rna[ind_gene13,ind_tum]
+ event_rna[ind_gene14,ind_tum]
+ event_rna[ind_gene15,ind_tum]
+ event_rna[ind_gene16,ind_tum]
+ event_rna[ind_gene17,ind_tum]
+ event_rna[ind_gene18,ind_tum]
+ event_rna[ind_gene19,ind_tum]
+ event_rna[ind_gene20,ind_tum]
+ event_rna[ind_gene21,ind_tum]
+ event_rna[ind_gene22,ind_tum]
+ event_rna[ind_gene23,ind_tum]
+ event_rna[ind_gene24,ind_tum]
+ event_rna[ind_gene25,ind_tum]
+ event_rna[ind_gene26,ind_tum]
+ event_rna[ind_gene27,ind_tum]
+ event_rna[ind_gene28,ind_tum]),
col=c("Black","Green","Red"), frame=F, lwd=2,main=paste('Breast
Cancer-TCGA',rownames(z_rna)[ind_gene],sep='\n'), xlim=c(0,10000),
xlab = "Time (days)", ylab = "Survival Probability"))
My apologies...I am a newbie to the package survival and R.
Hi Kevin,
Thank you so much for answering!
I will include my whole code. Basically, I got mRNA-seq data from TCGA (Fire Browser). I followed the instructions from this link (https://www.biostars.org/p/153013/). However, this looks at single genes at a time. So, thankfully the survival package includes cox.
Code:
Sorry, needed to put the rest of the code in another comment 'cuz I reached the max of characters.
the panel of genes came from some analysis from my lab. I included only 4 genes just to simplify it. I get the following graph:
https://flic.kr/p/2hvMBui
Thank you for all of the code. This may just be an issue with encoding. For example, what is the output of
event_rna[ind_gene,ind_tum]
and how is it encoded (numerically, categorically, or text characters)?Also, I think that this should be numerical:
I tested my own tutorial, and it should be fine where you specify 2 or more genes in the model: Survival analysis with gene expression