Garfield.analysis.calc_marker_stats

Garfield.analysis.calc_marker_stats(ad, groupby, genes=None, use_raw=True, inplace=False, partial=False)[source]

Calculate marker statistics for grouped data.

Parameters:
  • ad (AnnData) – AnnData object containing expression data.

  • groupby (str) – Column in ad.obs used for grouping cells. Must be categorical.

  • genes (list, optional) – List of genes to subset for calculations. If None, all genes are used.

  • use_raw (bool, True) – Which representation of data to use (‘raw’ or normalized). Default is ‘raw’.

  • inplace (bool, optional) – Whether to modify the AnnData object in place. Default is False.

  • partial (bool, optional) – If True, calculate only fraction and mean statistics; skip additional computations. Default is False.

Returns:

If inplace is False, returns a tuple of DataFrames: (frac_df, mean_df, stats_df). Otherwise, modifies ad in place and returns None.

Return type:

tuple or None