dynamo.tl.top_n_markers
- 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.
- Parameters:
adata (
AnnData
) – an AnnData object.with_moran_i (
bool
) – whether to include Moran’s I test results for selecting top marker genes. Defaults to False.group_by (
str
) – column name or names to group by. Defaults to “test_group”.sort_by (
Union
[str
,List
[str
]]) – column name or names to sort by. Defaults to “specificity”.sort_order (
Literal
['increasing'
,'decreasing'
]) – whether to sort the data frame with increasing or decreasing order. Defaults to “decreasing”.top_n_genes (
int
) – the number of top sorted markers. Defaults to 5.exp_frac_thresh (
float
) – the minimum percentage of cells with expression for a gene to proceed selection of top markers. Defaults to 0.1.log2_fc_thresh (
Optional
[float
]) – 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. Defaults to None.qval_thresh (
float
) – the maximal threshold of qval to be considered as top markers. Defaults to 0.05.specificity_thresh (
float
) – the minimum threshold of specificity to be considered as top markers. Defaults to 0.3.only_gene_list (
bool
) – whether to only return the gene list for each cluster. Defaults to False.display (
bool
) – whether to print the data frame for the top marker genes after the filtering. Defaults to True.
- Raises:
ValueError – threshold too extreme that no genes passed the filter.
- Return type:
- Returns:
If only_gene_list is false, a data frame that stores the top marker for each group would be returned. Otherwise, a list containing lists of genes in each cluster would be returned. In addition, it will display the data frame depending on whether display is set to be True.