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)

