randomIRanges          package:biocDatasets          R Documentation

_R_a_n_d_o_m _I_R_a_n_g_e_s

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

     Create random IRanges

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

     randomIRanges(n, width, from, to, replace = TRUE)

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

       n: number of IRanges 

   width: width for the IRanges 

    from: starting index value for the sequence to be covered by
          IRanges 

      to: ending index value for the sequence to be covered by IRanges 

 replace: sampling with replacement if TRUE (see Details) 

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

     The 'from' and 'to' parameters describe the underlying sequence to
     be covered by the ranges. To prevent having ranges outside the
     sequence, the 'end' of the IRanges returned cannot be greater than
     'end' - 'width'.

     If 'replace' is 'TRUE', several IRanges can have the same starting
     value.

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

     An 'IRanges' object of length 'n'.

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

     'IRanges'

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

     n <- 10
     rir <- randomIRanges(n, 5, 1, 33)

     # ASCII-art view
     reference <- paste("|",
                        paste(rep("-", 33-2), collapse=""),
                        "|",
                        sep = "")
     regions <- vector("character", length=n)
     for (i in 1:n) {
       regions[i] <- paste(
                        paste(rep(" ", start(rir)[i]), collapse=""),
                        paste(rep("-", width(rir)[i]), collapse=""),
                        sep = ""
                        )
     }

     cat(reference, regions, sep="\n")

