This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Getting FPKM value from edgeR software

Hi all,

I have done differential expression analysis with edgeR and now I'm trying to extract FPKM value from this tool, but it gave me an error all the time. Could you please take a look at the code and help me to solve the problem.

 targets <- read.delim("targets.txt", stringsAsFactors=FALSE)
targets3
 Label Treatment  line time
1    CS   control sensitive    0
2   DS6      drug sensitive    6
3    CT   control  tolerant    0
4   DT6      drug tolerant    6
5  DT24     drug  tolerant   24
expressioncount <- read.delim("rawcount.txt", row.names=1)
colnames(expressioncount) <- substring(colnames(expressioncount),1,6)
dim(expressioncount)
[1] 78970      6
> head(expressioncount)
         length CS DS6 CT DT6 DT24
 c51581_g1_i1    462  0   2  1   1    0
 c19380_g1_i1    439  3   0  2   0    2
c4832_g1_i1     665  0   2  0   7   23
c25894_g1_i1    402  0   1  1   1    3
c37752_g4_i1    736  2   4  2   3    2
c557_g1_i1      434  7   0  4   0    0

y <- DGEList(expressioncount[,2:6])
keep <- rowSums(cpm(y) > 1) >= 1
y <- calcNormFactors(y)
y$samples
group lib.size norm.factors
CS       1 20146232    1.1727230
DS6      1 19308652    0.9188417
CT       1 19792940    1.2271948
DT6      1 19051509    0.9463686
DT12     1 17752012    0.7990795
RPKM <- rpkm(y)
**Error in rpkm.DGEList(y) : Gene lengths not found**

Please kindly share me your helpful comments and suggestions.

Thank you in advance

edger fpkm value error

2 answers

help(rpkm), which will tell you that you need to input lengths for each of the genes.

The gene length was included, please see head(expressioncount). Sorry, I have not enough experience with this software and the manual wasn't helpful on this issue. So, please help me to solve the problem, here.

The lengths aren't in y, so rpkm can't see them. You want rpkm(y, gene.length=expressioncount$length).

Thank you very much, Devon. It worked well.

If you have count table with length column in the end (tab-separated), try this script.

Note:

1) Header should start with #

2) First column gene name followed by counts in other columns ans the last colum with length.

https://github.com/santhilalsubhash/rpkm_rnaseq_count/blob/master/README.md

Sorry that I could not able to help you using edgeR.

Log in to answer this question.