I have the 'meth' object for my samples and I wanted to see more PCAs.
I realized that PCs from PCASamples are different from what I calculate:
Using PCASamples():
library(methylKit)
meth <-readRDS(file="~/files/meth.rds")
pca <- PCASamples(meth, obj.return=TRUE)
pca$x
PC1 PC2 PC3 PC4 PC5 PC6
sample1 54.7917242 78.835727 -146.389741 -88.0073775 -129.179034 -48.83519
sample2 45.8439749 79.986099 -132.748956 -115.7681777 -182.780012 -18.20983
sample3 -35.5084338 359.737490 -139.675979 340.2946409 178.827413 -49.74668
sample4 -0.8435795 169.940509 -87.345883 84.1664145 56.099736 -58.92960
Using prcomp():
library(methylKit)
meth <-readRDS(file="~/files/meth.rds")
mat=percMethylation(meth)
pca <- prcomp(mat)
pca
PC1 PC2 PC3 PC4 PC5
Sample1 -0.2238237 0.0888081766 -0.27426209 2.240539e-01 -0.128535081
Sample2 -0.2242289 0.0725052576 -0.26868740 2.560139e-01 -0.140892847
Sample3 -0.2227445 -0.0067194119 -0.45275679 -3.366611e-01 0.203404391
Sample4 -0.2230264 0.0068922158 -0.34130776 -2.185143e-01 0.139594741
methylkit
prcomp
pca
pcasamples
multiplepca