zhengxwen / gdsfmt

R Interface to CoreArray Genomic Data Structure (GDS) Files (Development version only)
http://www.bioconductor.org/packages/gdsfmt
18 stars 4 forks source link

cannot create gds file on an opened file. #17

Closed liqg closed 7 years ago

liqg commented 7 years ago

Thanks for your work, I feel it is great for handling large data. I am writing a program to efficiently store very large BED file (>19G gz file for 3 billion site scores of whole genome), it is reduced to 3G in GDS format(storage=packedreal16, compress=LZ4_RA). It is great.

However, how to close a file handler which I lose the file handler instead of restarting the R session, for example: ` foo <- function(){ createfn.gds("test.gds") }

foo()

a <- createfn.gds("test.gds") ` I got this:

The file '/home/liqg/rpkg/gdsfmt/test.gds' has been created or opened.

This also happens when using openfn.gds.

Closing the missing file handler is also important when error happens.

Thanks.

zhengxwen commented 7 years ago

You should

foo <- function() {
    f <- createfn.gds("test.gds")
    closefn.gds(f)
}
liqg commented 7 years ago

When the function failed for some reasons after running createfn.gds, how I use createfn.gds on the same file again.

zhengxwen commented 7 years ago

please use showfile.gds(closeall=TRUE).

liqg commented 7 years ago

Got it, Thanks!