question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

filter_rank_genes_groups fold change calculation

See original GitHub issue

filter_rank_genes_groups handles log values differently than the rank_genes_groups function. The discrepancy gives different DE gene lists when filtering genes based on log2fc_min=1 with get.rank_genes_groups_df vs min_fold_change=2 with tl.filter_rank_genes_groups

In rank_genes_groups, np.expm1 is used:

foldchanges = (np.expm1(means[imask]) + 1e-9) / (np.expm1(mean_rest) + 1e-9)
rankings_gene_logfoldchanges.append(np.log2(foldchanges[global_indices]))

In filter_rank_genes_groups, np.exp is used:

if log:
    fold_change_matrix.loc[:, cluster] = (np.exp(mean_obs.loc[True]) / np.exp(mean_obs.loc[False])).values

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Koncopdcommented, Jul 31, 2020

@ivirshup yes, i’ll check.

0reactions
racngcommented, Jun 8, 2022

Looks like this has been fixed. There is an option now to compare absolute fold changes if you set compare_abs=True.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Moderated estimation of fold change and dispersion for ... - NCBI
Ranking by fold change, on the other hand, is complicated by the noisiness of LFC estimates for genes with low counts. Furthermore, the...
Read more >
Filtering by fold change
I am performing differential gene expression using DESeq2 but will be subsetting transcripts based on a pre-determined criterion. Does this… selection of probes ......
Read more >
scanpy.tl.filter_rank_genes_groups - Read the Docs
Filters out genes based on log fold change and fraction of genes expressing the gene within and outside the groupby categories. See rank_genes_groups()...
Read more >
filter_rank_genes_groups fold change calculation #863
filter_rank_genes_groups handles log values differently than the rank_genes_groups function. The discrepancy gives different DE gene lists ...
Read more >
GFOLD: a generalized fold change for ranking differentially ...
Results: We present the GFOLD (generalized fold change) algorithm to produce biologically meaningful rankings of differentially expressed genes from RNA-seq ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found