dcd file

Issue #96 resolved
Former user created an issue

Dear Lary,

I have used the command given by you to create dcd file. Here I have loaded pdb file from my local computer. I want to carry out PCA analysis for my pdb files. So, to start with, I am analyzing the RMSD and RMSF for the pdb files. I also have another question. Do PCA analysis work for modeled pdb files. I have been using various modules in bio3d, but not been successful. Your help will be highly appreciated pdb <- read.pdb("1d1d", multi=TRUE) write.ncdf(pdb$xyz.models, trjfile="hey.nc")

But it shows the following error as follows....

Loading required package: ncdf Error in write.ncdf(pdb$xyz.models, trjfile = "jc.nc") : Please install the ncdf package from CRAN In addition: Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘ncdf’

Comments (17)

  1. Lars Skjærven

    Please install the ncdf package from CRAN:

    install.packages("ncfd")
    

    see also the installtion instructions on the bio3d website. note that you need netcdf installed on your system.

  2. hema latha

    Dear Lars,

    Thank you for the message. I will do that and get back to you if I encounter any problems.

    Thanks, Hema.

  3. Barry Grant

    I am going to close Issue #95 as this is an update on that question.

    I will add that to do this version 2.1.0 or above (as on the new 'feature_pdb_dataframe' and 'feature_visualize_dataframe' branches) entails:

    pdb <- read.pdb("2LWI", multi=TRUE)
    write.ncdf(pdb$xyz, trjfile="mytrj.nc")
    

    Whilst on previous versions 2.0.1 and below, the syntax is slightly different:

    pdb <- read.pdb("2LWI", multi=TRUE)
    write.ncdf(pdb$xyz.models, trjfile="mytrj.nc")
    
  4. hema latha

    I have installed R version 3.1.1 and when I tried to install ncdf package, I got the following error...

    package ‘ncfd’ is not available (for R version 3.1.1)

    How do I fix this? please let me know.

  5. hema latha

    Dear Xin-Qiu,

    Thank you for the message. I could install ncdf package with correct letters typed.

    But when I load the pdb file, it is loading properly. and when I want to convert it into dcd format using ncdf package, it is showing the following error.

    pdb <- read.pdb("4AIC.pdb", multi=TRUE) HEADER OXIDOREDUCTASE 09-FEB-12 4AIC
    PDB has ALT records, taking A only, rm.alt=TRUE write.ncdf(pdb$xyz, trjfile="mytrj.nc") Error in write.ncdf(pdb$xyz, trjfile = "mytrj.nc") : input x should be a natom by nframe numeric matrix of coordinates

    could you please kindly let me know how to fix this...

    Thank you in advance.

  6. hema latha

    I have also tried by using this

    write.ncdf(pdb$xyz.models, trjfile="mytrj.nc")

    it is popping up the same error as above mentioned perviously....

  7. Lars Skjærven

    hmm... Are you sure that 4AIC is a multi model PDB file? Try to see what type of object you have stored in your pdb$xyz and pdb$xyz.models attributes. The xyz should be a numeric vector (and not a matrix which is needed for write.ncdf). I'm guessing your pdb$xyz.models is NULL. Correct?

  8. hema latha

    4AIC is the crystal structure and yes it is pdb file.....that I have directly dowloaded from rcsb site. it is numeric vector.

  9. hema latha

    I have done the following to check the pdb file and here is the output for your reference

    print(pdb)

    Call: read.pdb(file = file.choose())

    Atom Count: 6181

    Total ATOMs#: 5562 Protein ATOMs#: 5562 ( Calpha ATOMs#: 758 ) Non-protein ATOMs#: 0 ( residues: ) Chains#: 2 ( values: A B )

    Total HETATOMs: 619 Residues HETATOMs#: 263 ( residues: FOM NDP MN SO4 HOH ) Chains#: 2 ( values: A B )

    Sequence: GRLRVVVLGSTGSIGTQALQVIADNPDRFEVVGLAAGGAHLDTLLRQRAQTGVTNIAVAD EHAAQRVGDIPYHGSDAATRLVEQTEADVVLNALVGALGLRPTLAALKTGARLALANKES LVAGGSLVLRAARPGQIVPVDSEHSALAQCLRGGTPDEVAKLVLTASGGPFRGWSAADLE HVTPEQAGAHPTWSMGPMNTLNSASLVNKGLEVIETHLLFGIPYD...<cut>...VSGM

    • attr: atom, het, helix, sheet, seqres, xyz, xyz.models, calpha, call

      print(xyz) Error in print(xyz) : object 'xyz' not found length(pdb$xyz) [1] 16686

  10. Lars Skjærven
    pdb <- read.pdb("4AIC", multi=TRUE)
    
    # the following attribute is NULL
    pdb$xyz.models
    
    # 1D1D is a multi model PDB file:
    pdb <- read.pdb("1D1D", multi=TRUE)
    class(pdb$xyz.models)
    [1] "matrix"
    
    dim(pdb$xyz.models)
    [1]    20 10185
    
    # write.ncdf() takes a matrix as input
    write.ncdf(pdb$xyz.models, "test.nc")
    
    # if your input is a numeric vector you need to convert it to a matrix:
    write.ncdf(matrix(pdb$xyz, nrow=1), "test.nc")
    

    What I was trying to say above is that 4AIC is not a multi-model PDB file. You should make sure you understand what object types you are working with (i.e. difference between numeric vector and matrix), and what the specific functions you want to use take as input arguments.

    Hope this helps.

  11. hema latha

    ok. so, in order to convert to dcd file, the pdb file should be multi-model.

    4AIC is not multi-model pdb and its pdb$xyz.models is NULL. therefore, what I understand from your message is, it is not possible for this protein to convert it into dcd file. is that so?

    Could you please explain how should I proceed if the pdb file is not multi-model.

    Thank you in advance.

    Hema

  12. Lars Skjærven

    As mentioned in my previous post:

    # if your input is a numeric vector you need to convert it to a matrix:
    write.ncdf(matrix(pdb$xyz, nrow=1), "test.nc")
    
  13. Log in to comment