BAC                   package:BAC                   R Documentation

_B_a_y_e_s_i_a_n _A_n_a_l_y_s_i_s _o_f _C_h_I_P-_c_h_i_p _t_i_l_i_n_g _a_r_r_a_y_s

_D_e_s_c_r_i_p_t_i_o_n:

     Bayesian Analysis of ChIP-chip tiling arrays

_U_s_a_g_e:

     BAC(C, I, B=15000,verbose=FALSE,w=5)

_A_r_g_u_m_e_n_t_s:

       C: The matrix of control measurements. Rows correspond to probes
          and columns to samples.

       I: The matrix of IP measurements. Rows correspond to probes and
          columns to samples.

       B: Number of iterations used the MCMC. Default to 15000.

 verbose: Logical parameter. If TRUE, some progression 

       w: The window size. Default to 5. See details below for more
          about this parameter.

_D_e_t_a_i_l_s:

     The window size should be calculated in function of the resolution
     and the shearing resolution.  For example, for Affymetrix human
     tiling arrays, the shearing resolution is 500-1000bps, the tiling
     resolution is 35bps and the probe length is 25bps.  Then one would
     expect a bound region to contain 500-1000/(35+25)~8-16 probes.
     Thus we decided to set w to 5. Note that the exact value of w is
     not crucial.

_V_a_l_u_e:

     The marginal posterior probabilities and the joint posterior
     probabilities computed from the Bayesian hierarchical model.  We
     recommend using the joint posterior probabilities to call enriched
     regions.

_A_u_t_h_o_r(_s):

     Raphael Gottardo, raph@stat.ubc.ca

_S_e_e _A_l_s_o:

     CallRegions

_E_x_a_m_p_l_e_s:

     # Load the data
     data(ER)
     # Only select the first 5000 probes for speed-up
     ER<-ER[1:5000,]
     # Calculate the joint posterior probabilities
     #Only use 100 iterations for speed up (You should use more! See default value) 
     BAConER<-BAC(ER[,5:7], ER[,2:4], B=100,verbose=FALSE,w=5)
     # For Regions using 0.5 cut-off for the joint posterior probabilities
     ERregions<-CallRegions(ER[,1],BAConER$jointPP,cutoff=0.5,maxGap=500)
     # Create the BED file
     nRegions<-max(ERregions)
     BED<-matrix(0,nRegions,4)
     for(i in 1:nRegions)
     {
     BED[i,2:3]<-range(ER[ERregions==i,1])
     #The score should be between 0 and 1000
     BED[i,4]<-max(BAConER$jointPP[ERregions==i])*1000
     }
     BED<-data.frame(BED)
     # The ER data is a subset of chr 21
     BED[,1]<-"chr21"
     names(BED)<-c("chrom","chromStart","chromEnd","Score")
     # print it
     print(BED)

