Entering edit mode
6.7 years ago
gtasource
▴
60
Hello,
I am trying to use edgeR to calculate RPKM values. However, when I have searched for help on this topic. I've still not been able to make sense of the existing R codes to work for me. Here's my current code:
data_raw <- read.table("counts.txt", header = TRUE)
group <- c(rep("Sample1",2),rep("Sample1",2))
d <- DGEList(counts = data_raw, group=group)
gene.data <- read.table("gene_lengths.txt", header=FALSE)
m <- match(rownames(d), gene.data$Transcript)
gene.lengths <- gene.data$TranscriptLength[m]
rpkm<-rpkm(d,gene.data)
My gene lengths file looks like this:
Gene1 35029
Gene2 72475
Gene3 48792
Gene4 46840
As you can see, I understand that there is limitation in only having two reps. But if anybody could help with this code, or lead me to a tutorial, that would be great.
What is the problem? Do you get an error message? What message, at which step?
After the RPKM step, I receive this errror:
Yes because your code is wrong.
Example:
’gene.data’ has extra column of gene names in the first column. It just needs gene length colum. Try this in your above code, it might work.
Else below mentioned complete sample code will perfectly work.
Why do you have same sample names ('Sample1') for both group. I assume it is,
Sample Code: