This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to make batch univariate cox analysis for list

I have been trying to make batch univariate cox analysis with apply family and for loops, but I can't edit useful and effective codes. Please, please help me!

I have prepared two kinds of data. Data A, "data_train_list" is a list comprising many data frames. And each column elements in every data frame will serve as independent variables in my codes. Data B, "os_train_list" also is a list including data with data frames. And each data frame in this list will serve as the response variable.

Here are my codes,

for (i in 1:length(data_train_list)) {comb_resBM[[i]]=apply(data_train_list[[i]],2,FUN = function(x){
  coxph(Surv(os_train_list[[i]]$time,os_train_list[[i]]$status)~.,data = data_train_list[[i]] )
})}

I hope finally codes can analyze correctly and effectively, because the data in the analysis is huge actually.

Thanks in advance!

univariate-cox-analysis

1 answer

My Bioconductor package, RegParallel, will do this for you, i.e., it can test each gene independently in a Cox proportional hazards regression model and generate a neat output table for you (and process the variables via parallel processing). See if you can understand how to use it from the vignette (see section 3.4: 3.4 Survival analysis via Cox Proportional Hazards regression

Kevin

Log in to answer this question.