ehrapy.anndata.get_rank_features_df

ehrapy.anndata.get_rank_features_df(adata, group, *, key='rank_features_groups', pval_cutoff=None, log2fc_min=None, log2fc_max=None, features=None)[source]

ehrapy.tl.rank_features_groups() results in the form of a DataFrame.

Parameters:
  • adata (AnnData) – AnnData object to get values from.

  • group (str | Iterable[str]) – Which group (as in ehrapy.tl.rank_genes_groups()’s groupby argument) to return results from. Can be a list. All groups are returned if groups is None.

  • key (str) – Key differential groups were stored under.

  • pval_cutoff (float | None) – Return only adjusted p-values below the cutoff.

  • log2fc_min (float | None) – Minimum logfc to return.

  • log2fc_max (float | None) – Maximum logfc to return.

  • features (str | None) – Column name in .var DataFrame that stores gene symbols. Specifying this will add that column to the returned DataFrame.

Returns:

A Pandas DataFrame of all rank genes groups results.

Examples

>>> import ehrapy as ep
>>> adata = ep.dt.mimic_2(encoded=True)
>>> ep.tl.rank_features_groups(adata, "service_unit")
>>> df = ep.ad.get_rank_features_df(adata, group="FICU")