xCODENSE               package:BNArray               R Documentation

_M_i_n_e _c_o_h_e_r_e_n_t _d_e_n_s_e _s_u_b_g_r_a_p_h_s

_D_e_s_c_r_i_p_t_i_o_n:

     Mine coherent dense subgraphs from collections of 1st-order
     network graph sets

_U_s_a_g_e:

     xCODENSE(sumgraph.matrix, boot.ret)

_A_r_g_u_m_e_n_t_s:

sumgraph.matrix: dense summary graph of a set of 1st-order network
          graph 

boot.ret: returned value from 'BootstrapBN' function 

_D_e_t_a_i_l_s:

     xCODENSE mines coherent dense sub-network from a collection of
     directed candidate Bayesian networks  generated by 'BootstrapBN'.

_V_a_l_u_e:

     A dense coherent sub-network is ploted.

_A_u_t_h_o_r(_s):

     Xiaohui Chen cxh1984@interchange.ubc.ca, 
      Kaida Ning aprilnkd@hotmail.com, 
      Ming Chen mchen@zju.edu.cn.

_R_e_f_e_r_e_n_c_e_s:

     Further information about *BNArray* can be found at:
      <URL: http://www.cls.zju.edu.cn/binfo/BNArray>.

_S_e_e _A_l_s_o:

     'MODES',  'HCS', 'MINCUT', 'NCUT'

_E_x_a_m_p_l_e_s:

     library(BNArray)
     data(total.data)
     setwd("/home")

     ##SHOULD call LLSimpute first
     ori.compact<-LLSimpute(total.data$df.all,total.data$df.ori,total.data$n.changed)

     ##Imputing the too bad missing values
     ori.compact<-FinalImpute(ori.compact)

     ##Prepare readily used complete database for constructing Bayesian network
     bn.data<-PrepareCompData(ori.compact)
     n.microarray<-dim(ori.compact)[2]

     ##Do Bayesian network construction
     ##select a subset genes to be modeled
     selected.gene<-c(10:15)
     bn.data<-bn.data[1:(n.microarray-1),selected.gene]
     nw<-network(bn.data)

     ##specify a prior network
     nw.prior<-jointprior(nw,20)
     nw<-getnetwork(learn(nw,bn.data,nw.prior))

     ##perform greedy search
     nw.search<-autosearchEx(nw,bn.data,nw.prior,removecycles=TRUE)

     ##perturb initial network nw with random restarts to avoid local maximum
     nw.heu<-heuristicEx(getnetwork(nw.search),bn.data,nw.prior,removecycles=TRUE,restart=2,degree=10,trylist=gettrylist(nw.search))

     ##highest score network
     nw.best<-getnetwork(nw.heu)
     plot(nw.best,cexscale=3,unitscale=5)

     ##Construct graph data matrix from network objects
     g.matrix<-ConstGraphMatrix(total.data$n.changed,nw.heu,bn.data)
     WriteBN(g.matrix)

     ##Do Bootstraps
     nboot<-3
     boot.ret<-BootstrapBN(bn.data,nboot)
     WriteBootBN(boot.ret)

     #Calculate edge support and build a summary graph
     g.width<-dim(g.matrix)[1]
     sumgraph.matrix<-CalcEdgeSup(boot.ret$g.matrix.list.ret,nboot)
     rownames(sumgraph.matrix)<-c(1:g.width)
     colnames(sumgraph.matrix)<-c(1:g.width)

     #display summary graph
     DisplayGraph(sumgraph.matrix,names(bn.data[1,]))

     #global variable "ret.dengraph.list" for HCS procedure calling with initialization
     ret.dengraph.list<-list()
     n.den.subgraph<-0
     length(ret.dengraph.list)<-g.width

     #global variable for HCS procedure calling with initialization
     ii<-0   #for 1st-order
     jj<-0   #for 2nd-order

     #construct second order graph
     ret.sedord.dengraph.list<-list()
     coh.dengraph.list<-list()
     coh.dengraph.final.list<-list()

     xCODENSE(sumgraph.matrix,boot.ret)

     #convert first-order graph to second-order graph
     n.sedord.den.subgraph<-length(ret.sedord.dengraph.list)
     length(coh.dengraph.list)<-n.den.subgraph       #global variable for HCS procedure calling with initialization
     length(coh.dengraph.final.list)<-n.den.subgraph

