[Bioc-devel] bgzip does not seem to close all file handles

Hahne, Florian florian.hahne at novartis.com
Wed Apr 11 16:35:23 CEST 2012

Hi all, Martin,
I just realized that bgzip does not seem to properly clean up after it has

write.table(data.frame(seq="chr1", start=1, end=2, data=10),
file="test/test.txt", sep="\t",  row.names=FALSE, quote=FALSE)
bgzip("test/test.txt", "test/test.tabix")

Now if I try to delete 'test' on an NFS mounted file system I get:
rm -rf test/
rm: cannot remove `test': Directory not empty

And in there I find an NFS file handler:
ls -lah test 
total 12
drwxr-xr-x  2 itox 4096 Apr 11 16:27 .
drwxr-xr-x 16 itox 4096 Apr 11 16:25 ..
-rw-r--r--  1 itox   87 Apr 11 16:26 .nfs00000000001675a200000130

This handler remains in 'test' until I close the R session. I know from
previous experience that our NFS setup is a bit funky, but since I could
clearly pin this down to bgzip I thought it might be something that is
fixable in there. This will not happen on local file systems because they
don't seem to care about open file handles (at least on my Mac)

> sessionInfo()
R Under development (unstable) (2012-04-03 r58904)
Platform: x86_64-unknown-linux-gnu/x86_64 (64-bit)

 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [7] LC_PAPER=C                 LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] Rsamtools_1.8.0     Biostrings_2.24.0   GenomicRanges_1.8.2
[4] IRanges_1.14.2      BiocGenerics_0.2.0  BiocInstaller_1.4.3

loaded via a namespace (and not attached):
[1] bitops_1.0-4.1 stats4_2.16.0  tools_2.16.0   zlibbioc_1.2.0


Florian Hahne
Novartis Institute For Biomedical Research
Translational Sciences / Preclinical Safety / PCS Informatics
Expert Data Integration and Modeling Bioinformatics
CHBS, WKL-135.2.26
Novartis Institute For Biomedical Research, Werk Klybeck
Klybeckstrasse 141
CH-4057 Basel
Phone: +41 61 6967127
Email : florian.hahne at novartis.com

More information about the Bioc-devel mailing list