, *, key=None, groupby=None, use_raw=None, key_added='rank_genes_groups_filtered', min_in_group_fraction=0.25, min_fold_change=1, max_out_group_fraction=0.5, compare_abs=False)[source]#

Filters out genes based on log fold change and fraction of genes expressing the gene within and outside the groupby categories.

See rank_genes_groups().

Results are stored in adata.uns[key_added] (default: ‘rank_genes_groups_filtered’).

To preserve the original structure of adata.uns[‘rank_genes_groups’], filtered genes are set to NaN.

adata AnnData

key str | None (default: None)

groupby str | None (default: None)

use_raw bool | None (default: None)

key_added str (default: 'rank_genes_groups_filtered')

min_in_group_fraction float (default: 0.25)

min_fold_change int | float (default: 1)

max_out_group_fraction float (default: 0.5)

compare_abs bool (default: False)

If True, compare absolute values of log fold change with min_fold_change.

Return type:



Same output as but with filtered genes names set to nan


>>> import scanpy as sc
>>> adata = sc.datasets.pbmc68k_reduced()
>>>, 'bulk_labels', method='wilcoxon')
>>>, min_fold_change=3)
>>> # visualize results
>>>, key='rank_genes_groups_filtered')
>>> # visualize results using dotplot
>>>, key='rank_genes_groups_filtered')