Can be extracted the conformer list for any PC?

Issue #362 resolved
Abraham Vidal created an issue

Hi guys, just before I begin with the question, gotta say that since I met Bio3D, the way I analyse simulations has changed FOREVER! Anyway, I came up now with this silly question about the conformers on a PC group: is it possible to extract a list of the conformers grouped on a PC? Best regards,, Abe Vidal

Comments (5)

  1. Xinqiu Yao

    Hi,

    You can do it by clustering structures in PCs first with e.g. hclust() function and then cut the cluster tree to generate group ID for each structure. With these group IDs you can locate all the structures in a particular group. For example,

    # distant matrix based on PC1-PC2
    dm <- dist(pc$z[, 1:2])
    
    # clustering
    hc <- hclust(dm)
    
    # cut the tree. Note that the parameter k, the number of groups you want, is empirical. 
    # Usually, we check the clustering by 'plot(hc)' and determine what is a suitable value for k.
    grps <- cutree(hc, k=3)
    
    # the indices of structures for group No. 2
    inds <- which(grps==2)
    
    # get the C-alpha coordinates of group No.2 structures (Suppose you use 'pdbs' to do the PCA).
    xyz <- pdbs$xyz[inds, ]
    
    # Or, get the file names/PDB IDs for those structures for further analysis
    ids <- pdbs$id[inds]
    

    Let me know if it solves your problem.

  2. Abraham Vidal reporter

    Hi Xin-Qiu, thank you very much for the advice. Nevertheless i'm analysing a trajectory from MD and performed PCA with ca.inds:

    Superposing frames to PDB

    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)

    and then perform the

    PCA

    pc <- pca.xyz(xyz[,ca.inds$xyz])

    So, my question is, should i use xyz <- ca.inds$xyz[inds, ] instead of xyz <- pdbs$xyz[inds, ], that you suggested, to get the frames on every pc?

    Thanks in advance,, Abe

  3. Xinqiu Yao

    ca.inds contains indices for "CA" atoms while inds is the indices for structures. They are of completely different meaning and you can not use like ca.inds$xyz[inds, ]. The way I suggested will give the XYZ coordinates of a particular group. If you want the frame No. of the group, just use the grps. Or, do you mean something else?

  4. Abraham Vidal reporter

    Dear Xin, your explanation really helped me a lot to obtain xyz coordinates. Besides, grps content was my real goal,, Thank you very much,, Abe Vidal

  5. Log in to comment