# Last modified 2018-05-08 bcbioSingleCell::prepareSingleCellTemplate() source("_setup.R") # Load seurat object seurat_name <- load(params$seurat_file) seurat <- get(seurat_name, inherits = FALSE) stopifnot(is(seurat, "seurat")) invisible(validObject(seurat)) idents <- levels(seurat@ident) interesting_groups <- interestingGroups(seurat)
groups <- unique(c("ident", "sampleName", interesting_groups)) invisible(lapply(groups, function(group) { markdownHeader(group, level = 2, asis = TRUE) plotTSNE(seurat, interestingGroups = group) %>% show() })) rm(groups)
groups <- unique(c("sampleName", interesting_groups)) invisible(lapply(idents, function(ident) { subset <- SubsetData(seurat, ident.use = ident) markdownHeader(ident, level = 2, asis = TRUE, tabset = TRUE) invisible(lapply(groups, function(group) { markdownHeader(group, level = 3, asis = TRUE) plotTSNE(subset, interestingGroups = group) %>% show() })) })) rm(groups)
invisible(lapply(idents, function(ident) { subset <- SubsetData(seurat, ident.use = ident) markdownHeader(ident, level = 2, asis = TRUE, tabset = TRUE) master <- subset@meta.data %>% uniteInterestingGroups(interestingGroups) %>% select(sampleName, interestingGroups) sampleStats <- master %>% arrange(sampleName) %>% group_by(sampleName) %>% summarize(count = n()) %>% mutate(pct = count / sum(count)) intgroupStats <- master %>% arrange(interestingGroups) %>% group_by(interestingGroups) %>% summarize(count = n()) %>% mutate(pct = count / sum(count)) kable(sampleStats, digits = 2) %>% show() kable(intgroupStats, digits = 2) %>% show() }))
markdownHeader("PrintPCAParams", level = 2) PrintPCAParams(seurat) markdownHeader("PrintFindClustersParams", level = 2) PrintFindClustersParams(seurat) markdownHeader("PrintTSNEParams", level = 2) PrintTSNEParams(seurat) markdownHeader("PrintSNNParams", level = 2) PrintSNNParams(seurat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.