setRectRegion           package:affyContam           R Documentation

_s_e_t _a _r_e_c_t_a_n_g_u_l_a_r _o_r _c_i_r_c_u_l_a_r _r_e_g_i_o_n _i_n _a_n _a_f_f_y_b_a_t_c_h _t_o _a
_s_p_e_c_i_f_i_e_d _s_e_t _o_f _v_a_l_u_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     set a rectangular or circular region in an affybatch to a
     specified set of values

_U_s_a_g_e:

     setRectRegion(x, chip=1, xinds=251:350, yinds=251:350, vals=10, valgen=NULL)
     setCircRegion(x, chip=1, center=c(350,350), rad=100, vals=10, valgen=NULL)
     getRectRegion(x, chip=1, xinds=251:350, yinds=251:350)
     getCircRegion(x, chip=1, center=c(350,350), rad=100)

_A_r_g_u_m_e_n_t_s:

       x: AffyBatch instance 

    chip: sample index 

   xinds: x coordinates to be contaminated 

   yinds: y coordinates to be contaminated 

    vals: values to be assigned to rectangle elements 

  center: geometric center of circle to be altered 

     rad: radius of circle to be altered, in xy units of the chip
          addressing system used by xy2indices in the cdf package

  valgen: function of parameter n that generates n values to be
          inserted in the altered region 

_V_a_l_u_e:

     set* functions return AffyBatch instance with intensities modified
     as requested

     get* functions return numeric vectors of intensities as requested.

_A_u_t_h_o_r(_s):

     Vince Carey <stvjc@channing.harvard.edu>

_E_x_a_m_p_l_e_s:

     library(affydata)
     data(Dilution)
     opar = par(no.readonly=TRUE)
     par(mfrow=c(2,2))
     hist(Dilution, main="original")
     image(Dilution[,1], main="original")
     #
     # we will contaminate in two ways: thin line at fixed low intensity, and 
     # circular blob at moderate random intensity
     #
     ab = setRectRegion(Dilution, 1, xinds=25:30, yinds=1:620,
       vals=10)
     ab = setCircRegion(ab, 1, valgen=function(n){
        rnorm(n, 350,50)})
     hist(ab, main="chip 1 contaminated by normal")
     image(ab[,1], main="chip 1 contaminated")
     ex = getCircRegion(Dilution, 1)
     length(ex)
     ab = setCircRegion(Dilution, 1, vals=pmin(2*ex,65535))
     image(ab[,1], main="chip 1 contaminated by doubling")
     par(opar)

