Error in write.ncdf and Error in view.dccm
i am new on R so i am facing too much troubles but i want solve them i also have issue with the following two commands i don't know how to install ncdf and how can i see the result on pymol in the next command please help me from the scratch i will be very thank full to you. write.ncdf(p1, "trj_pc1.nc") Error in write.ncdf(p1, "trj_pc1.nc") : Please install the ncdf package from CRAN
view.dccm(cij, pdb, launch=TRUE) Error in view.dccm(cij, pdb, launch = TRUE) : object 'cij' not found
Comments (25)
-
-
Hi,
To install ncdf, type following command in R:
install.packages('ncdf')
Make sure above process does not give any error. To test it, type
library(ncdf)
when the installation process is finished. If there is no output, the package is successfully installed.About the second question, it is merely because you don't have the object named 'cij' in your current R workspace. Type
ls()
to list all your current objects. Note that if you go through a tutorial, make sure you start from the beginning and practice every step all through the document. This will generate all necessary objects needed to run each command.Let me know if your question resolved or not.
Btw, I may suggest you learn a little bit R basics before going deeply into bio3d. A good start would be Quick-R: http://www.statmethods.net/index.html. Also go to the official manual if you want a more complete reference: http://cran.r-project.org/manuals.html
-
reporter R generates this warning message all the i put this command in R . Warning message: In install.packages("ncdf") : installation of package ‘ncdf’ had non-zero exit status
library(ncdf) Error in library(ncdf) : there is no package called ‘ncdf’
-
Hi Ayesha, Can you copy and paste more of the messages from the installation? You probably lack the netcdf library in your system (i.e. not in R). The ncdf R package depends on the netcdf library. Please see our installation instructions.
Are you using Ubuntu or similar the netcdf library can be installed by
apt-get install netcdf-bin libnetcdf-dev
-
reporter i already had install these two libraries. ayesha@ayesha-Inspiron-3521[ayesha] sudo apt-get install netcdf-bin libnetcdf-dev [sudo] password for ayesha: Reading package lists... Done Building dependency tree
Reading state information... Done libnetcdf-dev is already the newest version. netcdf-bin is already the newest version. 0 to upgrade, 0 to newly install, 0 to remove and 7 not to upgrade. ayesha@ayesha-Inspiron-3521[ayesha] [ 6:46PM] -
reporter i think R could not detect the pathway where these libraries exist but i don't know how to find the path . and how to change it .
-
so what is being outputted when installing? do you see something like this ?
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c ncdf.c -o ncdf.o gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c ncdf2.c -o ncdf2.o gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/include -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c ncdf3.c -o ncdf3.o gcc -m64 -std=gnu99 -shared -L/usr/lib64/R/lib -Wl,-z,relro -o ncdf.so ncdf.o ncdf2.o ncdf3.o -lnetcdf -L/usr/lib64/R/lib -lR installing to /home/slars/R/x86_64-redhat-linux-gnu-library/3.1/ncdf/libs
-
reporter the terminal showed this message
ayesha@ayesha-Inspiron-3521[ayesha] sudo apt-get install ncdf [ 6:58PM] [sudo] password for ayesha: Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package ncdf ayesha@ayesha-Inspiron-3521[ayesha] -
reporter Unable to locate package ncdf
-
reporter it give this output
installing source package ‘ncdf’ ... package ‘ncdf’ successfully unpacked and MD5 sums checked checking for nc-config... /usr/local/bin/nc-config configure: creating ./config.status config.status: creating src/Makevars libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf.c -o ncdf.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf2.c -o ncdf2.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf3.c -o ncdf3.o gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ncdf.so ncdf.o ncdf2.o ncdf3.o -L/usr/local/lib -lnetcdf -L/usr/lib/R/lib -lR /usr/bin/ld: /usr/local/lib/libnetcdf.a(attr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libnetcdf.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make: *** [ncdf.so] Error 1 ERROR: compilation failed for package ‘ncdf’ * removing ‘/home/ayesha/R/x86_64-pc-linux-gnu-library/3.2/ncdf’
-
uh.. I haven't seen this before, but did you try what the compiler suggests you to do? i.e. recompile with -fPIC ?
-
Hi,
Try these command to install ncdf binary directly:
sudo add-apt-repository -y "ppa:marutter/rrutter" sudo add-apt-repository -y "ppa:marutter/c2d4u" sudo apt-get update -qq sudo apt-get install -y r-cran-ncdf
-
reporter Lars i didn't try what compiler suggest to do.
-
reporter i installed ncdf binary directly and it give the following result ayesha@ayesha-Inspiron-3521[ayesha] sudo add-apt-repository -y "ppa:marutter/rrutter" [sudo] password for ayesha: gpg: keyring
/tmp/tmppi7h9lu8/secring.gpg' created gpg: keyring
/tmp/tmppi7h9lu8/pubring.gpg' created gpg: requesting key B04C661B from hkp server keyserver.ubuntu.com gpg: /tmp/tmppi7h9lu8/trustdb.gpg: trustdb created gpg: key B04C661B: public key "Launchpad PPA for marutter" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK ayesha@ayesha-Inspiron-3521[ayesha] sudo add-apt-repository -y "ppa:marutter/c2d4u" gpg: keyring/tmp/tmpttd9bzun/secring.gpg' created gpg: keyring
/tmp/tmpttd9bzun/pubring.gpg' created gpg: requesting key B04C661B from hkp server keyserver.ubuntu.com gpg: /tmp/tmpttd9bzun/trustdb.gpg: trustdb created gpg: key B04C661B: public key "Launchpad PPA for marutter" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK ayesha@ayesha-Inspiron-3521[ayesha] sudo apt-get update -qq [10:58PM]ayesha@ayesha-Inspiron-3521[ayesha] [11:00PM] ayesha@ayesha-Inspiron-3521[ayesha] sudo apt-get install -y r-cran-ncdf Reading package lists... Done Building dependency tree
Reading state information... Done The following NEW packages will be installed r-cran-ncdf 0 to upgrade, 1 to newly install, 0 to remove and 121 not to upgrade. Need to get 104 kB of archives. After this operation, 198 kB of additional disk space will be used. Get:1 http://ppa.launchpad.net/marutter/c2d4u/ubuntu/ trusty/main r-cran-ncdf amd64 1.6.8-1cran2ppa0 [104 kB] Fetched 104 kB in 1s (74.5 kB/s)
Selecting previously unselected package r-cran-ncdf. (Reading database ... 409323 files and directories currently installed.) Preparing to unpack .../r-cran-ncdf_1.6.8-1cran2ppa0_amd64.deb ... Unpacking r-cran-ncdf (1.6.8-1cran2ppa0) ... Setting up r-cran-ncdf (1.6.8-1cran2ppa0) ... -
I can't see any problem from above message. Can you try
library(ncdf)
again in R and see if it can be loaded correctly? -
reporter after that when i put install.packages('ncdf') command in R it again shows Error
install.packages('ncdf') Installing package into ‘/home/ayesha/R/x86_64-pc-linux-gnu-library/3.2’ (as ‘lib’ is unspecified) --- Please select a CRAN mirror for use in this session --- trying URL 'http://ftp.iitm.ac.in/cran/src/contrib/ncdf_1.6.8.tar.gz' Content type 'application/x-gzip' length 82067 bytes (80 KB) ================================================== downloaded 80 KB * installing source package ‘ncdf’ ... package ‘ncdf’ successfully unpacked and MD5 sums checked checking for nc-config... /usr/local/bin/nc-config configure: creating ./config.status config.status: creating src/Makevars libs gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf.c -o ncdf.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf2.c -o ncdf2.o gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/local/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ncdf3.c -o ncdf3.o gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o ncdf.so ncdf.o ncdf2.o ncdf3.o -L/usr/local/lib -lnetcdf -L/usr/lib/R/lib -lR /usr/bin/ld: /usr/local/lib/libnetcdf.a(attr.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC /usr/local/lib/libnetcdf.a: error adding symbols: Bad value collect2: error: ld returned 1 exit status make: *** [ncdf.so] Error 1 ERROR: compilation failed for package ‘ncdf’ * removing ‘/home/ayesha/R/x86_64-pc-linux-gnu-library/3.2/ncdf’ The downloaded source packages are in ‘/tmp/RtmpQqO3Iz/downloaded_packages’ Warning message: In install.packages("ncdf") : installation of package ‘ncdf’ had non-zero exit status
-
Don't run
install.packages()
. Trylibrary(ncdf)
directly. -
reporter now by putting commands write.ncdf(p1, "trj_pc1.nc") in R it show no error but also show no structure too now what will be missing from my side that it show structure.
#! rd <- rmsd(xyz[1,ca.inds$xyz], xyz[,ca.inds$xyz]) > > plot(rd, typ="l", ylab="RMSD", xlab="Frame No.") > points(lowess(rd), typ="l", col="red", lty=2, lwd=2) > rf <- rmsf(xyz[,ca.inds$xyz]) > plot(rf, ylab="RMSF", xlab="Residue Position", typ="l") > pc <- pca.xyz(xyz[,ca.inds$xyz]) > plot(pc, col=bwr.colors(nrow(xyz)) ) > > plot.bio3d(pc$au[,1], ylab="PC1 (A)", xlab="Residue Position", typ="l") > points(pc$au[,2], typ="l", col="blue") > p1 <- mktrj.pca(pc, pc=1, b=pc$au[,1], file="pc1.pdb") > p2 <- mktrj.pca(pc, pc=2,b=pc$au[,2], file="pc2.pdb") > write.ncdf(p1, "trj_pc1.nc") >
-
Hi,
Please copy and paste ALL the output! From above I can't see any error message. Also make sure you put RETURN after each command, otherwise it very difficult to read your post.
Btw, have you tried
library(ncdf)
? How did it go? -
reporter yes i tried library(ncdf) it show no error and cursor move to the next line and show nothing. The same thing now happens when i put command write.ncdf(p1,"trj_pc1.nc") it show no graphically output and also show no error how can i visualize the structure ?
> library(bio3d) > dcdfile <- system.file("examples/hivp.dcd", package="bio3d") > pdbfile <- system.file("examples/hivp.pdb", package="bio3d") > dcd <- read.dcd(dcdfile) NATOM = 198 NFRAME= 351 ISTART= 0 last = 351 nstep = 351 nfile = 351 NSAVE = 1 NDEGF = 0 version 24 |======================================================================| 100% > pdb <- read.pdb(pdbfile) > print(pdb) Call: read.pdb(file = pdbfile) Total Models#: 1 Total Atoms#: 198, XYZs#: 594 Chains#: 2 (values: A B) Protein Atoms#: 198 (residues/Calpha atoms#: 198) Nucleic acid Atoms#: 0 (residues/phosphate atoms#: 0) Non-protein/nucleic Atoms#: 0 (residues: 0) Non-protein/nucleic resid values: [ none ] Protein sequence: PQITLWQRPLVTIKIGGQLKEALLDTGADDTVLEEMSLPGRWKPKMIGGIGGFIKVRQYD QILIEICGHKAIGTVLVGPTPVNIIGRNLLTQIGCTLNFPQITLWQRPLVTIKIGGQLKE ALLDTGADDTVLEEMSLPGRWKPKMIGGIGGFIKVRQYDQILIEICGHKAIGTVLVGPTP VNIIGRNLLTQIGCTLNF + attr: atom, helix, sheet, seqres, xyz, calpha, remark, call > print(pdb$xyz) Total Frames#: 1 Total XYZs#: 594, (Atoms#: 198) [1] 51.842 59.784 -6.815 <...> 55.089 55.232 -6.899 [594] + attr: Matrix DIM = 1 x 594 > print(dcd) Total Frames#: 351 Total XYZs#: 594, (Atoms#: 198) [1] 51.842 59.784 -6.815 <...> 31.859 72.527 -31.861 [208494] + attr: Matrix DIM = 351 x 594 > 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) > dim(xyz) == dim(dcd) [1] TRUE TRUE > p1 <- mktrj.pca(pc, pc=1, b=pc$au[,1], file="pc1.pdb") Error in mktrj.pca(pc, pc = 1, b = pc$au[, 1], file = "pc1.pdb") : object 'pc' not found > p2 <- mktrj.pca(pc, pc=2,b=pc$au[,2], file="pc2.pdb") Error in mktrj.pca(pc, pc = 2, b = pc$au[, 2], file = "pc2.pdb") : object 'pc' not found > rd <- rmsd(xyz[1,ca.inds$xyz], xyz[,ca.inds$xyz]) > > plot(rd, typ="l", ylab="RMSD", xlab="Frame No.") > points(lowess(rd), typ="l", col="red", lty=2, lwd=2) > rf <- rmsf(xyz[,ca.inds$xyz]) > plot(rf, ylab="RMSF", xlab="Residue Position", typ="l") > pc <- pca.xyz(xyz[,ca.inds$xyz]) > plot(pc, col=bwr.colors(nrow(xyz)) ) > plot.bio3d(pc$au[,1], ylab="PC1 (A)", xlab="Residue Position", typ="l") > points(pc$au[,2], typ="l", col="blue") > p1 <- mktrj.pca(pc, pc=1, b=pc$au[,1], file="pc1.pdb") > p2 <- mktrj.pca(pc, pc=2,b=pc$au[,2], file="pc2.pdb") > write.ncdf(p1, "trj_pc1.nc") >
-
It seems you have already installed the ncdf successfully!
It is normal that 'write.ncdf()' doesn't show any message: It write a file to your hard disk! (look at your local directory and you will find the file named trj_pc1.nc)
To open it, you need another software called VMD (http://www.ks.uiuc.edu/Research/vmd/). For example, from your shell command line, type
vmd pc1.pdb trj_pc1.nc
.Also, I suggest you go through our tutorials to learn how bio3d actually works and what results are expected from what function. http://thegrantlab.org/bio3d/tutorials
Let me know if you still have any question.
-
reporter yes its working thank you
-
reporter i have a question if i want to embed these R codes into python through Rpy2 is that possible ?
-
It is possible but please do note that we do not provide user support for Rpy2 As politely hinted at previously you may be best placed RTFM-ing...
-
- changed status to resolved
- Log in to comment