, key='rank_features_groups', groupby=None, key_added='rank_features_groups_filtered', min_in_group_fraction=0.25, min_fold_change=1, max_out_group_fraction=0.5)[source]#

Filters out features based on fold change and fraction of features containing the feature within and outside the groupby categories.

See rank_features_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) – Annotated data matrix.

  • key – Key previously added by rank_features_groups()

  • groupby – The key of the observations grouping to consider.

  • key_added – The key in adata.uns information is saved to.

  • min_in_group_fraction – Minimum in group fraction (default: 0.25).

  • min_fold_change – Miniumum fold change (default: 1).

  • max_out_group_fraction – Maximum out group fraction (default: 0.5).

Return type:



Same output as but with filtered feature names set to nan


>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>>, "service_unit")