read_sparse_matrix: Read in one or multiple sparse matrices (10X format)

View source: R/preprocessing_filtering_reduction.R

read_sparse_matrixR Documentation

Read in one or multiple sparse matrices (10X format)

Description

Given one or multiple directories, look in each directory for a combination of the following files :

  • A 'features' file containing unique feature genomic locations -in tab separated format ( *_features.bed / .txt / .tsv / .gz), e.g. chr, start and end

  • A 'barcodes' file containing unique barcode names ( _barcode.txt / .tsv / .gz)

  • A 'matrix' A file containing indexes of non zero entries (_matrix.mtx / .gz)

Usage

read_sparse_matrix(
  files_dir_list,
  ref = c("hg38", "mm10", "ce11")[1],
  verbose = TRUE
)

Arguments

files_dir_list

A named character vector containing the full path towards folders. Each folder should contain only the Feature file, the Barcode file and the Matrix file (see description).

ref

Reference genome (used to filter non-canonical chromosomes).

verbose

Print ?

Value

Returns a list containing a datamatrix and cell annotation

Examples

## Not run: 
sample_dirs = c("/path/to/folder1/", "/path/to/folder2/")
names(sample_dirs) = c("sample_1", "sample_2")
out <- read_sparse_matrix(sample_dirs, ref = "hg38")
head(out$datamatrix)
head(out$annot_raw)

## End(Not run)


vallotlab/ChromSCape documentation built on Oct. 15, 2023, 1:47 p.m.