Learn R Programming

EWCE (version 1.0.2)

generate.bootstrap.plots: Generate bootstrap plots

Description

generate.bootstrap.plots takes a genelist and a single cell type transcriptome dataset and generates plots which show how the expression of the genes in the list compares to those in randomly generated gene lists

Usage

generate.bootstrap.plots(sct_data, mouse.hits, mouse.bg, reps, sub = FALSE, full_results = NA, listFileName = "")

Arguments

sct_data
List generated using read_celltype_data
mouse.hits
Array of MGI gene symbols containing the target gene list.
mouse.bg
Array of MGI gene symbols containing the background gene list.
reps
Number of random gene lists to generate (default=100 but should be over 10000 for publication quality results)
sub
a logical indicating whether to analyse sub-cell type annotations (TRUE) or cell-type annotations (FALSE). Default is FALSE.
full_results
The full output of bootstrap.enrichment.test for the same genelist
listFileName
String used as the root for files saved using this function

Value

Saves a set of pdf files containing graphs. These will be saved with the filename adjusted using the value of listFileName. The files are saved into the 'BootstrapPlot' folder. The files start with one of the following:
  • qqplot_noText: sorts the gene list according to how enriched it is in the relevant celltype. Plots the value in the target list against the mean value in the bootstrapped lists.
  • qqplot_wtGSym: as above but labels the gene symbols for the highest expressed genes.
  • bootDists: rather than just showing the mean of the bootstrapped lists, a boxplot shows the distribution of values
  • bootDists_LOG: shows the bootstrapped distributions with the y-axis shown on a log scale

Examples

Run this code
# Load the single cell data
data(celltype_data)

# Set the parameters for the analysis
reps=100 # <- Use 100 bootstrap lists so it runs quickly, for publishable analysis use >10000
subCellStatus=0 # <- Use subcell level annotations (i.e. Interneuron type 3)
if(subCellStatus==1){subCellStatus=TRUE;cellTag="SubCells"}
if(subCellStatus==0){subCellStatus=FALSE;cellTag="FullCells"}

# Load the gene list and get human orthologs
data("example_genelist")
data("mouse_to_human_homologs")
m2h = unique(mouse_to_human_homologs[,c("HGNC.symbol","MGI.symbol")])
mouse.hits = unique(m2h[m2h$HGNC.symbol %in% example_genelist,"MGI.symbol"])
mouse.bg  = unique(setdiff(m2h$MGI.symbol,mouse.hits))

# Bootstrap significance testing, without controlling for transcript length and GC content
full_results = bootstrap.enrichment.test(sct_data=celltype_data,mouse.hits=mouse.hits,
     mouse.bg=mouse.bg,reps=reps,sub=subCellStatus)

generate.bootstrap.plots(sct_data=celltype_data,mouse.hits=mouse.hits, mouse.bg=mouse.bg,
     reps=reps,sub=FALSE,full_results=full_results,listFileName="Example")

Run the code above in your browser using DataLab