Issue with logfoldchanges in scanpy.tl.rank_genes_groups

Hello, I am having problems with the logfoldchanges when running scanpy.tl.rank_genes_groups in my single cell RNA sequencing analysis. I am getting the following error:

RuntimeWarning: invalid value encountered in log2 self.stats[group_name, ‘logfoldchanges’] = np.log2(

Then when I try to see the values they are all nan. Your help is much appreciated. Thank you.

Hello @hbaker,

what count matrix are you using when using scanpy.tl.rank_genes_groups ?
scanpy.tl.rank_genes_groups expects logarithmized data.
Did you use scanpy.pp.log1p to do such transformation on your CPM counts first ?

Have you looked to this issue: Runtime warning by rank_genes_groups · Issue #653 · scverse/scanpy · GitHub ?

Best,
Paul