read.ncdf: incorrect number of dimensions when reading a single frame and at.sel is not null

Issue #336 resolved
Edwin Aponte created an issue

Hi,

When I try to read a single frame from a netcdf trajectory while at the same time selecting some atoms I get (e.g):

ttraj <- read.ncdf("/tmp/traj_4531/prod_00001.nc",first=100,last=100,at.sel=peptide)
 [1] "Reading file /tmp/traj_4531/prod_00001.nc"
 [1] "Produced by program: pmemd"
 [1] "File conventions AMBER version 1.0"
 [1] "Frames: 2000"
 [1] "Atoms: 37822"
 Error in coords[, atom.ind - first.atom + 1, ] :                                                                       
   incorrect number of dimensions

===============

But if I select more than one frame, e.g. first=100,last=101 or if I leave at.sel as NULL, then I am able to read the trajectory.

Thanks

Comments (7)

  1. Barry Grant

    Thanks for reporting this Edwin. Can you first check your atom.select() object peptide is of class "select" and contains a populated $xyz component. e.g.

    > class(peptide)
    [1] "select"
    > head(peptide$xyz)
    [1]  4  5  6 28 29 30
    

    If all looks well could you then please upload a small example trajectory and pdb for selection that produces this problem here (or share via Dropbox etc.). Thanks!

  2. Xinqiu Yao

    Hi Edwin,

    Thanks for spotting this! I fixed it just now (See this commit).

    Update your bio3d with either releases or master branch to have the bugfix. See also here for how to install bio3d other than from CRAN.

    Note that you will not get the bugfix by directly typing e.g. update.packages(bio3d) since we haven't published it on CRAN yet (It will be done in next bio3d release).

  3. Log in to comment