Learn R Programming

diem (version 1.0)

read_10x: Read 10X counts data

Description

Read the counts output from into a sparse matrix. Given a 10X output path, Read in the the output files from 10X CellRanger. Specifically, path should be be a directory containing the raw count output from 10X CellRnager with output files barcodes.tsv genes.tsv matrix.mtx, or if using CellRanger v2, or barcodes.tsv.gz features.tsv.gz matrix.mtx.gz if using CellRanger v3. When reading in the barcodes and gene names, duplicates are removed with the make.unique function. The separator is specified by sep by default.

Usage

read_10x(path, clip_end = TRUE, sep = ".")

Arguments

path

The file path prefix to the raw 10X output directory

clip_end

A logical indicating whether to remove the suffix "-N" from the barcodes, where N is n integer such as 1. The default it TRUE.

sep

A character indicating the separator to use in the call to make.unique.

Value

expr A sparse matrix of counts from 10X cell ranger with cells in the columns and genes in the rows.

Examples

Run this code
# NOT RUN {
dir <- "path/to/10x" # should show 3 files described above
counts <- read_10x(dir)
# }

Run the code above in your browser using DataLab