scanpy.queries.enrich

scanpy.queries.enrich(container, *, org='hsapiens', gprofiler_kwargs={})

Get enrichment for DE results.

This is a thin convenience wrapper around the very useful gprofiler.

This method dispatches on the first argument, leading to the following two signatures:

enrich(container, ...)
enrich(adata: AnnData, group, key: str, ...)

Where:

enrich(adata, group, key, ...) = enrich(adata.uns[key]["names"][group], ...)
Parameters
container : Iterable[str]Iterable[str]

Contains genes you’d like to search.

adata

AnnData object whose group will be looked for.

group

The group whose genes should be used for enrichment.

key

Key in uns to find group under.

org : strstr (default: 'hsapiens')

Organism to query. Must be an organism in ensembl biomart. “hsapiens”, “mmusculus”, “drerio”, etc.

gprofiler_kwargs : MappingMapping[str, Any] (default: {})

Keyword arguments to pass to GProfiler.profile, see gprofiler.

Return type

DataFrameDataFrame

Returns

Dataframe of enrichment results.

Examples

Using sc.queries.enrich on a list of genes:

>>> import scanpy as sc
>>> sc.queries.enrich(['Klf4', 'Pax5', 'Sox2', 'Nanog'], org="hsapiens")

Using sc.queries.enrich on an anndata.AnnData object:

>>> pbmcs = sc.datasets.pbmc68k_reduced()
>>> sc.tl.rank_genes_groups(pbmcs, "bulk_labels")
>>> sc.queries.enrich(pbmcs, "CD34+")