rtracklayer cannot export empty BED file
1
0
Entering edit mode
foehn ▴ 100
@foehn-16281
Last seen 3.3 years ago
United States

Hello,

I found one issue with rtracklayer's export.bed function. It seems that it cannot export an empty GRanges object. For example,

> export(GRanges(), con = "test.bed")
Error in `$<-.data.frame`(`*tmp*`, "score", value = 0) :
  replacement has 1 row, data has 0
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.6

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] rtracklayer_1.38.3   GenomicRanges_1.30.3 GenomeInfoDb_1.14.0
[4] IRanges_2.12.0       S4Vectors_0.16.0     BiocGenerics_0.24.0

loaded via a namespace (and not attached):
 [1] lattice_0.20-35            matrixStats_0.54.0        
 [3] XML_3.99-0                 Rsamtools_1.30.0          
 [5] Biostrings_2.46.0          GenomicAlignments_1.14.1  
 [7] bitops_1.0-6               grid_3.4.1                
 [9] zlibbioc_1.24.0            XVector_0.18.0            
[11] Matrix_1.2-14              BiocParallel_1.12.0       
[13] tools_3.4.1                Biobase_2.38.0            
[15] RCurl_1.96-0               DelayedArray_0.4.1        
[17] compiler_3.4.1             SummarizedExperiment_1.8.1
[19] GenomeInfoDbData_0.99.1

Actually, this problem seems to be related to Why export of empty GRanges to GFF fails?, where it was reported that export.gff raised an error upon an empty object.

Can anybody give a look?

Thanks

rtracklayer bed genomicranges • 1.5k views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 3.1 years ago
United States

Thanks, should be fixed inĀ 1.42.1.

ADD COMMENT
0
Entering edit mode

Thanks for prompt reply. The current release version is 1.42.0 and devel version 1.43.0. Does it mean I need to install from the devel channel?

ADD REPLY
0
Entering edit mode

Please wait a day or so for 1.42.1 to hit the repository.

ADD REPLY
0
Entering edit mode

Just tried out v1.43.0 from bioc v3.9 (devel, which depends on R 3.6). Unfortunately it didn't work...

> export(GRanges(), con = "test.bed")
Error in `$<-.data.frame`(`*tmp*`, score, value = 0) :
  replacement has 1 row, data has 0
> sessionInfo()
R Under development (unstable) (2018-11-18 r75627)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 16299)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] rtracklayer_1.43.0   GenomicRanges_1.35.1 GenomeInfoDb_1.19.1  IRanges_2.17.1       S4Vectors_0.21.5     BiocGenerics_0.29.1  BiocManager_1.30.4   BiocInstaller_1.30.0

loaded via a namespace (and not attached):
 [1] XVector_0.23.0              zlibbioc_1.29.0             GenomicAlignments_1.19.0    BiocParallel_1.17.1         lattice_0.20-38             tools_3.6.0                
 [7] SummarizedExperiment_1.13.0 grid_3.6.0                  Biobase_2.43.0              matrixStats_0.54.0          Matrix_1.2-15               GenomeInfoDbData_1.2.0     
[13] bitops_1.0-6                RCurl_1.95-4.11             DelayedArray_0.9.0          compiler_3.6.0              Biostrings_2.51.1           Rsamtools_1.35.0           
[19] XML_3.98-1.16            
ADD REPLY
0
Entering edit mode

It's 1.43.1 in devel. If you want to get the fix right now, you'll need to get it out of git.

ADD REPLY
0
Entering edit mode

OK, got you, thanks.

ADD REPLY

Login before adding your answer.

Traffic: 561 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