get_tstats: Get t-Statistics

View source: R/get_tstats.R

get_tstatsR Documentation

Get t-Statistics

Description

This function calculates a moderated t-Statistic per site or tuple using limma's lmFit and eBayes functions. It then smoothes the obtained t-Statistics using bumphunter's smoother function.

Usage

get_tstats(
  sa,
  design,
  contrast = NULL,
  method = "ls",
  trend = FALSE,
  smooth = FALSE,
  maxGap = 20,
  coef = 2,
  verbose = TRUE,
  filter = TRUE,
  ...
)

Arguments

sa

A SummarizedExperiment containing ASM values where each row and column correspond to a tuple/site and sample respectively.

design

a design matrix created with model.matrix.

contrast

a contrast matrix, generated with makeContrasts.

method

The method to be used in limma's lmFit. The default is set to 'ls' but can also be set to 'robust', which is recommended on a real data set.

trend

Passed to eBayes. Should an intensity-trend be allowed for the prior variance? Default is that the prior variance is constant, e.g. FALSE.

smooth

Whether smoothing should be applied to the t-Statistics. Default = FALSE. If TRUE, wherever smoothing is not possible, the un-smoothed t-stat is used instead.

maxGap

The maximum allowed gap between genomic positions for clustering of genomic regions to be used in smoothing. Default = 20.

coef

Column in model.matrix specifying the parameter to estimate. Default = 2. If contrast specified, column with contrast of interest.

verbose

Set verbose. Default = TRUE.

filter

Remove empty tstats. Default = TRUE.

...

Arguments passed to loessByCluster. Only used if smooth = TRUE.

Details

The smoothing is done on genomic clusters consisting of CpGs that are close to each other. In the case of tuples, the midpoint of the two genomic positions in each tuple is used as the genomic position of that tuple, to perform the smoothing.The function takes a RangedSummarizedExperiment generated by calc_derivedasm or calc_asm containing ASM across samples, and the index of control and treatment samples.

Value

A vector of t-Statistics within the RangedSummarizedExperiment.

Examples

data(readtuples_output)
ASM <- calc_asm(readtuples_output)
grp <- factor(c(rep('CRC',3),rep('NORM',2)), levels = c('NORM', 'CRC'))
mod <- model.matrix(~grp)
tstats <- get_tstats(ASM, mod)


markrobinsonuzh/DAMEfinder documentation built on April 7, 2023, 6:37 a.m.