snapatac2.metrics.summary_by_chrom#

snapatac2.metrics.summary_by_chrom(adata, *, mode='count', n_jobs=8)[source]#

Compute the cell level summary statistics by chromosome.

import_fragments must be ran first in order to use this function.

Parameters:
  • adata (AnnData | list[AnnData]) – The (annotated) data matrix of shape n_obs x n_vars. Rows correspond to cells and columns to regions. adata could also be a list of AnnData objects. In this case, the function will be applied to each AnnData object in parallel.

  • mode (Literal['sum', 'mean', 'count']) – The summary statistics to compute. It can be one of the following: - ‘sum’: Sum of the values. - ‘mean’: Mean of the values. - ‘count’: Count of the values.

  • n_jobs (int) – Number of jobs to run in parallel when adata is a list. If n_jobs=-1, all CPUs will be used.

Returns:

A dictionary containing the summary statistics for each chromosome. The keys are chromosome names and the values are the summary statistics.

Return type:

dict[str, np.ndarray]