generate_bootstrap_plots {EWCE} | R Documentation |
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
generate_bootstrap_plots( sct_data, hits, bg, genelistSpecies = "mouse", sctSpecies = "mouse", reps, annotLevel = 1, full_results = NA, listFileName = "", savePath = tempdir() )
sct_data |
List generated using |
hits |
Array of MGI/HGNC gene symbols containing the target gene list. |
bg |
Array of MGI/HGNC gene symbols containing the background gene list. |
genelistSpecies |
Either 'mouse' or 'human' depending on whether MGI or HGNC symbols are used for gene lists |
sctSpecies |
Either 'mouse' or 'human' depending on whether MGI or HGNC symbols are used for the single cell dataset |
reps |
Number of random gene lists to generate (default=100 but should be over 10000 for publication quality results) |
annotLevel |
an integer indicating which level of the annotation to analyse. Default = 1. |
full_results |
The full output of
|
listFileName |
String used as the root for files saved using this function |
savePath |
Directory where the BootstrapPlots folder should be saved, default is a temp directory |
Saves a set of pdf files containing graphs and returns the file where they are saved. These will be saved with the filename adjusted using the value of listFileName. The files are saved into the 'BootstrapPlot' folder. 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
library(ewceData) # Load the single cell data ctd <- ctd() # Set the parameters for the analysis # Use 5 bootstrap lists for speed, for publishable analysis use >10000 reps <- 5 # Load the gene list and get human orthologs example_genelist <- example_genelist() mouse_to_human_homologs <- 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"]) #subset mouse.bg for speed but ensure it still contains the hits mouse.bg <- unique(c(m2h$MGI.symbol[1:100],mouse.hits)) # Bootstrap significance test, no control for transcript length or GC content full_results <- bootstrap_enrichment_test( sct_data = ctd, hits = mouse.hits, bg = mouse.bg, reps = reps, annotLevel = 1, sctSpecies = "mouse", genelistSpecies = "mouse" ) plot_file_pth <- generate_bootstrap_plots( sct_data = ctd, hits = mouse.hits, bg = mouse.bg, reps = reps, full_results = full_results, listFileName = "Example", genelistSpecies = "mouse", sctSpecies = "mouse", annotLevel = 1, savePath=tempdir() )