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)

