从文档看这个包可以用基因表达数据预测表型和药物反应。
这是一个感觉有点古老的包,特别大。
我们先安装它的依赖包:
BiocManager::install(c('sva', 'car', 'genefilter', 'preprocessCore', 'ridge'))
这里 BiocManager 包需要提前安装好,使用
install.packages("BiocManager")
即可。
wget -O pRRophetic_0.5.tar.gz https://osf.io/dwzce/?action=download
下载之后进行安装,在 R 控制台运行命令:
install.packages("pRRophetic_0.5.tar.gz", repos = NULL, dependencies = TRUE)
测试
安装好之后我们需要测试下包能不能正常使用,这里就跟着文档做个几步看看。
先载入包和进行设置:
> library(pRRophetic)
Warning message:
replacing previous import ‘car::Anova’ by ‘genefilter::Anova’ when loading ‘pRRophetic’
> set.seed(1234)
载入数据,画个图看看:
> data("bortezomibData")
> pRRopheticQQplot("Bortezomib")
五折交叉验证,这一点我的电脑有点 hold 不住:
> cvOut <- pRRopheticCV("Bortezomib", cvFold=5, testExprData=exprDataBortezomib)
11683 gene identifiers overlap between the supplied expression matrices...
Found2batches
Adjusting for0covariate(s) or covariate level(s)
Standardizing Data across genes
Fitting L/S model and finding priors
Finding parametric adjustments
Adjusting the Data
1 of 5 iterations complete.
2 of 5 iterations complete.
3 of 5 iterations complete.
4 of 5 iterations complete.
5 of 5 iterations complete.
画个结果图:
> plot(cvOut)
一般般的效果:
模型结果还是显著的:
> summary(cvOut)
Summary of cross-validation results:
Pearsons correlation: 0.4 , P = 4.45287272844977e-12
R-squared value: 0.16
Estimated 95% confidence intervals: -4.23, 4.23
Mean prediction error: 1.64
有了模型就可以做预测了:
> predictedPtype <- pRRopheticPredict(exprDataBortezomib, "Bortezomib",
+ selection=1)
11683 gene identifiers overlap between the supplied expression matrices...
Found2batches
Adjusting for0covariate(s) or covariate level(s)
Standardizing Data across genes
Fitting L/S model and finding priors
Finding parametric adjustments
Adjusting the Data
2324 low variabilty genes filtered.
Fitting Ridge Regression model... Done
Calculating predicted phenotype...Done