library(angelare)
library(Biobase)
data(normal.prot.eset)
data(normal.mrna.eset)
Scaling, imputation etc
prepDat <- function(eset){
exprs(eset) <- t(scale(t(exprs(eset))))
eset
}
normal.prot.eset=prepDat(normal.prot.eset)
normal.mrna.eset=prepDat(normal.mrna.eset)
R2 for mRNA-only models
getR2 <- function(obj1, obj2){
pearson.normal = diag(cor(obj1, obj2, use="complete.obs"))
pearson.normal^2
}
r2.normal=getR2(exprs(normal.prot.eset), exprs(normal.mrna.eset))
R2 for permuted models
r2.normal.perm = replicate(100, getR2(exprs(normal.prot.eset), exprs(normal.mrna.eset)[, sample(1:ncol(normal.mrna.eset))]))