snapatac2.pp.make_peak_matrix#
- snapatac2.pp.make_peak_matrix(adata, file=None, use_rep='peaks', peak_file=None, chunk_size=500)[source]#
Generate cell by peak count matrix.
This function will generate a cell by peak count matrix and store it in a new .h5ad file.
import_data()
must be ran first in order to use this function.- Parameters
adata (
AnnData
|AnnDataSet
) – The (annotated) data matrix of shapen_obs
xn_vars
. Rows correspond to cells and columns to regions.file (
Optional
[Path
]) – File name of the output h5ad file used to store the result. If provided, result will be saved to a backed AnnData, otherwise an in-memory AnnData is used.use_rep (
str
|list
[str
]) – This is used to read peak information from.uns[use_rep]
. The peaks can also be provided by a list of strings: [“chr1:1-100”, “chr2:2-200”].peak_file (
Optional
[Path
]) – Bed file containing the peaks. If provided, peak information will be read from this file.chunk_size (
int
) – Chunk size
- Returns
An annotated data matrix of shape
n_obs
xn_vars
. Rows correspond to cells and columns to peaks. Iffile=None
, an in-memory AnnData will be returned, otherwise a backed AnnData is returned.- Return type
AnnData | ad.AnnData