API

Import diffxpy’s high-level API as:

import diffxpy.api as de

Differential expression tests: test

Run differential expression tests. diffxpy distinguishes between single tests and multi tests: Single tests perform a single hypothesis test for each gene whereas multi tests perform multiple tests per gene.

Single tests per gene

Single tests per gene are the standard differential expression scenario in which one p-value is computed per gene. diffxpy provies infrastructure for likelihood ratio tests, Wald tests, t-tests and Wilcoxon tests.

test.two_sample(data, grouping[, ...])

Perform differential expression test between two groups on adata object for each gene.

test.wald(data[, factor_loc_totest, ...])

Perform Wald test for differential expression for each gene.

test.lrt(data, full_formula_loc, ...[, ...])

Perform log-likelihood ratio test for differential expression for each gene.

test.t_test(data, grouping[, gene_names, ...])

Perform Welch's t-test for differential expression between two groups on adata object for each gene.

test.rank_test(data, grouping[, gene_names, ...])

Perform Mann-Whitney rank test (Wilcoxon rank-sum test) for differential expression between two groups on adata object for each gene.

Multiple tests per gene

diffxpy provides infrastructure to perform multiple tests per gene as:

  • pairwise: pairwise comparisons across more than two groups (de.test.pairwise, e.g. clusters of cells against each other)

  • versus_res:t tests of each group against the rest (de.test.versus_test, e.g. clusters of cells against the rest)

  • partition: mapping a given differential test across each partition of a data set (de.test.partition, e.g. performing differential tests for treatment effects by a second experimental covariate or by cluster of cells).

test.pairwise(data, grouping[, as_numeric, ...])

Perform pairwise differential expression test between two groups on adata object for each gene for all combinations of pairs of groups.

test.versus_rest(data, grouping[, ...])

Perform pairwise differential expression test between two groups on adata object for each gene for each groups versus the rest of the data set.

test.partition(data, parts[, gene_names, ...])

Perform differential expression test for each group.

Gene set enrichment: enrich

diffxpy provides infrastructure for gene set enrichment analysis downstream of differential expression analysis. Specifically, reference gene set annotation data sets can be loaded or created and can be compared to diffxpy objects or results from other differential expression tests.

Reference gene sets

enrich.RefSets([sets, fn, type])

Class for a list of gene sets.

Enrichment tests

enrich.test(ref[, det, scores, gene_ids, ...])

Perform gene set enrichment.

Fit model to gene expression: fit

Diffxpy allows the user to fit models to gene expression only without conducting Wald or likelihood ratio tests. Note that one can also extract similar model fits from differential expression test output objects if Wald or likelihood ratio test were used. Alternatively, residuals can also be directly computed. As for differential expression tests, the fitting can be distributed across multiple partitions of the data set (such as conditions or cell types).

fit.model(data[, formula_loc, ...])

Fit model via maximum likelihood for each gene.

fit.residuals(data[, formula_loc, ...])

Fits model for each gene and returns residuals.

fit.partition(data, parts[, gene_names, ...])

Perform differential expression test for each group.