snapatac2.pp.make_gene_matrix#

snapatac2.pp.make_gene_matrix(adata, gene_anno, *, inplace=False, file=None, backend='hdf5', chunk_size=500, use_x=False, id_type='gene')[source]#

Generate cell by gene activity matrix.

Generate cell by gene activity matrix by counting the TN5 insertions in gene body regions. The result will be stored in a new file and a new AnnData object will be created.

Parameters:
  • adata (AnnData | AnnDataSet) – The (annotated) data matrix of shape n_obs x n_vars. Rows correspond to cells and columns to regions.

  • gene_anno (Genome | Path) – Either a Genome object or the path of a gene annotation file in GFF or GTF format.

  • inplace (bool) – Whether to add the gene matrix to the AnnData object or return a new AnnData object.

  • file (Optional[Path]) – File name of the h5ad file used to store the result. This has no effect when inplace=True.

  • backend (Optional[Literal['hdf5']]) – The backend to use for storing the result. If None, the default backend will be used.

  • chunk_size (int) – Chunk size

  • use_x (bool) – If True, use the matrix stored in .X to compute the gene activity. Otherwise the .obsm['insertion'] is used.

  • id_type (Literal['gene', 'transcript']) – “gene” or “transcript”.

Returns:

An annotated data matrix of shape n_obs x n_vars. Rows correspond to cells and columns to genes. If file=None, an in-memory AnnData will be returned, otherwise a backed AnnData is returned.

Return type:

AnnData