Question: To What Degree Could We Determine Whether A Gene Is Expressed?
gravatar for liupfskygre
6.9 years ago by
United States
liupfskygre190 wrote:

Hi all, A question came to my mind when analysis gene expression using RNA-seq. After using DEseq2, a large number of genes were listed as differential expressed (e.g. FDR<0.01 or 0.05, absolute of log2 fold change >1). When took look at the FPKM of those genes, lots of them were very small. I think took all of them for further analysis is time consuming and also included a bunch of noises.

I saw a paper use the FPKM of one housekeeping gene they used to do QPCR as the cutoff. (

In my opinion, use the mean FPKM (total FPKM of genes/gene number) of each condition as a cutoff/threshold might be a choice.

Any other thoughts on this issue are greatly appreciated!

fpkm rna-seq • 6.1k views
ADD COMMENTlink modified 6.0 years ago by cankutcubuk170 • written 6.9 years ago by liupfskygre190

Are you removing genes with very low overall read counts from your analysis?

ADD REPLYlink written 6.7 years ago by Biomonika (Noolean)3.1k
gravatar for Ryan Dale
6.9 years ago by
Ryan Dale4.9k
Bethesda, MD
Ryan Dale4.9k wrote:

This 2013 BMC Genomics paper describes zFPKM, which they use to set a single threshold for yes/no expression across a bunch of experiments. Their methods are clear and straightforward to implement -- here's how you might calculate zFPKM in Python:

from scipy.stats import gaussian_kde
import numpy as np

# assume "fpkm" is a NumPy array of log2(fpkm) values.

kernel = gaussian_kde(fpkm)
xi = np.linspace(fpkm.min(), fpkm.max(), 100)
yi = kernel.evaluate(xi)
mu = xi[np.argmax(yi)]
U = fpkm[fpkm > mu].mean()
sigma = (U - mu) * np.sqrt(np.pi / 2)
zFPKM = (fpkm - mu) / sigma

Then you can choose a zFPKM value to use as your threshold. They chose zFPKM = -3 for human RNA-seq after comparing with active/repressive histone mod data.

ADD COMMENTlink written 6.9 years ago by Ryan Dale4.9k

thank you! this is what I am looking for!

ADD REPLYlink written 6.9 years ago by liupfskygre190

Hi Daler! I am new to programming and am having some trouble creating a NumPy array. When I use kernel=gaussian_kde(fpkm), I get this error:

>>> kernel=gaussian_kde(fpkm1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/stats/", line 188, in __init__
    raise ValueError("`dataset` input should have multiple elements.")
ValueError: `dataset` input should have multiple elements.

I was wondering if you could please explain how to create a NumPy array from an Excel, .txt or .csv file? I appreciate your help so much!

ADD REPLYlink written 6.3 years ago by kdixo1000

It's impossible to tell what happened here without knowing how you created fpkm1. But you might want to take a look at the NumPy genfromtxt() docs or the Pandas IO tools documentation.

ADD REPLYlink modified 6.3 years ago • written 6.3 years ago by Ryan Dale4.9k

Okay thank you! I'll take a look at those.

ADD REPLYlink written 6.3 years ago by kdixo1000
gravatar for cankutcubuk
6.0 years ago by
cankutcubuk170 wrote:


Can I apply the zFPKM approach by RPKM data(zRPKM)?

Or which kind of normalization methods are compatible with this method?

By the way, here you can find the R script for zFPKM normalization.

I inspired from the python code which has given above.



/* fpkm is an example data */

fpkm <- c(1,2,3,4,5,6,7,8,4,5,

xi = linspace(min(fpkm),max(fpkm),100)
fhat = kde(x=fpkm,gridsize=100,eval.points=xi)

/* here I put digits=0. if I you do not round the numbers(yi) the results are a little bit changing.*/

yi = round(fhat$estimate,digits=0) 
mu = xi[which.max(yi)]
U = mean(fpkm[fpkm>mu])
sigma = (U-mu)* (sqrt(pi/2))
zFPKM = (fpkm - mu) / sigma

Cankut CUBUK
Computational Genomics Program - Systems Genomics Lab
Centro de Investigación Príncipe Felipe (CIPF)
C/ Eduardo Primo Yúfera nº3 46012 Valencia, Spain

ADD COMMENTlink modified 12 months ago by _r_am32k • written 6.0 years ago by cankutcubuk170


I was trying to use your script in R, but maybe there are some problem with infinite values.

As far as I understood, the idea is use logFPKM as input, isn't it?

when I run the script I have this error:

Error en seq.default(x1, x2, length.out = n) :
  'from' cannot be NA, NaN or infinite

Maybe you can help me to resolve it? thanks!!

ADD REPLYlink modified 13 months ago by _r_am32k • written 5.2 years ago by tialuisi0

I already resolve the problem of infinite values, however the zFPKM that I obtained are all positive... so I consider that there is other problem...

ADD REPLYlink written 5.2 years ago by tialuisi0
gravatar for Charles Warden
6.7 years ago by
Charles Warden8.0k
Duarte, CA
Charles Warden8.0k wrote:

I use log2(RPKM + 0.1) values for differential expression to minimize the number of low coverage genes with unreasonably high differential expression values.

You can see the relevant benchmarks for various rounding values here:

The portions of that paper comparing differential expression algorithms are also summarized in this blog post:

ADD COMMENTlink written 6.7 years ago by Charles Warden8.0k
gravatar for jockbanan
6.9 years ago by
Czech Republic
jockbanan390 wrote:

From my (limited) experience: If you want more conservative results, try the newest approach from EdgeR package - function glmQLFTest(). It always gave me smaller number of significant genes than DEseq2 and classic EdgeR (in the form that is described in manual), as well as other tools like CLCBio. In addition, no or almost no genes reported by glmQLFTest() were tool-specific. It seems to report almost exactly genes reported by all the other tools I tried and no more, which makes me believe in these results a bit more. It may of course not work this way with your data and you will probably need to set some cutoff even if it will, but it is something to start with.

ADD COMMENTlink written 6.9 years ago by jockbanan390

thanks for this suggestion. I will try it later!

ADD REPLYlink written 6.9 years ago by liupfskygre190
gravatar for Michael Love
6.7 years ago by
Michael Love2.1k
United States
Michael Love2.1k wrote:

Can you clarify, is your question how to tell if a gene is expressed, or differentially expressed?

In the latest release of DESeq2, we have implemented functionality to test for differential expression above a critical threshold, as sometimes users are not interested in all statistically significant genes, but actually wanted to find large fold changes. This can be accomplished in with:

results(dds, lfcThreshold=x, altHypothesis="greaterAbs")

Where x is the critical threshold specified by the user. The fold changes are in the log2 space, so x=1 finds fold changes > 2 and < 1/2, x=2 finds fold changes > 4 and < 1/4, etc. Note that this will provide p-values testing the null hypothesis that |β| < x, which is not the same as testing the null of |β| = 0 and filtering out |β| < x.

ADD COMMENTlink modified 12 months ago by _r_am32k • written 6.7 years ago by Michael Love2.1k

liupfskygre was hoping for a method to determine expression (presumably akin to that used by mas5 on affy arrays), mostly as a method for filtering DE results. Of course there's no great biological definition to go by there, so any answer would be a bit hand wavy. BTW, welcome to biostars.

ADD REPLYlink written 6.7 years ago by Devon Ryan98k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2071 users visited in the last hour