\HeaderA{toComplex}{Turning a DNA sequence into a vector of complex numbers}{toComplex}
\aliasA{as.complex,DNAString-method}{toComplex}{as.complex,DNAString.Rdash.method}
\aliasA{toComplex,DNAString-method}{toComplex}{toComplex,DNAString.Rdash.method}
\keyword{methods}{toComplex}
\begin{Description}\relax
The \code{toComplex} utility function turns a \LinkA{DNAString}{DNAString} object
into a complex vector.
\end{Description}
\begin{Usage}
\begin{verbatim}
  toComplex(x, baseValues)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] A \LinkA{DNAString}{DNAString} object.

\item[\code{baseValues}] A named complex vector containing the values associated
to each base e.g.
\code{c(A=1+0i, G=0+1i, T=-1+0i, C=0-1i)}

\end{ldescription}
\end{Arguments}
\begin{Value}
A complex vector of the same length as \code{x}.
\end{Value}
\begin{Author}\relax
H. Pages
\end{Author}
\begin{SeeAlso}\relax
\LinkA{DNAString}{DNAString}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
  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)
\end{ExampleCode}
\end{Examples}

