dynamo.tl.top_n_markers(adata, with_moran_i=False, group_by='test_group', sort_by='specificity', sort_order='decreasing', top_n_genes=5, exp_frac_thresh=0.1, log2_fc_thresh=None, qval_thresh=0.05, specificity_thresh=0.3, only_gene_list=False, display=True)[source]

Filter cluster deg (Moran’s I test) results and retrieve top markers for each cluster.

  • adata (AnnData) – an Annodata object

  • with_moran_i (bool (default: False)) – Whether or not to include Moran’s I test results for selecting top marker genes.

  • group_by (str or list (default: test_group)) – Column name or names to group by.

  • sort_by (str or list) – Column name or names to sort by.

  • sort_order (str (default: decreasing)) – Whether to sort the data frame with increasing or decreasing order.

  • top_n_genes (int) – The number of top sorted markers.

  • exp_frac_thresh (float (default: 0.1)) – The minimum percentage of cells with expression for a gene to proceed selection of top markers.

  • log2_fc_thresh (None or float (default: None)) – The minimal threshold of log2 fold change for a gene to proceed selection of top markers. Applicable to none velocity, acceleration or curvature layers based DEGs.

  • qval_thresh (float (default: 0.05)) – The maximal threshold of qval to be considered as top markers.

  • only_gene_list (bool) – Whether to only return the gene list for each cluster.

  • display (bool) – Whether to print the data frame for the top marker genes after the filtering.


A data frame that stores the top marker for each group or just a list for those markers, depending on whether only_gene_list is set to be True. In addition, it will display the data frame depending on whether display is set to be True.