# #设置,包括= FALSE ----------------------------------------------------- knitr: opts_chunk设置美元(echo = TRUE) # #——汽车 --------------------------------------------------------------------- 库(sigFeature)库(SummarizedExperiment)数据(ExampleRawData,ExampleRawData包= " sigFeature ") ## ----------------------------------------------------------------------------- x < - t(化验(ExampleRawData)美元数)y < - colData ExampleRawData sampleLabels美元 ## ----------------------------------------------------------------------------- pvals < - sigFeaturePvalue (x, y)嘘(unlist (pvals),休息时间= seq(0、0.08、0.0015),坳=“天蓝色xlab = " p值",ylab =“频率”,主要 ="") ## ----------------------------------------------------------------------------- # 系统。时间(sigfeatureRankedList < - sigFeature (x, y )) ## ----------------------------------------------------------------------------- 数据(sigfeatureRankedList)打印(sigfeatureRankedList [1:10 ]) ## ----------------------------------------------------------------------------- 图书馆(e1071) sigFeature。= svm模型(x [sigfeatureRankedList [1:1000]], y,类型=“C-classification”,内核=“线性”)总结(sigFeature.model ) ## ----------------------------------------------------------------------------- pred < -预测(sigFeature。模型中,x [sigfeatureRankedList[1:1000]])表(pred y ) ## ----------------------------------------------------------------------------- # 系统。时间(featureRankedList < - svmrfeFeatureRanking (x, y))的数据(featureRankedList)打印(“十大功能打印如下:”)打印(featureRankedList [1:10 ]) ## ----------------------------------------------------------------------------- RFE。= svm模型(x [featureRankedList [1:1000]], y,类型=“C-classification”,内核=“线性”)总结(RFE.model ) ## ----------------------------------------------------------------------------- pred < -预测(RFE。模型中,x [featureRankedList[1:1000]])表(pred y ) ## ----------------------------------------------------------------------------- pvalsigFe < - sigFeaturePvalue (x, y, 100, sigfeatureRankedList) pvalRFE < - sigFeaturePvalue (x, y, 100, featureRankedList)标准(mfrow = c(1、2)嘘(unlist (pvalsigFe),休息= 50,坳=“天蓝色”,主要=粘贴(“sigFeature”),xlab = " p值")嘘(unlist (pvalRFE),休息= 50,坳=“天蓝色”,主要=粘贴(“SVM-RFE”),xlab = " p值 ") ## ----------------------------------------------------------------------------- mytitle < -箱线图的箱线图(unlist (pvalsigFe) unlist (pvalRFE),主要= mytitle名称= c(“sigFeature”、“SVM-RFE”),ylab = " p值",ylim = c (min (unlist (pvalsigFe)),马克斯(unlist (pvalRFE))))条形图表(unlist (pvalsigFe),垂直= TRUE,方法=“抖动”,添加= TRUE, pch = 16,坳= c(“绿色”))条形图表(unlist (pvalRFE),垂直= TRUE, = 2, =“抖动”方法,添加= TRUE, pch = 16,坳= c(蓝色))网格(nx = NULL,纽约=零,=“黑人”,上校lty = "点缀 ") ## ----------------------------------------------------------------------------- 库(pheatmap)图书馆(“RColorBrewer”)pheatmap (x [, sigfeatureRankedList[1:20]],规模=“行”,clustering_distance_rows = "相关性 ") ## ----------------------------------------------------------------------------- pheatmap (x [featureRankedList[1:20]],规模=“行”,clustering_distance_rows = "相关 ") ## ----------------------------------------------------------------------------- # = sigFeature set.seed(1234) #结果。拥抱(x, y,“kfold”,10)数据(“结果”)str(结果[1 ]) ## ----------------------------------------------------------------------------- FeatureBasedonFrequency < - sigFeatureFrequency (x,结果,400年,400年,pf = FALSE) str (FeatureBasedonFrequency [1 ]) ## ----------------------------------------------------------------------------- # inputdata < - data.frame (y = as.factor (y), x = x) #运行代码给出波形将需要大量的时间。因此,流程#数据如下所示。# featsweepSigFe = lapp(1:400、sigCVError FeatureBasedonFrequency, inputdata)数据(“featsweepSigFe”)str (featsweepSigFe [1 ]) ## ----------------------------------------------------------------------------- PlotErrors (featsweepSigFe 0, 0.4 ) ## ----------------------------------------------------------------------------- # WritesigFeature(结果,x ) ## ----------------------------------------------------------------------------- sessionInfo ()