snapatac2.pp.add_frip#

snapatac2.pp.add_frip(adata, regions, *, inplace=True, n_jobs=8)[source]#

Add fraction of reads in peaks (FRiP) to the AnnData object.

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.

  • regions (dict[str, Path | list[str]]) – A dictionary containing the peak sets to compute FRiP. The keys are peak set names and the values are either a bed file name or a list of strings representing genomic regions. For example, {“promoter_frac”: “promoter.bed”, “enhancer_frac”: [“chr1:100-200”, “chr2:300-400”]}.

  • inplace (bool) – Whether to add the results to adata.obs or return it as a dictionary.

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

Return type:

UnionType[dict[str, list[float]], list[dict[str, list[float]]], None]