how to save dataset of PCA
Hi,
I found the bio3d package very useful. Because I'm new to R, I'm more used to use Matlab to do the further data processing. I was wondering how to extract/save dataset generated by the command pc <- pca.xyz(xyz[,ca.inds$xyz])?
Also, for the command: plot(pc, col = grps), is grps following the same index order as that in each trajectory?
Thank you very much Xingyu
Comments (4)
-
Account Deactivated -
Hi,
If you just want to reproduce the PC1-PC2 plot, save
pc$z[, 1:2]
as a plain text file and load it in matlab for further processing. For example,write.table(pc$z[, 1:2], file='pc.txt', row.names=FALSE, col.names=FALSE)
.If you got the
grp
from a clustering analysis of the PC1-PC2 projection data, then yes the order of grp is exactly the same as the trajectory. You can save it also, bywrite.table(grp, file='grp.txt', row.names=FALSE, col.names=FALSE)
.Let me know if you have any further questions.
-
Account Deactivated Thank you! It really helps! I have no questions now.
-
- changed status to resolved
- Log in to comment
I raised the question. Also, just to clarify, I want to save the dataset for all the PCs. And want to know if grps records the index of the original trajectory. I really want to use the PCs calculated by you and perfom data processing by myself. (I'll for sure to cite bio3d properly). So I was wondering how can I get all the PCs to draw a PC projection figure like this.
Thank you very much.