bpcells.experimental.DirMatrix#
- class bpcells.experimental.DirMatrix(dir: str)[source]#
Disk-backed BPCells integer matrix
This reads BPCells-format matrices, returning scipy.sparse.csc_matrix objects when sliced.
- Parameters:
dir (str) – Path of the matrix directory
Examples
>>> from bpcells import DirMatrix >>> mat = DirMatrix("/path/to/matrix") >>> mat[:,[1,3,2,4]] <3x4 sparse matrix of type '<class 'numpy.uint32'>' with 6 stored elements in Compressed Sparse Column format>
Attributes
Return a transposed view of the matrix
Dimensions of matrix
Number of threads to use for reading (default=1)
Methods
DirMatrix.from_h5ad
(h5ad_path, out_dir[, group])Create a DirMatrix from an h5ad file.
DirMatrix.from_hstack
(mats, out_dir)Create a DirMatrix by concatenating a list of DirMatrix objects horizontally (column wise)
DirMatrix.from_scipy_sparse
(scipy_mat, dir)Create a DirMatrix from a scipy sparse matrix.
DirMatrix.from_vstack
(mats, out_dir)Create a DirMatrix by concatenating a list of DirMatrix objects vertically (row wise)
Return at transposed view of the matrix