\HeaderA{error.correction}{Estimate sequencing errors and compute corrected counts}{error.correction}
\aliasA{compute.sequence.neighbors}{error.correction}{compute.sequence.neighbors}
\aliasA{em.estimate.error.given}{error.correction}{em.estimate.error.given}
\aliasA{estimate.errors.mean}{error.correction}{estimate.errors.mean}
\keyword{error}{error.correction}
\begin{Description}\relax
These functions are used to compute sequencing error correction in a
library. They are automatically called when extracting tags from
sequences and therefore usually do not have to be called directly.
\end{Description}
\begin{Usage}
\begin{verbatim}
estimate.errors.mean(lib)
compute.sequence.neighbors(tags, taglength=10, quality.scores=NULL,
                           output="character") 
em.estimate.error.given(lib, maxstep=50, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{lib}] A sage library object
\item[\code{tags}] A character vector or numeric vector containing tags
\item[\code{taglength}] length of tag
\item[\code{quality.scores}] A matrix containing base quality scores as -10
log10 Pe
\item[\code{maxstep}] iterations of EM algorithm
\item[\code{output}] Output type for \code{compute.sequence.neighbors},
either character or numeric
\item[\code{...}] Other arguments ignored.
\end{ldescription}
\end{Arguments}
\begin{Author}\relax
Tim Beissbarth
\end{Author}
\begin{References}\relax
\url{http://tagcalling.mbgproject.org}
\end{References}
\begin{SeeAlso}\relax
\code{\LinkA{extract.lib}{extract.lib}},
\code{\LinkA{sage.library}{sage.library}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
library(sagenhaft)
B6Hypo <-read.sage.library(system.file("data/B6HypothalHFI.sage",
                           package="sagenhaft")) 
E15post <- read.sage.library(system.file("data/E15postHFI.sage",
                             package="sagenhaft")) 
testlib <- combine.libs(B6Hypo, E15post)
testlib <- estimate.errors.mean(testlib)
testlib <- em.estimate.error.given(testlib)
tagneighbors <- compute.sequence.neighbors(testlib$seqs[,"seq"], 10,
                          testlib$seqs[,paste("q", 1:10, sep="")]) 
\end{ExampleCode}
\end{Examples}

