large_matrix_to_dgCMatrix: Convert a large matrix object to a dgCMatrix

Description Usage Arguments Details Value

View source: R/large_matrix.R

Description

May be useful in cases where calling Matrix() directly gives a "negative length vectors are not allowed" error.

Usage

1
large_matrix_to_dgCMatrix(mat, chunk_size = 5000)

Arguments

mat

The matrix file to convert

chunk_size

The number of columns to read as a chunk. For ~30k genes, a chunk of 5000 (the default) is ~1GB in memory.

Details

This works through the matrix in column-based chunks becaues this is much faster for conversion to column-indexed dgCMatrices.

Value

A dgCMatrix object in the same orientation as the matrix object.


AllenInstitute/scrattch.io documentation built on Nov. 17, 2021, 10:06 a.m.