dotools_py.pl.TestData#

class dotools_py.pl.TestData(data, feature, cond_key, ctrl, groups, category_key=None, category_order=None, test=None, test_correction=None)[source]#

Class to perform test in AnnData or Pandas DataFrames.

Class to perform statistical test between two or multiple conditions in an AnnData or pandas DataFrame (long format). Different statistical test can be used including: wilcoxon, t-test, kruskal, anova, logreg, t-test_overestim_var. Additionnally, different correction methods can be used for multiple testing (bonferroni and benjamini-hochberg)

Note

t-test_overestim_var and logreg is only available for AnnData input and anova and kruskal is only available for pandas dataframe

Parameters:
data DataFrame | AnnData

annotated data matrix or pandas dataframe.

feature str

var_name or obs column in the AnnData or column in the pandas dataframe to test.

cond_key str

obs column or column in the dataframe with condition information.

ctrl str

control condition.

groups list

list of conditions

test Literal['wilcoxon', 't-test', 'kruskal', 'anova', 'logreg', 't-test_overestim_var'] (default: None)

method to use for testing significance (‘wilcoxon’, ‘t-test’, ‘kruskal’, ‘anova’, ‘logreg’, ‘t-test_overestim_var’).

test_correction Literal['benjamini-hochberg', 'bonferroni'] (default: None)

correction method for multiple testing to use (‘benjamini-hochberg’, ‘bonferroni’)

category_key str (default: None)

column with categorical metadata to split by (e.g., cell type annotation). The test will be done for each category across each condition.

category_order list (default: None)

order for the categories in category_key. If not specified will be inferred

See also

dotools_py.pl.StatsPlotter()

class to plot the p-values in barplots, boxplots or violinplots

Methods table#

pvalues()

Get list with the p-vals from the test.

pvalues_labels()

Get list with the labels of the group tested.

run_test()

Method to run test.

Methods#

classmethod TestData.pvalues()[source]#

Get list with the p-vals from the test. If category_key is not set the order of the pvals match the order of the labels in groups. :return:

classmethod TestData.pvalues_labels()[source]#

Get list with the labels of the group tested. The order matches the order of the pvals attribute. Only initialize if the hue category_key is set. :return:

TestData.run_test()[source]#

Method to run test.

Returns:

None