Description Usage Arguments Value Examples
Generates a background model by randomly resampling genes at different 'n' (number of genes) and angles and calculating z distributions
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))
|
barycoords |
Dataframe containing for every gene its barycentric coordinates, as returned by |
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 |
A list containing:
noi: number of genes, in the same order as the elements in backmodels
anglesoi: angles at which weights were calculated using the von-mises distribution
nsamples: number of samples for each n
bw: bandwidth
backmodels: for each n
a second list containing:
angles: mean angle of a sample
z: strength of unidirectional upregulation
weights: weight from von-mises distribution for every sample and angle in anglesoi
, these weights will be used to calculate the p-value
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))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.