Manipulating snATAC sparse matrices

COO format uses integer indexes for both columns (features) and rows (cells). In this first section, we describe how to load them in Python or R.

Loading COO matrix in R

In R, two packages ar required: Matrix and data.table.


# ygi file path for peak index
# xgi file path for barcode index
# mfile file path for matrix file in coo

peak_ids = fread(
 sep="\t", header = FALSE)

cell_ids = fread(
 sep="\t", header = FALSE)

dat = fread(mfile, sep="\t")

mat = sparseMatrix(i = dat$V1 + 1, j =dat$V2 + 1, x=dat$V3)