atom select over trajectory

Issue #210 resolved
Former user created an issue

Hello,

Currently is there any way to select a group of atoms from a dcd file and extract their xyz coordinates?

For example say if I want to plot the movement of a ligand through the trajectory, would there be any way to explicitly preform this in bio3d or must I use vmd to created a dcd file of only the ligand.

Best, Daniel Moore

Comments (4)

  1. Xinqiu Yao

    Hi Daniel,

    Yes, bio3d provides the function atom.select for the various types of atom selections. Before doing it, you need a PDB file that is corresponding to the simulation trajectory at hand (i.e. having the same number of atoms stored in the same order). Then, perform atom selection on the PDB and use the returned indices to fetch data from DCD. For example, see following simple code snippet:

    pdb <- read.pdb("top.pdb")
    
    # select ligand 
    lig.inds <- atom.select(pdb, "ligand")
    
    # xyz of ligand
    lig.xyz <- xyz[, lig.inds$xyz]
    

    Check out 'help(atom.select)' for more details. Let me know if you still have any question!

  2. Daniel Moore

    Thanks for the quick reply.

    This is fantastic. Its great to see a package being actively developed for protein/trajectory analysis for R.

    Best, Daniel Moore

  3. Log in to comment