How to extrat data from PCA and increase font size

Issue #403 resolved
wangwang1992 created an issue

Hi,i am beginner about Bio3d. Now,when i plot PCA and DCCM,i want to increase font size(mian title and subheading、X,Y axis) and extrat data form PCA

       dcd <- read.dcd(dcdfile)
       pdb <- read.pdb(pdbfile)
       ca.inds <- atom.select(pdb, elety="CA")
       xyz <- fit.xyz(fixed=pdb$xyz, mobile=dcd,
       fixed.inds=ca.inds$xyz,
       mobile.inds=ca.inds$xyz)
       cij<-dccm(xyz[,ca.inds$xyz])
       plot(cij)

DCCM.jpg The font size of Plot is too small,i want to enlarge it. and ,

      pc <- pca.xyz(xyz[,ca.inds$xyz])
      plot(pc, col=bwr.colors(nrow(xyz)) ) 
  i want to extrat PCA data,but i donot konw,i try "write.table(pc,file="PCA.txt")"and i am false.

 In this I hope for your help

Comments (4)

  1. Xinqiu Yao

    Hi,

    The plot allows a fine control via a relatively complicated mechanism. Detail has been documented in the help page of the xyplot() function in the lattice package (which is the basis of the plot.dccm() function). Check it by typing help(lattice::xyplot).

    For your specific request, i.e. to enlarge fonts, try following command:

    plot.dccm(cij, scales=list(cex=1.5), colorkey=list(labels=list(cex=1)), 
       xlab=list(cex=1.5, label='Residue No.'), ylab=list(cex=1.5, label='Residue No.'), 
       main=list(cex=1.5, label='Dynamic Cross Correlation Map'))
    

    For your second question: What did you mean by "extract PCA data"? Are they the eigenvectors, eigenvalues, or the new coordinates of structures in the PC space? Usually, we use plot.pca() to show how the input structures spread in the PC subspace (along with the variance captured by the subspace e.g. PC1 and PC2). Then, use the mktrj() to generate a "trajectory" file to show the collective motion revealed by each PC (see the help with ?mktrj). This function will create a PDB file, which you can open it with e.g. VMD or Pymol.

    Hope it will help.

  2. Lars Skjærven

    See documentation for pca.xyz (i.e. ?pca.xyz) for details on the PCA object and how to access it's data.

    You can access the eigenvectors (if that's what you want) through the U attribute of the pca object (i.e. pc$U). That's a matrix of 3N x 3N (where N is the number of atoms). You can then easily write the eigenvectors to file e.g. with function write.table.

    write.table(matrix(pc$U[,1], ncol=3, byrow=TRUE), file="pc1.dat", col.names=FALSE)
    
  3. Log in to comment