snapatac2.tl.call_peaks#

snapatac2.tl.call_peaks(adata, groupby, selections=None, q_value=0.05, out_dir=None, key_added='peaks', inplace=True)[source]#

Call peaks using MACS2.

Use the callpeak command in MACS2 to identify regions enriched with TN5 insertions. The parameters passed to MACS2 are: “-shift -100 -extsize 200 -nomodel -callsummits -nolambda -keep-dup all”

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

  • groupby (str | list[str]) – Group the cells before peak calling. If a str, groups are obtained from .obs[groupby].

  • selections (set[str] | None) – Call peaks for the selected groups only.

  • q_value (float) – q_value cutoff used in MACS2.

  • out_dir (Path | None) – If provided, raw peak files from each group will be saved in the directory. Otherwise, they will be stored in a temporary directory which will be removed afterwards.

  • key_added (str) – .uns key under which to add the peak information.

  • inplace (bool) – Whether to store the result inplace.

Returns:

If inplace=True it stores the result in adata.uns[`key_added]`. Otherwise, it returns the result as a dataframe.

Return type:

‘polars.DataFrame’ | None