This vignette demonstrates how to use cellhashR to easily run multiple demultiplexing algorithms on cell hashing data in order to produce the type of classifications summarized in this figure from the BFF paper.

knitr::include_graphics('Benchmark-example_files/figure-html/Benchmark_fig.png')
knitr::opts_chunk$set(message=FALSE, warning=FALSE, echo=TRUE, error=TRUE)

Load Data

cellhashR expects count data with cells in columns and barcode features in rows.

library(cellhashR)
rawCountData <- "../tests/testdata/MS/cell_type_counts.csv"
barcodeData <- t(read.csv(rawCountData, header = TRUE, row.names = 1))

Generate Hashing Calls

The cellhashR command GenerateCellHashingCalls performs demultiplexing analysis on the data using the algorithms listed in "methods". The plots that follow are the most informative of the plots generated by each demultiplexing algorithm.

methods <- c("bff_cluster", "bff_raw", "gmm_demux", "multiseq", "htodemux", "dropletutils")
df <- GenerateCellHashingCalls(barcodeMatrix = barcodeData, methods = methods, cellbarcodeWhitelist = cellbarcodeWhitelist, metricsFile = metricsFile)
write.table(df, file = callFile, sep = '\t', row.names = FALSE, quote = FALSE)

BFF_cluster

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-1.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-2.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-3.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-4.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-17.png')

BFF_threshold

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-19.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-20.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-33.png')

GMM Demux

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-35.png')

MULTI-Seq

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-48.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-49.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-50.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-51.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-64.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-65.png')

Seurat HTODemux

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-66.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-79.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-80.png')

DropletUtils hashedDrops

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-81.png')
knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-82.png')

Summary of Calls

After all of the demultiplexing algorithms have run, the classifications are summarized as in these plots.

knitr::include_graphics('Benchmark-example_files/figure-html/GenerateCalls-95.png')

The classification summary above is related to the classification summary in the BFF paper (shown again below) because the HEK sample is composed of Bar1 and Bar2 droplets, the MEF sample is composed of Bar3 and Bar4 droplets, and the Jurkats sample is composed of droplets assigned to the remaining barcodes.

knitr::include_graphics('Benchmark-example_files/figure-html/Benchmark_fig.png')

Calls Per Cell

The output is a data frame, with the calls from each caller, and a consensus call. See AppendCellHashing to append the results to a seurat object as metadata.

knitr::kable(head(df, n = 10))
knitr::include_graphics('Benchmark-example_files/figure-html/FinalCalls-1.png')


BimberLab/cellhashR documentation built on March 20, 2024, 9:23 a.m.