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.