generateBackgroundModel: Generate background models

Description Usage Arguments Value Examples

Description

Generates a background model by randomly resampling genes at different 'n' (number of genes) and angles and calculating z distributions

Usage

1
2
3
generateBackgroundModel(barycoords, noi = seq(5, 100, 5),
  anglesoi = seqClosed(0, 2 * pi, 24), nsamples = 1e+05, bw = 20,
  mc.cores = getOption("mc.cores", default = 1))

Arguments

barycoords

Dataframe containing for every gene its barycentric coordinates, as returned by transformBarycentric. Will use the z column as test statistic, or if this column is not given the 'r' column

noi

Integer vector denoting the number of genes at which to sample, the larger the more accurate the p-values

anglesoi

Numeric vector denoting the angles (in radians) at which to pre-calculate null distribution, the larger the more accurate the p-values

nsamples

Number of samples, higher for more accurate and stable p-values

bw

Bandwidth of the von-mises distribution for weighing the samples. A higher bandwidth leads to a more accurate p-value estimate as long as 'nsamples' is high enough

mc.cores

Number of processor cores to use. Due to limitations of the parallel package, this does not work on Windows

Value

A list containing:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
Eoi = matrix(rnorm(1000*3, sd=0.5), 1000, 3, dimnames=list(1:1000, c(1,2,3)))
Eoi[1:100,1] = Eoi[1:100,1] + 1
barycoords = transformBarycentric(Eoi)

hist(barycoords$angle)

bm = generateBackgroundModel(barycoords)

# the distribution of mean angle of the samples is not uniform due to the
# non-uniform distribution of the angles of individual genes
hist(bm$backmodels[[1]]$angles)

# the whole distribution (and therefore also the p-value) also depends on the mean angle
plotdata = data.frame(angle = cut(bm$backmodels[[1]]$angles, 10), z = bm$backmodels[[1]]$z)
ggplot2::ggplot(plotdata) + ggplot2::geom_violin(ggplot2::aes(angle, z))

saeyslab/triwise documentation built on May 29, 2019, 12:56 p.m.