## ----echo=FALSE, message=FALSE------------------------------------------------ knitr::opts_chunk$set(error=FALSE, message=FALSE, warning=FALSE) library(BiocStyle) ## ----------------------------------------------------------------------------- library(scRNAseq) sce <- BachMammaryData(samples="G_1") set.seed(1001) sce <- sce[,sample(ncol(sce), 1000)] ## ----------------------------------------------------------------------------- library(scrapper) sce <- scrapper::analyze.se(sce)$x ## ----------------------------------------------------------------------------- set.seed(1003) library(scDblFinder) hvgs <- row.names(sce)[which(rowData(sce)$hvg)] scores <- computeDoubletDensity(sce, subset.row=hvgs) library(scater) plotTSNE(sce, colour_by=I(log1p(scores))) ## ----echo=FALSE--------------------------------------------------------------- # Sanity check that the plot has one cluster with much higher scores. by.clust <- split(scores, sce$graph.cluster) med.scores <- sort(vapply(by.clust, median, 0), decreasing=TRUE) stopifnot(med.scores[1] > med.scores[2] * 3) ## ----------------------------------------------------------------------------- sessionInfo()