Skip to contents

Reads a single sample's filtered feature barcode matrix H5 file from a 10x Genomics Cell Ranger output directory and creates a Seurat object. A log10 genes-per-UMI complexity metric is added to the object metadata as log10GenesPerUMI.

Usage

read_10x_GEX(sampleDir, sample, ident, min.cells, min.features)

Arguments

sampleDir

Character string. Path to the parent directory that contains one subdirectory per sample.

sample

Character string. Name of the sample subdirectory within sampleDir.

ident

Character string. Identity label to assign to every cell in the resulting Seurat object (stored in the ident metadata column).

min.cells

Integer. Include features detected in at least this many cells. Passed to Seurat::CreateSeuratObject().

min.features

Integer. Include cells where at least this many features are detected. Passed to Seurat::CreateSeuratObject().

Value

A Seurat object for the specified sample with the RNA assay, an ident metadata column, and a log10GenesPerUMI complexity metric.

Details

The expected input path is <sampleDir>/<sample>/outs/filtered_feature_bc_matrix.h5. To process multiple samples, iterate over sample names with purrr::map() or lapply().

Examples

if (FALSE) { # \dontrun{
library(purrr)

sample_dir <- "/path/to/data/"
samples    <- c("S1", "S2", "S3")
idents     <- c("CondA", "CondB", "CondC")

seurat_list <- map(samples, idents, ~ read_10x_GEX(
  sampleDir    = sample_dir,
  sample       = .x,
  ident        = .y,
  min.cells    = 10,
  min.features = 100
))
} # }