File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,12 +78,26 @@ def extract_marker_genes(
7878 gene_ids_to_name [gene ] for gene in top_genes if gene in gene_ids_to_name
7979 ]
8080
81+ lost_genes = len (top_genes ) - len (markers [cluster_id ])
82+ if lost_genes > 0 :
83+ logger .warning (
84+ f"Number of lost genes ({ lost_genes } ) for group '{ group_name } ' (cluster '{ cluster_id } '). \n "
85+ f"This could indicate inconsistencies with the marker genes and the genes in adata.var."
86+ )
87+
8188 if not any_genes_found :
8289 raise ValueError (
8390 "No marker genes found for any group. This could indicate issues with the "
8491 "rank_genes_groups analysis or that all groups have insufficient marker genes."
8592 )
8693
94+ if not any (markers .values ()):
95+ raise ValueError (
96+ "All marker gene lists are empty. Gene names in rank_genes_groups "
97+ "could not be matched to adata.var_names. This typically happens "
98+ "when var_names were changed after rank_genes_groups was run."
99+ )
100+
87101 return markers
88102
89103
You can’t perform that action at this time.
0 commit comments