Hi, I have asked a question here few months back Multi factor design edgeR/Deseq2
I am just trying to learn more rna-seq statistics and R, so I am playing around with the data in edgeR. I have paired samples. When I do plotMDS, few of the paired samples appears very close to each other i.e ( indvidual_1_treated, indvidual_1_Untrt ) ( indvidual_2_treated, indvidual_2_Untrt ) etc. Does it mean the effect of drug is not shown any difference in that individual ? How to interpret this ?
library(edgeR)
raw_counts <- read.table("raw_count_matrix.txt", header=TRUE,sep="\t", row.names=1, as.is=TRUE)
filter <- apply(raw_counts, 1, function(x) length(x[x>5]) >=6)
filtered <- raw_counts[filter,]
treat <- as.factor(rep(c("Treat","Untrt"), each=12))
patient <- as.factor(c(1:12, 1:12))
design <- model.matrix(~patient+treat)
y <- DGEList(counts=filtered)
y <- calcNormFactors(y)
y <- estimateGLMCommonDisp(y,design)
y <- estimateGLMTrendedDisp(y,design)
y <- estimateGLMTagwiseDisp(y,design)
plotMDS(y)

You could also try using
removeBatchEffecton the log-CPMs prior to runningplotMDS, to remove the individual-specific effect on expression that might be dominating the plot.Thanks. I will try that.
Thank you.