generate.bootstrap.plots: Generate bootstrap plots

Description Usage Arguments Value Examples

View source: R/generate.bootstrap.plots.R

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

1
2
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:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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")

Example output

[1] "astrocytes-ependymal"
[1] 0
[1] "Fold enrichment: 38.1939364679234"
[1] "Standard deviations from mean: 12.2253041351122"
[1] ""
[1] "endothelial-mural"
[1] 0.07
[1] ""
[1] "interneurons"
[1] 0.23
[1] ""
[1] "microglia"
[1] 0
[1] "Fold enrichment: 58.53184763798"
[1] "Standard deviations from mean: 13.6024119496831"
[1] ""
[1] "oligodendrocytes"
[1] 0.04
[1] "Fold enrichment: 8.35884377586593"
[1] "Standard deviations from mean: 2.76819386102682"
[1] ""
[1] "pyramidal CA1"
[1] 0.12
[1] ""
[1] "pyramidal SS"
[1] 0.18
[1] ""
Warning messages:
1: Duplicated aesthetics after name standardisation: colour 
2: Transformation introduced infinite values in continuous y-axis 
3: Removed 65 rows containing non-finite values (stat_boxplot). 
4: Duplicated aesthetics after name standardisation: colour 
5: Transformation introduced infinite values in continuous y-axis 
6: Removed 208 rows containing non-finite values (stat_boxplot). 
7: Duplicated aesthetics after name standardisation: colour 
8: Transformation introduced infinite values in continuous y-axis 
9: Removed 16 rows containing non-finite values (stat_boxplot). 

EWCE documentation built on May 31, 2017, 3:16 p.m.