]> git.donarmstrong.com Git - rsem.git/blob - EBSeq/R/LikefunMulti.R
Included EBSeq for downstream differential expression analysis
[rsem.git] / EBSeq / R / LikefunMulti.R
1 LikefunMulti <-
2 function(ParamPool, InputPool)
3 {
4
5 NoneZeroLength=InputPool[[4]]
6 AlphaIn=ParamPool[1]
7 BetaIn=ParamPool[2:(1+NoneZeroLength)]
8 PIn=ParamPool[(2+NoneZeroLength):length(ParamPool)]
9 PInAll=c(1-sum(PIn),PIn)
10 ZIn=InputPool[[3]]
11 Input=InputPool[[2]]
12 InputSP=InputPool[[1]]
13 RIn=InputPool[[5]]
14 RInSP=InputPool[[6]]
15 NumIn=InputPool[[7]]
16 AllParti=InputPool[[8]]
17 PInMat=matrix(rep(1,nrow(Input)),ncol=1)%*%matrix(PInAll,nrow=1)
18 ##Function here
19 FList=sapply(1:nrow(AllParti),function(i)sapply(1:nlevels(as.factor(AllParti[i,])),
20                                                 function(j)f0(do.call(cbind,InputSP[AllParti[i,]==j]),AlphaIn, BetaIn, 
21                                         do.call(cbind,RInSP[AllParti[i,]==j]), NumIn, log=T)),
22                                                 simplify=F) 
23 FPartiLog=sapply(FList,rowSums)
24 #FMat=exp(FPartiLog)
25 FMat=FPartiLog
26 -sum(ZIn*(FMat+log(PInMat)))
27 }
28