R/avg.abs.genestat.R

Defines functions `avg.abs.genestat`

`avg.abs.genestat` <-
function(gene.res,probes,GS.data)
#gene.res: individual gene result
#probes: probeid
#GS.data: gene set definition data with probe and set variable
{
    ugs<-unique(GS.data[,2])
    ngs<-length(ugs)
    nph<-dim(gene.res)[2]
    res<-matrix(NA,ngs,nph)
    A<-abs(gene.res)
    for (i in 1:ngs)
    {
       gs<-is.element(GS.data[,2],ugs[i])
       in.gs<-is.element(probes,GS.data[gs,1])
       if (sum(in.gs)==1) res[i,] <-mean(A[in.gs,])
       else  res[i,]<-colMeans(A[in.gs,])
    }
    colnames(res)<-colnames(A)
    return(res)
}

Try the PROMISE package in your browser

Any scripts or data that you put into this service are public.

PROMISE documentation built on Nov. 8, 2020, 5:15 p.m.