toComplex             package:Biostrings             R Documentation

_T_u_r_n_i_n_g _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_o_m_p_l_e_x _n_u_m_b_e_r_s

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

     The 'toComplex' utility function turns a DNAString object into a
     complex vector.

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

       toComplex(x, baseValues)

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

       x: A DNAString object. 

baseValues: A named complex vector containing the values associated to
          each base e.g. 'c(A=1+0i, G=0+1i, T=-1+0i, C=0-1i)' 

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

     A complex vector of the same length as 'x'.

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

     H. Pages

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

     DNAString

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

       seq <- DNAString("accacctgaccattgtcct")
       baseValues1 <- c(A=1+0i, G=0+1i, T=-1+0i, C=0-1i)
       toComplex(seq, baseValues1)

       ## GC content:
       baseValues2 <- c(A=0, C=1, G=1, T=0)
       sum(as.integer(toComplex(seq, baseValues2)))
       ## Note that there are better ways to do this (see ?alphabetFrequency)

