randomSeq               package:GeneR               R Documentation

_C_r_e_a_t_e _r_a_n_d_o_m _s_e_q_u_e_n_c_e

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

     Function _ randomSeq_ creates a random sequence from a
     distribution of nulcleotides, of poly-nucleotides. A real
     composition of nucleotides can be use from function _  compoSeq_,
     with param ' p=TRUE'.

     ShuffleSeq creates a sequence while assembling at random specific
     number of each nucleotides (or poly-nucleotides). These number of
     nucleotide can be provided by function _ compoSeq_, with param
     'p=FALSE': it is then a re-assemblage of all nucleotides (or
     tri-nucleotides, or poly-nucleotides) of a real sequence.

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

     randomSeq(prob = c(0.25, 0.25, 0.25, 0.25, 0), letters = c("T", "C",
     "A", "G", "N"), n )
     shuffleSeq(count,letters=c("T","C","A","G","N"))

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

    prob: A vector of probability weights for obtaining the elements of
          the vector being sampled or a result from compoSeq function
          (with option p=TRUE.

   count: A vector of number of repetitions for each letters (or bi-tri
          nucleotides, must be of same length as letters) or a result
          from compoSeq function     (with option p=FALSE).

 letters: Letters (or bi-tri nucleotides) to be sampled

       n: Integer giving the number of items to choose.

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

     A character string (sequence) or NULL.

_A_u_t_h_o_r(_s):

     A. Lucas

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

     'compoSeq'

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

     ## Set seed of your choice (not requiered)
     set.seed(3)

     ####  ----  RANDOMSEQ  ----
     ## Create a sequence of size 30, GC rich
     randomSeq(prob = c(0.20, 0.30, 0.20, 0.30), letters = c("T", "C","A", "G"), n = 30)
     ## [1] "CTGGAACCGAGGGGTTCATCCCCCCAGTGA"

     ## use with bi-nucleotides
     randomSeq(prob=rep(0.0625,16),letters = c("TT","TC","TA","TG","CT","CC","CA","CG","AT","AC","AA","AG","GT","GC","GA","GG"),n=10)
     ## [1] "CGCATGATCCCAGGCTAACT"

     ####  ----  SHUFFLESEQ  ----
     ## Create a sequence with 7 T, 3 C and A, and 4 G.
     shuffleSeq(count=c(7,3,3,4,0),letters=c("T","C","A","G","N"))
     ## [1] "TATCTTTTGTCGGACGA"

     ## Same with bi-nucleotides
     shuffleSeq(count=c(rep(4,4),rep(2,4),rep(1,4),rep(0,4)),letters = c("TT","TC","TA","TG","CT","CC","CA","CG","AT","AC","AA","AG","GT","GC","GA","GG"))
     ## [1] "TCTTTCCATTCCTTCTAGTGTACCCGTATACGTGTCTGTGTACTTCAACAACTTAT"

     ## From a real sequence:
     seqNcbi("BY608190",file="BY608190.fa")
     readFasta("BY608190.fa")

     ## create a random sequence from a real tri-nucleotides distribution
     ## Size of sequence will be 10*3.
     randomSeq(compoSeq(wsize=3,p=TRUE),n=10)

     ## re assemble real tri-nucleotides of a real sequence
     shuffleSeq(compoSeq(wsize=3,from=1,to=30,p=FALSE))

