R语言-影像组学数据处理

使用R语言对影像组学数据进行处理

测试数据

library(caret);library(glmnet);library(pROC)
set.seed(123456)
data <- read.csv("data.csv", header = T)
p.data <- preProcess(data[,-1],method = c("center","scale","corr")) 
P.data <- predict(p.data,newdata = data[,-1])
lasso.x <- as.matrix(P.data);lasso.y <- as.matrix(data[,1])
lasso.cv <- cv.glmnet(x = lasso.x,y = lasso.y,family = "binomial",type.measure = "auc")  
lasso <- glmnet(x = lasso.x,y = lasso.y,family = "binomial")
number <- which(coef(lasso,s = lasso.cv$lambda.min) != 0)   
signature <- colnames(P.data[number - 1])
print(signature)
rad.model <- glm(y~.,data = data.frame(y = data[,1], data[signature]))
radscore <- predict(rad.model) 
roc(data[,1],radscore)

运行结果:筛选出27个特征,总体诊断性能0.9974

 [1] "T2_original_glcm_Id"                                 "T2_original_glrlm_LongRunLowGrayLevelEmphasis"      
 [3] "T2_original_glszm_SmallAreaEmphasis"                 "T2_original_glszm_SmallAreaLowGrayLevelEmphasis"    
 [5] "DWI_original_firstorder_Kurtosis"                    "DWI_original_firstorder_Skewness"                   
 [7] "DWI_original_firstorder_Variance"                    "DWI_original_glrlm_LongRunEmphasis"                 
 [9] "DWI_original_glrlm_RunLengthNonUniformityNormalized" "DWI_original_glrlm_RunPercentage"                   
[11] "DWI_original_glrlm_RunVariance"                      "DWI_original_glrlm_ShortRunHighGrayLevelEmphasis"   
[13] "DWI_original_glszm_GrayLevelNonUniformity"           "DWI_original_glszm_LowGrayLevelZoneEmphasis"        
[15] "DWI_original_glszm_SizeZoneNonUniformity"            "DWI_original_glszm_ZonePercentage"                  
[17] "ADC_original_firstorder_90Percentile"                "ADC_original_firstorder_Kurtosis"                   
[19] "ADC_original_glcm_Contrast"                          "ADC_original_glcm_InverseVariance"                  
[21] "ADC_original_glcm_MaximumProbability"                "ADC_original_glrlm_LongRunLowGrayLevelEmphasis"     
[23] "ADC_original_glrlm_RunVariance"                      "ADC_original_glszm_LargeAreaLowGrayLevelEmphasis"   
[25] "ADC_original_shape_Elongation"                       "ADC_original_shape_Flatness"                        
[27] "ADC_original_shape_Sphericity"                      


Setting levels: control = 0, case = 1
Setting direction: controls < cases

Call:
roc.default(response = data[, 1], predictor = radscore)

Data: radscore in 127 controls (data[, 1] 0) < 127 cases (data[, 1] 1).
Area under the curve: 0.9974

你可能感兴趣的:(生信R语言)