dotools_py.tl.grouped_ttest

Contents

dotools_py.tl.grouped_ttest#

dotools_py.tl.grouped_ttest(adata, annot_key='annotation', cond_key='condition', batch_key='batch', reference='rest', groups=None, equal_var=True, key_added='grouped_ttest', layer=None, get_results=False)[source]#

Calculate grouped t-test.

This function calculate a grouped t-test for all the genes in each group in annot_key. For each gene, the average expression per sample is employed for the test. If more than two conditions are available, the test will be applied to all possible combinations (for instance, for cond A, B and C; the grouped t-test will be computed for A-Vs-B; A-Vs-C and B-Vs-C). Results are saved as a dataframe in the uns attribute.

Parameters:
adata AnnData

Annotated data matrix.

annot_key str (default: 'annotation')

Column in obs with the cell type annotation.

cond_key str (default: 'condition')

Column in obs with the conditions.

batch_key str (default: 'batch')

Column in obs with the sample IDs.

reference str (default: 'rest')

Reference condition.

groups str | list (default: None)

Alternative conditions.

equal_var bool (default: True)

If set to True, assume equal variance for both populations tested.

key_added str (default: 'grouped_ttest')

Key to use in uns.

layer str (default: None)

Layer of the AnnData object to use.

get_results bool (default: False)

Return a DataFrame with the results.

Return type:

None | DataFrame

Returns:

Returns a DataFrame if get_results is set to True with the results from the differential expression analysis. The DataFrame with the results are also saved in the AnnData in:

adata.uns['grouped_ttest' | key_added].

See also

dotools_py.tl.rank_genes_groups()

run DEA at single-cell level between condition for all genes