## Not run: ------------------------------------
# data(expr.norm)
# data(mapping.unique)
#
# dat = expr.norm
# map = mapping.unique
# #map= 1: S/C=1, 2535;
# #map=-1: "empties", 10131;
# #map=-2: "mixed", ambiguous, 13, excluded;
# #map> 1: 1331 nonnulls, S/C > 1.
#
# # in summary,
# #1331 (9.5 percent) nonnulls;
# #and
# #12,666 (90.5 percent) true nulls.
# #---------------------
# dat = as.matrix(dat[map>=-1,])
# map = map[map>=-1]
# #---------------------
#
# y <- log(dat)
# set.seed(123)
# ret <- emmixwire(y,g=3,ncov=3,nvcov=1,n1=3,n2=3,n3=0,
# debug=0,itmax=1000,epsilon=1e-5,nkmeans=5)
#
# ### alternatively,
# #X <- U <- cbind(c(1,1,1,0,0,0),c(0,0,0,1,1,1))
# #m<-6 # m is number of columns
# #V<-diag(m)
# #W <-rep(1,m)
# #ret <- emmixwire(y,g=3,ncov=3,nvcov=1,X=X,W=W,U=U,V=V,
# # debug=0,itmax=1000,epsilon=1e-5,nkmeans=5)
#
# ###calculate the weighted contrast W_j
# wj <- scores.wire(ret)
# names(wj) <- names(map)
# ###top 1000 genes
# wire.1000 <- names(map)[order(abs(wj),decreasing=TRUE)][1:1000]
# ###the number of false non-nulls in the top 1000 genes
# sum(map[wire.1000]==1) + sum( map[wire.1000]==-1)
# #119
#
# ##alternatively
# ### the null distribution of W_j
# wj0 <- wj2.permuted(y,ret,nB=19)
# pv <- pvalue.wire(wj,wj0)
# wire.1000 <- names(map)[order(pv,decreasing=0)][1:1000]
# ###the number of false non-nulls in the top 1000 genes
# sum(map[wire.1000]==1) + sum( map[wire.1000]==-1)
# #119
# hist(pv,50)
#
## ---------------------------------------------
Run the code above in your browser using DataLab