tacco.tools.get_compositions

get_compositions(adata, value_key, group_key=None, fillna=None, restrict_groups=None, restrict_values=None, reads=False, counts_location=None)[source]

Get the compositions of groups.

Parameters:
  • adata – An AnnData with annotation in .obs.

  • value_key – The .obs or .obsm key with the values to determine the enrichment for.

  • group_key – The .obs key with categorical group information. If None, determine the contributions for the whole dataset and names this group ‘all’.

  • fillna – If None, observation containing NA in the values are filtered. Else, NA values are replaced with this value.

  • restrict_groups – A list-like containing the groups within which the enrichment analysis is to be done. If None, all groups are included.

  • restrict_values – A list-like containing the values within which the enrichment analysis is to be done. If None, all values are included. Works only for categorical values.

  • reads – Whether to weight the values by the total count per observation

  • counts_location – A string or tuple specifying where the count matrix is stored, e.g. ‘X’, (‘raw’,’X’), (‘raw’,’obsm’,’my_counts_key’), (‘layer’,’my_counts_key’), … For details see counts(). The counts are only used if reads is True.

Returns:

A DataFrame containing the compositions of groups.