The package contains functions for exploratory oligonucleotide array analysis. The dependence on tkWidgets only concerns few convenience functions. 'affy' is fully functional without it.
日本語の概要は準備中です。原文の説明を表示しています。
The filtering uses intelligent methods to generate output 10X matrices as would be otherwise generated by CellRanger. The ranking option serves to illustrate the number of detected barcodes in the sample.
インストールする前に、エージェントに与えられる指示の中身を確認できます。
Domain: Single-cell / droplet Bioconductor: DropletUtils Paper: Lun ATL et al. (2019). Genome Biology, 20:63.
Utilities for handling droplet-based single-cell RNA-seq data: emptyDrops for ambient RNA removal, barcodeRanks for knee detection, and read10xCounts for CellRanger output loading.
Package-intrinsic requirements from the Bioconductor landing page — reproduce in any R environment.
BiocManager::install("DropletUtils")Alternatives: CellRanger filtered_feature_bc_matrix, SoupX (ambient RNA)
| Requirement | Details |
|---|---|
| Input Format | CellRanger raw_feature_bc_matrix/ directory OR raw count matrix |
| Must Use Raw | Use the UNFILTERED (raw) CellRanger output for emptyDrops; not the filtered output |
| Min Cells Umi | Barcodes with <100 UMI are used to estimate ambient profile |
if (!require("BiocManager", quietly=TRUE))
install.packages("BiocManager")
BiocManager::install("DropletUtils")
library(DropletUtils)
Read CellRanger output and use emptyDrops to filter real cells
library(DropletUtils)
# Point to raw (unfiltered) CellRanger output
sce <- read10xCounts("path/to/raw_feature_bc_matrix/",
col.names=TRUE)
dim(sce) # all barcodes, including empty
br_out <- barcodeRanks(counts(sce))
plot(br_out$rank, br_out$total + 1, log="xy",
xlab="Rank", ylab="Total UMI", main="Barcode Rank Plot")
abline(h=metadata(br_out)$knee, col="blue", lty=2)
abline(h=metadata(br_out)$inflection, col="red", lty=2)
legend("bottomleft", c("Knee","Inflection"),
col=c("blue","red"), lty=2)
set.seed(100)
e_out <- emptyDrops(counts(sce), lower=100, niters=10000,
BPPARAM=BiocParallel::SerialParam())
# Filter to real cells at FDR < 0.001
keep <- e_out$FDR <= 0.001
keep[is.na(keep)] <- FALSE
sce_filtered <- sce[, keep]
dim(sce_filtered)
cat("Cells retained:", ncol(sce_filtered), "
")
library(scater)
# Compute per-cell QC metrics
is_mito <- grepl("^MT-", rownames(sce_filtered))
df <- perCellQCMetrics(sce_filtered, subsets=list(Mito=is_mito))
colData(sce_filtered) <- cbind(colData(sce_filtered), df)
# Remove low-quality cells
qc_out <- quickPerCellQC(df, percent_subsets="subsets_Mito_percent")
sce_filtered <- sce_filtered[, !qc_out$discard]
cat("After QC:", ncol(sce_filtered), "cells
")
read10xCounts()()Load CellRanger output into a SingleCellExperiment
| Parameter | Description |
|---|---|
samples | path(s) to the filtered_feature_bc_matrix/ directory |
col.names | use barcode sequences as column names (default TRUE) |
type | 'sparse' (default, memory-efficient) or 'HDF5' |
emptyDrops()()Test each barcode for ambient RNA; returns statistics for classification
| Parameter | Description |
|---|---|
m | unfiltered count matrix (all barcodes) |
lower | UMI threshold below which barcodes are assumed empty (default 100) |
niters | Monte Carlo iterations for p-value calculation (default 10000) |
BPPARAM | BiocParallel parameter for parallelization |
barcodeRanks()()Compute barcode-rank statistics for knee plot visualization
| Parameter | Description |
|---|---|
m | count matrix |
lower | lower bound for fitting |
The method assumes the following about your data and experiment:
emptyDrops()$FDR: proportion of expected false discoveries; use FDR ≤ 0.001 for strict filtering.barcodeRanks()$knee: UMI count at the knee of the rank curve — approximate threshold for cell/empty distinction.barcodeRanks()$inflection: lower bound for cell-containing droplets.emptyDrops() on the UNFILTERED CellRanger output (raw_feature_bc_matrix/) for best sensitivity.emptyDrops() results: keep <- e.out$FDR <= 0.001 & !is.na(e.out$FDR).barcodeRanks) before choosing the lower UMI threshold for emptyDrops.sce <- sce[, keep] to subset to real cells.emptyDrops(lower=100, niters=10000) is a good default.| Alternative | Prefer this tool when | Prefer alternative when |
|---|---|---|
CellBender | You want deep learning-based ambient RNA removal AND empty droplet filtering simultaneously. | You want a simpler, faster, interpretable statistical test. |
Key studies that have validated or benchmarked this tool:
Error in emptyDrops: all barcodes have total counts <= lowerCause: lower parameter set too high relative to data
Fix: Reduce lower; inspect barcodeRanks(m) to set appropriate value
Extracted from the DropletUtils Bioconductor vignette(s)
1 Introduction 2 Reading in 10X Genomics data 2.1 From the UMI count matrix 2.2 From the molecule information file 2.1 From the UMI count matrix 2.2 From the molecule information file 3 Downsampling on the reads 4 Computing barcode ranks 5 Detecting empty droplets 6 Demultiplexing hashed libraries 7 Removing swapping effects 7.1 Barcode swapping between samples 7.2 Chimeric reads within cells 7.1 Barcode swapping between samples 7.2 Chimeric reads within cells 8 Session information
Droplet-based single-cell RNA sequencing (scRNA-seq) technologies allow researchers to obtain transcriptome-wide expression profiles for thousands of cells at once. Briefly, each cell is encapsulated in a droplet in a oil-water emulsion, along with a bead containing reverse transcription primers with a unique barcode sequence. After reverse transcription inside the droplet, each cellâs cDNA is labelled with that barcode (referred to a âcell barcodeâ). Bursting of the droplets yields a pool of cDNA for library preparation and sequencing. Debarcoding of the sequences can then be performed to obtain the expression profile for each cell. This package implements some general utilities for handling these data after quantification of expression. In particular, we focus on the 10X Genomics
The CellRanger pipeline from 10X Genomics will process the raw sequencing data and produce a matrix of UMI counts. Each row of this matrix corresponds to a gene, while each column corresponds to a cell barcode. This is saved in a single directory for each sample, usually named like <OUTPUT>/outs/filtered_gene_bc_matrices/<GENOME> 1 1 1 If you use the âfilteredâ matrix, each column corresponds to a putative cell. If you use the ârawâ matrix, all barcodes are loaded, and no distinction is made between cells and empty droplets. . We mock up an example directory below using some simulated data: The matrix.mtx file contains the UMI counts, while the other two files contain the cell barcodes and the gene annotation. We can load this into memory using the read10xCounts function, which re
# To generate the files.
example(write10xCounts, echo=FALSE)
dir.name <- tmpdir
list.files(dir.name)
## [1] "barcodes.tsv" "genes.tsv" "matrix.mtx"
CellRanger will also produce a molecule information file ( molecule_info.h5 ) that contains⦠well, information about the transcript molecules. This includes the UMI sequence 2 2 2 For readers who are unfamiliar with UMIs, they allow reads from different PCR amplicons to be unambiguously assigned to the same original molecule. , the cell barcode sequence, the gene to which it was assigned, and the number of reads covering the molecule. For demonstration purposes, we create an example molecule information file below: We can subsequently load this information into our R session using the read10xMolInfo function: This information can be useful for quality control purposes, especially when the underlying read counts are required, e.g., to investigate sequencing saturation. Note that the func
set.seed(1000)
mol.info.file <- DropletUtils:::simBasicMolInfo(tempfile())
mol.info.file
## [1] "/tmp/Rtmp5yfePp/file1d5dd58cf99eb"
Given multiple batches of very different sequencing depths, it can be beneficial to downsample the deepest batches to match the coverage of the shallowest batches. This avoids differences in technical noise that can drive clustering by batch. The scuttle package provides some utilities to downsample count matrices, but technically speaking, downsampling on the reads is more appropriate as it recapitulates the effect of differences in sequencing depth per cell. This can be achieved by applying the downsampleReads function to the molecule information file containing the read counts: The above code will downsample the reads to 50% of the original coverage across the experiment. However, the function will return a matrix of UMI counts , so the final total count may not actually decrease if th
set.seed(100)
no.sampling <- downsampleReads(mol.info.file, prop=1)
sum(no.sampling)
## [1] 9532
A useful diagnostic for droplet-based data is the barcode rank plot, which shows the (log-)total UMI count for each barcode on the y-axis and the (log-)rank on the x-axis. This is effectively a transposed empirical cumulative density plot with log-transformed axes. It is useful as it allows users to examine the distribution of total counts across barcodes, focusing on those with the largest counts. To demonstrate, let us mock up a count matrix: We compute the statistics using the barcodeRanks function, and then create the plot as shown below. The knee and inflection points on the curve mark the transition between two components of the total count distribution. This is assumed to represent the difference between empty droplets with little RNA and cell-containing droplets with much more RNA
set.seed(0)
my.counts <- DropletUtils:::simCounts()
br.out <- barcodeRanks(my.counts)
# Making a plot.
plot(br.out$rank, br.out$total, log="xy", xlab="Rank", ylab="Total")
o <- order(br.out$rank)
lines(br.out$rank[o], br.out$fitted[o], col="red")
abline(h=metadata(br.out)$knee, col="dodgerblue", lty=2)
abline(h=metadata(br.out)$inflection, col="forestgreen", lty=2)
legend("bottomleft", lty=2, col=c("dodgerblue", "forestgreen"),
legend=c("knee", "inflection"))
Empty droplets often contain RNA from the ambient solution, resulting in non-zero counts after debarcoding. The emptyDrops function is designed to distinguish between empty droplets and cells. It does so by testing each barcodeâs expression profile for significant deviation from the ambient profile. Given a matrix my.counts containing UMI counts for all barcodes, we call: Droplets with significant deviations from the ambient profile are detected at a specified FDR threshold, e.g., with FDR below 1%. These can be considered to be cell-containing droplets, with a frequency of false positives (i.e., empty droplets) at the specified FDR. Furthermore, droplets with very large counts are automatically retained by setting their p -values to zero. This avoids discarding droplets containing cell
set.seed(100)
e.out <- emptyDrops(my.counts)
e.out
## DataFrame with 11100 rows and 5 columns
## Total LogProb PValue Limited FDR
## <integer> <numeric> <numeric> <logical> <numeric>
## 1 2 NA NA NA NA
## 2 9 NA NA NA NA
## 3 20 NA NA NA NA
## 4 20 NA NA NA NA
## 5 1 NA NA NA NA
## ... ... ... ... ... ...
## 11096 215 -251.745 9.999e-05 TRUE 0.000153287
## 11097 201 -254.403 9.999e-05 TRUE 0.000153287
## 11098 247 -282.276 9.999e-05 TRUE 0.000153287
## 11099 191 -231.535 9.999e-05 TRUE 0.000153287
## 11100 198 -235.842 9.999e-05 TRUE 0.000153287
Cell hashing experiments can be demultiplexed using the hashedDrops() function on the set of cell-containing barcode libraries. To demonstrate, we will mock up some hash tag oligo (HTO) counts for a population with cells from each of 10 samples. We will also add some doublets and empty droplets for some flavor: Our first task is to identify the barcodes that actually contain cells. If we already did the calling with emptyDrops() , we could just re-use those calls; otherwise we can obtain calls directly from the HTO count matrix, though this requires some fiddling with lower= to match the sequencing depth of the HTO library. Each cell-containing barcode libary is simply assigned to the sample of origin based on its most abundant HTO. The confidence of the assignment is quantified by the lo
set.seed(10000)
# Simulating empty droplets:
nbarcodes <- 1000
nhto <- 10
y <- matrix(rpois(nbarcodes*nhto, 20), nrow=nhto)
# Simulating cells:
ncells <- 100
true.sample <- sample(nhto, ncells, replace=TRUE)
y[cbind(true.sample, seq_len(ncells))] <- 1000
# Simulating doublets:
ndoub <- ncells/10
next.sample <- (true.sample[1:ndoub] + 1) %% nrow(y)
next.sample[next.sample==0] <- nrow(y)
y[cbind(next.sample, seq_len(ndoub))] <- 500
hto.calls <- emptyDrops(y, lower=500)
has.cell <- hto.calls$FDR <= 0.001
summary(has.cell)
This skill is the knowledge layer — when, why, and how to use dropletutils. To run this analysis on your own data with managed compute, automated QC, and reproducible outputs, use BioMate — free to start.
まだレビューはありません。使ってみた感想をお寄せください。
概要と使いどころ
The package contains functions for exploratory oligonucleotide array analysis. The dependence on tkWidgets only concerns few convenience functions. 'affy' is fully functional without it.
日本語の概要は準備中です。原文の説明を表示しています。
This tool uses the label-tree function from HyPhy to annotate a phylogenetic tree. It allows users to select a subset of leaves using either a regular expression or a list of sequence names, and then apply a specified label to these selecte
日本語の概要は準備中です。原文の説明を表示しています。
This package provides a client for the Bioconductor AnnotationHub web resource. The AnnotationHub web resource provides a central location where genomic files (e.g., VCF, bed, wig) and other resources from standard locations (e.g., UCSC, En
日本語の概要は準備中です。原文の説明を表示しています。
apeglm provides Bayesian shrinkage estimators for effect sizes for a variety of GLM models, using approximation of the posterior for individual coefficients.
日本語の概要は準備中です。原文の説明を表示しています。
ASURAT is a software for single-cell data analysis. Using ASURAT, one can simultaneously perform unsupervised clustering and biological interpretation in terms of cell type, disease, biological process, and signaling pathway activity. Inputting a single-cell RNA-seq data and knowledge-based databases, such as Cell Ontology, Gene Ontology, KEGG, etc., ASURAT transforms gene expression tables into original multivariate tables, termed sign-by-sample matrices (SSMs).
日本語の概要は準備中です。原文の説明を表示しています。
AUCell allows to identify cells with active gene sets (e.g. signatures, gene modules...) in single-cell RNA-seq data. AUCell uses the "Area Under the Curve" (AUC) to calculate whether a critical subset of the input gene set is enriched with
日本語の概要は準備中です。原文の説明を表示しています。