runShiny: Run the scClustViz Shiny app

View source: R/runViz.R

runShinyR Documentation

Run the scClustViz Shiny app

Description

This command runs the Shiny interactive visualization from a saved data file.

Usage

runShiny(
  filePath,
  outPath,
  cellMarkers = list(),
  annotationDB,
  rownameKeytype,
  imageFileType = "png",
  ...
)

Arguments

filePath

A character vector giving the relative filepath to an RData file containing two objects: the sCVdata object generated by CalcAllSCV, and the input scRNAseq data object.

outPath

Optional. If you'd like to save/load any analysis files to/from a different directory than the input directory (for example, if you're using data from a package), specify that directory here. Otherwise any files generated by the Shiny app (ie. saving the selected cluster solution, saving custom set DE testing results) will be saved/loaded in filePath. If you'd like to prevent users from saving anything to disk (ie when hosting a web service) set this to NA.

cellMarkers

Optional. If you have canonical marker genes for expected cell types, list them here (see example code below). Note that the gene names must match rownames of your data (ie. use ensembl IDs if your gene expression matrix rownames are ensembl IDs). The Shiny app will attempt to label clusters in the tSNE projection by highest median gene expression. See labelCellTypes for more information.

annotationDB

Optional. An AnnotationDbi object for your data's species (ie. org.Mm.eg.db / org.Hs.eg.db for mouse / human respectively). If present, gene names will be shown in gene-specific figures, official gene symbols (instead of your rownames) will be displayed in figures, and gene searches performed using both official gene symbols and your rownames. If the gene IDs in your data aren't official gene symbols, using this argument will make the visualization tool much more useful.

rownameKeytype

Optional. A character vector indicating the AnnotationDbi keytype (see keytypes(annotationDB)) that represents your rownames. If the annotationDB argument is present and this is missing, the function will assume the rownames are official gene symbols. If less than 80 predict the appropriate keytype of the rownames (this takes a bit of time).

imageFileType

Default="png". The file format for saved figures. One of "pdf" (generated with cairo_pdf), "eps" (generated with cairo_ps), "tiff" (generated with tiff), or "png" (generated with png). Note that "pdf" and "eps" outputs require the cairo graphics library. Check to see if R can find it on your computer by running capabilities("cairo").

...

Named options that should be passed to the runApp call (these can be any of the following: "port", "launch.browser", "host", "quiet", "display.mode" and "test.mode").

Value

The function causes the scClustViz Shiny GUI app to open in a seperate window.

See Also

sCVdata for the input data type, and CalcAllSCV or CalcSCV to do the calculations necessary for this function.

Examples

## Not run: 
your_cluster_columns <- grepl("res[.0-9]+$",
                              names(getMD(your_scRNAseq_data_object)))
# ^ Finds the cluster columns of the metadata in a Seurat object.

your_cluster_results <- getMD(your_scRNAseq_data_object)[,your_cluster_columns]

sCVdata_list <- CalcAllSCV(inD=your_scRNAseq_data_object,
                           clusterDF=your_cluster_results,
                           exponent=exp(1),
                           pseudocount=1,
                           DRthresh=0.1,
                           DRforClust="pca",
                           testAll=F,
                           FDRthresh=0.05,
                           calcSil=T,
                           calcDEvsRest=T,
                           calcDEcombn=T)

save(your_scRNAseq_data_object,sCVdata_list,
     file="for_scClustViz.RData")

# Lets assume this is data from an embryonic mouse cerebral cortex:
# (This is the function call wrapped by MouseCortex::viewMouseCortex("e13"))
runShiny(filePath="for_scClustViz.RData",
         outPath="./",
         # Save any further analysis performed in the app to the
         # working directory rather than library directory.
         annotationDB="org.Mm.eg.db",
         # This is an optional argument, but will add annotations.
         cellMarkers=list("Cortical precursors"=c("Mki67","Sox2","Pax6",
                                                  "Pcna","Nes","Cux1","Cux2"),
                          "Interneurons"=c("Gad1","Gad2","Npy","Sst","Lhx6",
                                           "Tubb3","Rbfox3","Dcx"),
                          "Cajal-Retzius neurons"="Reln",
                          "Intermediate progenitors"="Eomes",
                          "Projection neurons"=c("Tbr1","Satb2","Fezf2",
                                                 "Bcl11b","Tle4","Nes",
                                                 "Cux1","Cux2","Tubb3",
                                                 "Rbfox3","Dcx")
                          )
         # This is a list of canonical marker genes per expected cell type.
         # The app uses this list to automatically annotate clusters.
         )


## End(Not run)


BaderLab/scClustViz documentation built on Sept. 10, 2023, 11:51 p.m.