Memory-Efficient Doublet Detection for Single-Cell RNA Sequencing

Detects doublets in single-cell RNA sequencing data with the 'DoubletFinder' method of McGinnis, Murrow and Gartner (2019) , implemented in 'Rust' to use less memory and time. Provides artificial doublet simulation, exact nearest-neighbour search and pANN (proportion of artificial nearest neighbours) scoring, and reproduces 'DoubletFinder' scores exactly.


doubletrs

Doublet detection for single-cell RNA sequencing with the DoubletFinder method, reimplemented in Rust to use less memory and time.

DoubletFinder builds a dense cells x cells distance matrix, which is what makes it run out of memory on large datasets. doubletrs finds the same nearest neighbours without ever building that matrix, and runs the heavy steps in parallel.

Drop-in replacement for DoubletFinder

doubletrs has DoubletFinder's functions, with the same arguments and outputs. Replace library(DoubletFinder) with library(doubletrs):

library(doubletrs)

# seu: a Seurat object after NormalizeData, FindVariableFeatures, ScaleData, RunPCA
set.seed(1)
sweep <- paramSweep(seu, PCs = 1:10)
bcmvn <- find.pK(summarizeSweep(sweep))
pK <- as.numeric(as.character(bcmvn$pK[which.max(bcmvn$BCmetric)]))

nExp <- round(0.075 * ncol(seu) * (1 - modelHomotypic(seu$seurat_clusters)))
seu <- doubletFinder(seu, PCs = 1:10, pN = 0.25, pK = pK, nExp = nExp)

Parent cells for artificial doublets are drawn with the same R random number calls as DoubletFinder, so after the same set.seed() the results are identical.

Validation

On the 16 real datasets of the Xi & Li (2021) doublet-detection benchmark, doubletrs reproduces DoubletFinder's pANN scores exactly for every cell, with the same accuracy against experimentally identified doublets, and is 1.5 to 4 times faster end to end. paramSweep() is about 3 times faster. Details and scripts are in the project repository.

Installation

Installing from source needs the Rust toolchain (rustc >= 1.71), available from https://rustup.rs. The package shares its Rust code with the rest of the repository, so install from a clone:

git clone https://github.com/mayankgandhi13/doublet-rs
R CMD INSTALL doublet-rs/bindings/r

Reference

McGinnis CS, Murrow LM, Gartner ZJ (2019). DoubletFinder: Doublet detection in single-cell RNA sequencing data using artificial nearest neighbors. Cell Systems 8(4), 329-337. https://doi.org/10.1016/j.cels.2019.03.003

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("doubletrs")

0.1.0 by Mayank Gandhi, 8 hours ago


https://github.com/mayankgandhi13/doublet-rs


Report a bug at https://github.com/mayankgandhi13/doublet-rs/issues


Browse source code at https://github.com/cran/doubletrs


Authors: Mayank Gandhi [aut, cre, cph] , Authors of the dependency Rust crates [cph] (see inst/AUTHORS for the bundled crates , their authors and licenses)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports graphics, KernSmooth, Matrix, methods, parallel, stats

Suggests knitr, rmarkdown, Seurat, SeuratObject, testthat

System requirements: Cargo (Rust's package manager), rustc >= 1.71


See at CRAN