n2s                  package:seqinr                  R Documentation

_f_u_n_c_t_i_o_n _t_o _c_o_n_v_e_r_t _t_h_e _n_u_m_e_r_i_c _e_n_c_o_d_i_n_g _o_f _a _D_N_A _s_e_q_u_e_n_c_e
_i_n_t_o _a _v_e_c_t_o_r _o_f _c_h_a_r_a_c_t_e_r_s

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

     By default, if no `levels' arguments is provided, this function
     will just transform your vector of integer into a DNA sequence 
     according to the lexical order: '0 -> "a"', '1 -> "c"', ' 2 ->
     "g"', '3 -> "t"', 'others -> NA'.

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

     n2s(nseq, levels = c("a", "c", "g", "t"), base4 = TRUE)

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

    nseq: A vector of integers 

  levels: the translation vector 

   base4: when this logical is true, the numerical encoding of 'levels'
          starts at 0, when it is false the numerical encoding of 
          'levels' starts at 1.

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

     a vector of characters

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

     J.R. Lobry

_R_e_f_e_r_e_n_c_e_s:

      'citation("seqinr")'

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

     's2n'

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

     ##example of the default behaviour:
     nseq <- sample(x = 0:3, size = 100, replace = TRUE)
     n2s(nseq) 
     # Show what's happen with out-of-range and NA values:
     nseq[1] <- NA
     nseq[2] <- 777
     n2s(nseq)[1:10]
     # How to get an RNA instead:
     n2s(nseq, levels = c("a", "c", "g", "u"))

