scanpy.tl.filter_rank_genes_groups

scanpy.tl.filter_rank_genes_groups(adata, key=None, groupby=None, use_raw=True, log=True, key_added='rank_genes_groups_filtered', min_in_group_fraction=0.25, min_fold_change=2, max_out_group_fraction=0.5)

Filters out genes based on 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.

Parameters
adata : AnnData

key

groupby

use_raw

log : if true, it means that the values to work with are in log scale

key_added

min_in_group_fraction

min_fold_change

max_out_group_fraction

Returns

Same output as scanpy.tl.rank_genes_groups but with filtered genes names set to nan

Examples

>>> adata = sc.datasets.pbmc68k_reduced()
>>> sc.tl.rank_genes_groups(adata, 'bulk_labels', method='wilcoxon')
>>> sc.tl.filter_rank_genes_groups(adata, min_fold_change=3)
>>> # visualize results
>>> sc.pl.rank_genes_groups(adata, key='rank_genes_groups_filtered')
>>> # visualize results using dotplot
>>> sc.pl.rank_genes_groups_dotplot(adata, key='rank_genes_groups_filtered')