R/Rstudio: using rtracklayer to import bigwig files from http works with MacOS but not with Windows
1
0
Entering edit mode
sla • 0
@65226e26
Last seen 2.6 years ago
Denmark

We are using the package 'rtracklayer' to load and manipulate bigwig files as part of a larger script. We need to access bigwig files from an http-server, and we can do this smoothly on MacOS, but we can’t get it to work on Windows machines – while local bigwig files can be imported, the http-accessed files can not.

Any tips?

The following example should be generally accessible:

if (!requireNamespace("BiocManager", quietly = TRUE)){
    install.packages("BiocManager")
    BiocManager::install("rtracklayer")
}

library(rtracklayer)

bw = 'http://genome-ftp.mbg.au.dk/public/THJ/Seq2PlotR/examples/tracks/HeLa_3pseq/siGFP_xPAP_in_batch1_plus.bw'

rtracklayer::import.bw(bw)

Which gives the following error message (or similar) on various Windows machines (works on various MacOS computers):

Error in seqinfo(ranges) : UCSC library operation failed

In addition: Warning message:

In seqinfo(ranges) : Invalid argument

mustOpenFd: Can't open http://genome-ftp.mbg.au.dk/public/THJ/Seq2PlotR/examples/tracks/HeLa_3pseq/siGFP_xPAP_in_batch1_plus.bw to read

Importantly, the file can be accessed in other ways from the computer and R(studio):

download.file(bw, "bw1")

trying URL 'http://genome-ftp.mbg.au.dk/public/THJ/Seq2PlotR/examples/tracks/HeLa_3pseq/siGFP_xPAP_in_batch1_plus.bw'

Content type '' length 2469907 bytes (2.4 MB)

downloaded 2.4 MB

SessionInfo from RStudio:

R version 3.5.1 (2018-07-02)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:

[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252

[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C

[5] LC_TIME=English_United Kingdom.1252

attached base packages:

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

other attached packages:

[1] rtracklayer_1.42.2 GenomicRanges_1.34.0 GenomeInfoDb_1.18.2 IRanges_2.16.0 S4Vectors_0.20.1

[6] BiocGenerics_0.28.0

loaded via a namespace (and not attached):

[1] XVector_0.22.0 zlibbioc_1.28.0 GenomicAlignments_1.18.1 BiocParallel_1.16.6

[5] lattice_0.20-41 tools_3.5.1 SummarizedExperiment_1.12.0 grid_3.5.1

[9] Biobase_2.42.0 matrixStats_0.56.0 Matrix_1.2-18 GenomeInfoDbData_1.2.0

[13] BiocManager_1.30.16 bitops_1.0-6 RCurl_1.98-1.2 DelayedArray_0.8.0

[17] compiler_3.5.1 Biostrings_2.50.2 Rsamtools_1.34.1 XML_3.99-0.3

Exactly same problem after upgrading R and rtracklayer:

R version 4.0.3 (2020-10-10)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 10 x64 (build 19043)>

Matrix products: default

locale:

[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252

[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C

[5] LC_TIME=English_United Kingdom.1252

attached base packages:

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

other attached packages:

[1] rtracklayer_1.49.5 GenomicRanges_1.42.0 GenomeInfoDb_1.26.7 IRanges_2.24.1 S4Vectors_0.28.1

[6] BiocGenerics_0.36.1

loaded via a namespace (and not attached):

[1] rstudioapi_0.13 XVector_0.30.0 zlibbioc_1.36.0 GenomicAlignments_1.26.0

[5] BiocParallel_1.24.1 lattice_0.20-45 tools_4.0.3 grid_4.0.3

[9] SummarizedExperiment_1.20.0 Biobase_2.50.0 matrixStats_0.61.0 crayon_1.4.2

[13] Matrix_1.3-4 GenomeInfoDbData_1.2.4 BiocManager_1.30.16 bitops_1.0-7

[17] RCurl_1.98-1.5 DelayedArray_0.16.3 compiler_4.0.3 MatrixGenerics_1.2.1

[21] Biostrings_2.58.0 Rsamtools_2.6.0 XML_3.99-0.8

import.bw rtracklayer Windows http • 2.2k views
ADD COMMENT
0
Entering edit mode
@herve-pages-1542
Last seen 20 hours ago
Seattle, WA, United States

From import.bw's man page (?import.bw):

BigWig Import and Export

Description:

 These functions support the import and export of the UCSC BigWig
 format, a compressed, binary form of WIG/BEDGraph with a spatial
 index and precomputed summaries. These functions do not work on
 Windows.

Cheers,

H.

Edit: Although the error message you get could admittedly be more informative. Please report to the rtracklayer maintainers by opening an issue on GitHub here. Thanks!

ADD COMMENT
0
Entering edit mode

Ooops, I missed that one. Ok, I'll report it on GitHub.

Of note, the functions actually do work on Windows when using local bigwig-files (at least the rtracklayer::import function), and the rtracklayer::import function can access bed-files both locally and from http.

Meanwhile, are there any suggestions for an alternative R package that can rapidly read bigwigs from http? I need to read in the coverage (at nucleotide-resolution) within a specified genomic region. I tried to tweak the megadepth::get_coverage function, but that turns out to be way too slow for this particular job.

ADD REPLY

Login before adding your answer.

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