Hello Gordon,
I am using edgeR to do pairwise comparison for 3 conditions. The avg values for each condition are:
AVG_C1 : 1596
AVG_C2: 1354
AVG_R: 1934
C1 vs. R gives me logFC of -0.333
and C2 vs. R gives me logFC of 0.066
logFC of -0.33 indicates the gene is down regulated in C1 - which is correct looking at the avg values.
However, logFC of 0.066 indicates that the gene is up-regulated in C2 - which s NOT correct looking at the avg values.
I get correct sign for some genes, while others don't seem right. I am not worried about the magnitude.
I've checked my code, but not sure why there is discrepancy in the sign for logFC:
counts <- read.table( file = "juanCounts.txt" , header = TRUE, row.names=1)
A <- c("C2")
B <- c("R")
n <- as.numeric(4)
group <- c(rep(A, n) , rep(B, n))
counts<- data.frame(counts[,grep(paste(c(A,B),collapse="|"),names(counts))])
cds <- DGEList( counts, group = group )
cds <- calcNormFactors( cds )
cds <- estimateCommonDisp( cds )
cds <- estimateTagwiseDisp( cds )
de.cmn <- exactTest( cds , pair = c( A,B ) )
resultsTbl.cmn <- topTags( de.cmn , n = nrow( de.cmn$table ) )$table
Could you please advice if I missed something. If it's helpful I could send you the counts matrix.
Thanks for all the help.
I only see two groups in your code: R2 and C. Where's C1?
The edgeR code has only 2 groups for pairwise comparison. For C1 vs. R comparison, I modify A and B as:
A <- c("C1")
B <- c("R")
The point I am trying to make is that the sign for the logFC doesn't seem right.
Another example for C1 vs. R comparison is:
Gene1:
AVG_C1 : 18274
AVG_R: 2140
logFC is -0.35
Gene2:
AVG_C1 : 18791
AVG_R: 22027
logFC is -0.19
For Gene1 , avg C1 > avg R, and logFC sign is negative
For Gene2, avg C1 < avg R, and logFC sign is also negative.
If the sign is based on Condition 1 then shouldn't the logFC be positive for gene1 and negative for gene2.
Could someone help with this issue.
Thanks