#' function to calculate the homogeneity P value faster
#' @param QSarray A QSarray object, as generated by aggregateGeneSet and possibly modified by calcVIF
#' @param CompareWithZero Logical, if TRUE compares with mean of zero, else with mean of pathway
#' @export
#' @return p values faster
absoluteTest.genePvalsFAST<-function(QSarray, ##A QSarray object, as generated by aggregateGeneSet and possibly modified by calcVIF
CompareWithZero=TRUE ###Logical, if TRUE compares with mean of zero, else with mean of pathway
){
if(is.null(QSarray$pathways)){stop("Pathway Information not found. Please provide a list of gene sets.")}
geneSets = QSarray$pathways
Means = QSarray$mean
SD = QSarray$SD
DOF=QSarray$dof
Ps = list()
for(i in 1:length(geneSets)){
Indexes = geneSets[[i]]
if(length(Indexes)!=0){
PS<-NULL
PS<-sapply(Indexes,function(j){
SUBSTRACT=0
if(!CompareWithZero)SUBSTRACT=QSarray$path.mean[i]
p<-pt((Means[j]-SUBSTRACT)/SD[j],DOF[j])
p[which(p>0.5)] = -1+p[which(p>0.5)] ### turn it into a two-tailed p
p = p*2
return(p)
})
Ps[[i]]<-PS
}
}
names(Ps) = names(geneSets)
return(Ps)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.