Question: Why the PCA results of PCASamples() from methylkit is different from prcomp()?
0
gravatar for maria2019
10 months ago by
maria2019100
maria2019100 wrote:

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
  
ADD COMMENTlink modified 10 months ago • written 10 months ago by maria2019100
1
gravatar for maria2019
10 months ago by
maria2019100
maria2019100 wrote:

I just realized that transpose=FALSE in PCASamples gives the same results as prcomp.

pca <- PCASamples(meth, obj.return=TRUE,transpose=FALSE) 
pca
ADD COMMENTlink modified 10 months ago • written 10 months ago by maria2019100
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1823 users visited in the last hour