read10xMatrix {DropletUtils} | R Documentation |
Creates a sparse or HDF5-backed count matrix from the MatrixMarket file produced by CellRanger.
read10xMatrix(file, hdf5.out=FALSE, chunk.size)
file |
String containing the path to a MatrixMarket file, usually named |
hdf5.out |
A logical scalar indicating whether a HDF5Matrix object should be produced. |
chunk.size |
An integer scalar specifying the chunk size when reading in records from |
When hdf5.out=FALSE
, readMM
is used directly.
However, for very large 10x experiments with more than .Machine$integer.max
non-zero entries, dgCMatrix
may encounter integer overflows.
In such cases, setting hdf5.out=TRUE
will produce a HDF5Matrix
object instead.
A dgCMatrix object (or a HDF5Matrix object, if hdf5.out=TRUE
) containing the counts for each gene (row) and cell barcode (column).
Aaron Lun
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) mm.path <- file.path(tmpdir, "matrix.mtx") X <- read10xMatrix(mm.path) altX <- read10xMatrix(mm.path, chunk.size=10, hdf5.out=TRUE)