decoupler.get_metadata_associations

decoupler.get_metadata_associations(data, obs_keys=None, obsm_key=None, use_X=False, layer=None, uns_key=None, inplace=False, alpha=0.05, method='fdr_bh', verbose=False)

Associate the data to sample metadata using ANOVA. The data can be any kind of embedding stored in a layer, obsm or X matrix.

Requires statsmodels to be installed.

Parameters:
datalist, AnnData or MuData

The input data for ANOVA testing. It can be either a list of two pandas DataFrames [data, obs], an AnnData or MuData object.

obs_keys: list, optional

Column names of obs (sample metadata) which should be tested. If not provided, all columns in obs will be used.

obsm_keystr, optional

A key specifying where in obsm the data is located when providing an AnnData/MuData object. Either obsm_key, use_X, or layer must be specified.

use_Xbool, optional

A boolean flag indicating whether to use the data in .X from the AnnData/MuData object when providing the data. Either obsm_key, use_X, or layer must be specified.

layerstr, optional

Which layer to use when providing an AnnData/MuData object. Either obsm_key, use_X, or layer must be specified.

uns_keystr, optional

Where results will be stored the AnnData/MuData object.

inplacebool, optional

Whether to store the results in the AnnData or MuData object. If False, the function returns a pandas DataFrame with the results.

alphafloat, optional

The significance level for multiple testing correction (default is 0.05).

method(str, optional):

The method used for multiple testing correction. It can be one of the methods supported by statsmodels.stats.multitest.multipletests (default is fdr_bh, i.e., Benjamini-Hochberg method).

verbosebool

Whether to show progress.

Returns:
results: pd.DataFrame

DataFrame with ANOVA results. If data is an AnnData or MuData object and inplace is True, the results are stored in data.uns[uns_key].