anndict.plot.annotate_gene_groups_with_ai_biological_process

anndict.plot.annotate_gene_groups_with_ai_biological_process#

anndict.plot.annotate_gene_groups_with_ai_biological_process(plot_obj, df, groupby, adt_key=None)[source]#

Annotate gene groups on a heatmap with their biological process labels.

This function adds annotations below the x-axis of a heatmap generated by sc.pl.rank_genes_groups_heatmap(), labeling gene groups with their associated biological process descriptions from adt.ai_annotate_biological_process().

Parameters:
plot_obj dict

Output from sc.pl.rank_genes_groups_heatmap, containing matplotlib axes, specifically with the key ‘heatmap_ax’ representing the heatmap axis.

df DataFrame

Output from adt.ai_annotate_biological_process(), containing gene group information with the following columns:

  • f'{groupby}': Identifier for each gene group.

  • f'top_{n_top_genes}_genes': List of gene names in the group.

  • 'ai_biological_process': Biological process label for the group.

group_by

The grouping column name.

adt_key tuple[str, ...] | None (default: None)

Used by adata_dict_fapply() and adata_dict_fapply_return() when passing this function.

groupby str

Return type:

None

Returns:

None

Notes

Modifies plot_obj in-place by adding text annotations.

See also

sc.pl.rank_genes_groups_heatmap()

To generate the plot_obj.

adt.ai_annotate_biological_process()

To annotate the gene sets.