plotNull: Plot the empirically estimated null distribution and...

View source: R/plot.R

plotNullR Documentation

Plot the empirically estimated null distribution and associated p-values

Description

This function takes the results from function generateNull() and plots the density curves of permuted scores for the provided samples via sampleNames parameter. It can plot null distribution(s) for a single sample or multiple samples.

Usage

plotNull(
  permuteResult,
  scoredf,
  pvals,
  sampleNames = NULL,
  cutoff = 0.01,
  textSize = 2,
  labelSize = 5
)

Arguments

permuteResult

A matrix, null distributions for each sample generated using the generateNull() function

scoredf

A dataframe, singscores generated using the simpleScore() function

pvals

A vector, estimated p-values using the getPvals() function permuteResult,scoredf and pvals are the results for the same samples.

sampleNames

A character vector, sample IDs for which null distributions will be plotted

cutoff

numeric, the cutoff value for determining significance

textSize

numeric, size of axes labels, axes values and title

labelSize

numeric, size of label texts

Value

a ggplot object

Author(s)

Ruqian Lyu

Examples

ranked <- rankGenes(toy_expr_se)
scoredf <- simpleScore(ranked, upSet = toy_gs_up, downSet = toy_gs_dn)
# find out what backends can be registered on your machine
BiocParallel::registered()
# the first one is the default backend, and it can be changed explicitly.
permuteResult = generateNull(upSet = toy_gs_up, downSet = toy_gs_dn, ranked,
B =10, seed = 1,useBPPARAM = NULL)
# call the permutation function to generate the empirical scores
#for B times.
pvals <- getPvals(permuteResult,scoredf)
# plot for all samples
plotNull(permuteResult,scoredf,pvals,sampleNames = names(pvals))
#plot for the first sample
plotNull(permuteResult,scoredf,pvals,sampleNames = names(pvals)[1])

DavisLaboratory/singscore documentation built on Nov. 21, 2024, 8:17 a.m.