read10xCounts {DropletUtils} | R Documentation |
Creates a SingleCellExperiment from the CellRanger output directories for 10X Genomics data.
read10xCounts(samples, col.names=FALSE, ...)
samples |
A character vector containing one or more directory names, each corresponding to a 10X sample.
Each directory should contain the |
col.names |
A logical scalar indicating whether the columns of the output object should be named with the cell barcodes. |
... |
Further arguments to pass to |
This function was originally developed from the Read10X
function from the Seurat package.
It was then taken from the read10xResults
implementation in the scater package.
If col.names=TRUE
and length(sample)==1
, each column is named by the cell barcode.
For multiple samples, the columns are unnamed to avoid problems with non-unique barcodes across samples.
Note that user-level manipulation of sparse matrices requires loading of the Matrix package.
Otherwise, calculation of rowSums
, colSums
, etc. will result in errors.
A SingleCellExperiment object with counts data stored as a sparse matrix.
Matrices are combined by column if multiple samples
were specified.
Rows are named with the gene identifier (usually ENSEMBL).
Davis McCarthy, with modifications from Aaron Lun
Zheng GX, Terry JM, Belgrader P, and others (2017). Massively parallel digital transcriptional profiling of single cells. Nat Commun 8:14049.
10X Genomics (2017). Gene-Barcode Matrices. https://support.10xgenomics.com/single-cell-gene-expression/software/pipelines/latest/output/matrices
# Mocking up some 10X genomics output. example(write10xCounts) # Reading it in. sce10x <- read10xCounts(tmpdir) # Column names are dropped with multiple 'samples'. sce10x2 <- read10xCounts(c(tmpdir, tmpdir))