Hi,
I'm trying to understand what exactly is done by the dba.plotPCA function from DiffBind. I tried to reconstruct the plot generated by dba.plotPCA but for some reason I get a different plot. Could you please check what I tested and tell me what is done differently by the dba.plotPCA function?
Thanks!
Razvan
Here is what I've tried (I used DiffBind_1.14.6):
library(DiffBind)
data(tamoxifen_peaks)
dba.plotPCA(tamoxifen)
# Trying to reproduce the plot
counts = dba.peakset(tamoxifen, bRetrieve=TRUE)
counts = as.data.frame(mcols(counts))
counts = data.matrix(counts)
pca = princomp(counts, cor = FALSE)
loadings = unclass(pca$loadings)
dat = data.frame(Tissue = tamoxifen$samples$Tissue,
PC1 = loadings[,1],
PC2 = loadings[,2])
library(ggplot2)
p = ggplot(dat, aes(PC1,PC2))
p + geom_point(size=5,aes(colour = Tissue)) + theme_bw()
# The 2 plot are different...
Hi Rory,
Thanks for the link, but some of the counts given by "counts = dba.peakset(tamoxifen, bRetrieve=TRUE)" are "-1" so I can't take logarithm of that... Can you please check once more my example and tell me what is done differently by DiffBind?
Thanks,
Razvan