how to close a hdf5 file
1
0
Entering edit mode
Guest User ★ 13k
@guest-user-4897
Last seen 9.7 years ago
I am using the rhdf5 library to create HDF5 files. h5createFile(myHDF5FileName) h5createDataset(myHDF5FileName,"myData",storage.mode="double",level=9, dims=length(myData), chunk=10000) h5write(myData,myHDF5FileName,"myData") Works fine, except that when I tried to delete the physical file Windows 7 tells me that the file is still open in RStudio, i.e. the file handle seems to be open in my RStudio environment, but I couldn't find any function to close the hdf5 connection. The manual seems to indicate that there is a H5Fopen and H5Fclose function and I tried them too, but I still cannot delete the physical file UNLESS I quit RStudio. There is another function H5close(), but when I tried that I get an error Error: could not find function "H5close" -- output of sessionInfo(): R version 3.0.3 (2014-03-06) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C [5] LC_TIME=English_United States.1252 attached base packages: [1] compiler stats graphics grDevices utils datasets methods base other attached packages: [1] rhdf5_2.6.0 RcppRoll_0.1.0 RcppArmadillo_0.4.200.0 Rcpp_0.11.1 [5] data.table_1.9.2 loaded via a namespace (and not attached): [1] plyr_1.8.1 reshape2_1.2.2 stringr_0.6.2 tools_3.0.3 zlibbioc_1.8.0 -- Sent via the guest posting facility at bioconductor.org.
rhdf5 rhdf5 • 2.9k views
ADD COMMENT
0
Entering edit mode
Bernd Fischer ▴ 550
@bernd-fischer-5348
Last seen 7.4 years ago
Germany / Heidelberg / DKFZ
Dear Uday Maitra! Unfortunately, I cannot reproduce your error. On my windows 7 I can delete the file, while rstudio is still open. Maybe it is related to your special dataset. If you use the h5 functions (lower case h) and give the filename and dataset as a character vector, the file is closed automatically before the function returns. Only if you use the H5 functions (capital H), and explicitly open a file or dataset with file = H5Fopen("A.h5") dataset = H5Dopen(file, name="/D") you have to close the dataset and file after reading ( e.g. D = H5Dread(dataset) ) with H5Dclose(dataset) H5Fclose(file) On 15.04.2014, at 01:44, Uday Maitra [guest] <guest@bioconductor.org> wrote: > > I am using the rhdf5 library to create HDF5 files. > > h5createFile(myHDF5FileName) > > h5createDataset(myHDF5FileName,"myData",storage.mode="double",level= 9,dims=length(myData), chunk=10000) > > h5write(myData,myHDF5FileName,"myData") > > Works fine, except that when I tried to delete the physical file Windows 7 tells me that the file is still open in RStudio, i.e. the file handle seems to be open in my RStudio environment, but I couldn't find any function to close the hdf5 connection. > > The manual seems to indicate that there is a H5Fopen and H5Fclose function and I tried them too, but I still cannot delete the physical file UNLESS I quit RStudio. > > There is another function H5close(), but when I tried that I get an error Error: could not find function "H5close" > > > -- output of sessionInfo(): > > R version 3.0.3 (2014-03-06) > Platform: x86_64-w64-mingw32/x64 (64-bit) > > locale: > [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 > [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C > [5] LC_TIME=English_United States.1252 > > attached base packages: > [1] compiler stats graphics grDevices utils datasets methods base > > other attached packages: > [1] rhdf5_2.6.0 RcppRoll_0.1.0 RcppArmadillo_0.4.200.0 Rcpp_0.11.1 > [5] data.table_1.9.2 > > loaded via a namespace (and not attached): > [1] plyr_1.8.1 reshape2_1.2.2 stringr_0.6.2 tools_3.0.3 zlibbioc_1.8.0 > > > -- > Sent via the guest posting facility at bioconductor.org. > > _______________________________________________ > Bioconductor mailing list > Bioconductor@r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor [[alternative HTML version deleted]]
ADD COMMENT

Login before adding your answer.

Traffic: 642 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6