snapatac2.tl.diff_test#

snapatac2.tl.diff_test(data, cell_group1, cell_group2, features=None, covariates=None, direction='both', min_log_fc=0.25, min_pct=0.05)[source]#

Identify differentially accessible regions.

Parameters:
  • data (AnnData | AnnDataSet) – AnnData or AnnDataSet object.

  • cell_group1 (list[int] | list[str]) – cells belonging to group 1. This can be a list of cell barcodes, indices or boolean mask vector.

  • cell_group2 (list[int] | list[str]) – cells belonging to group 2. This can be a list of cell barcodes, indices or boolean mask vector.

  • features (list[str] | list[int] | None) – Features/peaks to test. If None, all features are tested.

  • covariates (list[str] | None)

  • direction (Literal[‘positive’, ‘negative’, ‘both’]) – “positive”, “negative”, or “both”. “positive”: return features that are enriched in group 1. “negative”: return features that are enriched in group 2. “both”: return features that are enriched in group 1 or group 2.

  • min_log_fc (float) – Limit testing to features which show, on average, at least X-fold difference (log2-scale) between the two groups of cells.

  • min_pct (float) – Only test features that are detected in a minimum fraction of min_pct cells in either of the two populations.

Returns:

A DataFrame with 4 columns: “feature name”, “log2(fold_change)”, “p-value”, and “adjusted p-value”.

Return type:

pl.DataFrame