besca.get_ameans

besca.get_ameans(adata, mycat, condition=None)[source]

Calculates average and fraction expression per category in adata.obs Based artihmetic mean expression and fraction cells expressing gene per category (works on linear scale). Assumes that values in .raw are log: will exponentiate, calculate mean and log back.

Parameters:
  • adata (AnnData) – an AnnData object

  • mycat (str) – the category for stratification (e.g. donor, experiment)

  • condition (str) – the category to be later compared (e.g. treatment, timepoint)

Returns:

  • average_obs – average gene expression per category

  • fraction_obs – fraction cells expressing a gene per category