Compute t-statistics based on smoothed whole-genome bisulfite
  sequencing data.
  Compute t-statistics based on smoothed whole-genome bisulfite
  sequencing data.
BSmooth.tstat(BSseq, group1, group2,
  estimate.var = c("same", "paired", "group2"), local.correct = TRUE,
  maxGap = NULL, qSd = 0.75, k = 101, mc.cores = 1, verbose = TRUE)
  \item{BSseq}{An object of class \code{BSseq}.}
  \item{group1}{A vector of sample names or indexes for the \sQuote{treatment}
  \item{group2}{A vector of sample names or indexes for the \sQuote{control}
  \item{estimate.var}{How is the variance estimated, see details.}
  \item{local.correct}{A logical; should local correction be used, see
  \item{maxGap}{A scalar greater than 0, see details.}
  \item{qSd}{A scalar between 0 and 1, see details.}
  \item{k}{A positive scalar, see details.}
  \item{mc.cores}{The number of cores used.  Note that setting
    \code{mc.cores} to a value greater than 1 is not supported on MS
    Windows, see the help page for \code{mclapply}.}
  \item{verbose}{Should the function be verbose?}
  T-statistics are formed as the difference in means between group 1 and
  group 2 divided by an estimate of the standard deviation, assuming
  that the variance in the two groups are the same (\code{same}), that
  we have paired samples (\code{paired}) or only estimate the variance
  based on group 2 (\code{group2}).  The standard deviation estimates
  are then smoothed (using a running mean with a width of \code{k}) and
  thresholded (using \code{qSd} which sets the minimum standard
  deviation to be the \code{qSd}-quantile).  Optionally, the
  t-statistics are corrected for low-frequency patterns.

  It is sometimes useful to use \code{local.correct} even if no large
  scale changes in methylation have been found; it makes the marginal
  distribution of the t-statistics more symmetric.

  Additional details in the reference.
  An object of class \code{BSseqTstat}.
  Kasper Daniel Hansen \email{khansen@jhsph.edu}
 KD Hansen, B Langmead, and RA Irizarry.
  \emph{BSmooth: from whole genome bisulfite sequencing reads to
    differentially methylated regions}.
  Genome Biology (2012) 13:R83.
  \code{\link{BSmooth}} for the input object and
  \code{\linkS4class{BSseq}} for its class.
  \code{\linkS4class{BSseqTstat}} describes the return class.  This
  function is likely to be followed by the use of
  \code{\link{dmrFinder}}.  And finally, see the package vignette(s) for
  more information on how to use it.
if(require(bsseqData)) {
  BS.cancer.ex.fit <- updateObject(BS.cancer.ex.fit)
  ## Remember to subset the BSseq object, see vignette for explanation
  BS.tstat <- BSmooth.tstat(BS.cancer.ex.fit[keepLoci.ex,],
                            group1 = c("C1", "C2", "C3"),
                            group2 = c("N1", "N2", "N3"),
                            estimate.var = "group2")
  ## This object is also stored as BS.cancer.ex.tstat in the
  ## bsseqData package

  # An example using a HDF5Array-backed BSseq object
    # See ?SummarizedExperiment::saveHDF5SummarizedExperiment for details
    hdf5_BS.cancer.ex.fit <- saveHDF5SummarizedExperiment(
        x = BS.cancer.ex.fit[keepLoci.ex, ],
        dir = tempfile())
    hdf5_BS.tstat <- BSmooth.tstat(hdf5_BS.cancer.ex.fit,
                                   group1 = c("C1", "C2", "C3"),
                                   group2 = c("N1", "N2", "N3"),
                                   estimate.var = "group2")