Hi, Exporting a GRanges object to the 'bigwig' format with rtracklayer fails if not all seqlevels are used: #+BEGIN_SRC R library(rtracklayer) library(GenomicRanges) ## example data example(GRanges) lg = reduce(unstrand(longGR)) lg$score = 1:6 ## full one works export(lg, tempfile(), "bw") ## works ## generally works if all seqlevels are used lg1 = lg[c(1, 3, 5)] export(lg1, tempfile(), "bw") ## works ## subset works if all seqlevels are used lg2 = lg[1:4] export(lg2, tempfile(), "bw") ## fails lg3 = keepSeqlevels(lg2, unique(as.character(seqnames(lg2)))) export(lg3, tempfile(), "bw") ## works #+END_SRC This fails with the latest bioc-devel (rtracklayer_1.23.18) and works with bioc-stable. A solution may be to remove unused seqlevels in the object, perhaps with a warning/message that not all seqlevels were exported. Best wishes Julian
[Bioc-devel] rtracklayer: Export to bigwig with unused seqlevels
3 messages · Julian Gehring, Michael Lawrence
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/bioc-devel/attachments/20140328/15823029/attachment.pl>
2 days later
Hi Michael, Thanks, works all fine now. Best wishes Julian
On 28/03/14 22:05, Michael Lawrence wrote:
Thanks, should be resolved in 1.23.20 (devel).
On Fri, Mar 28, 2014 at 8:09 AM, Julian Gehring <julian.gehring at embl.de
<mailto:julian.gehring at embl.de>> wrote:
Hi,
Exporting a GRanges object to the 'bigwig' format with rtracklayer fails
if not all seqlevels are used:
#+BEGIN_SRC R
library(rtracklayer)
library(GenomicRanges)
## example data
example(GRanges)
lg = reduce(unstrand(longGR))
lg$score = 1:6
## full one works
export(lg, tempfile(), "bw") ## works
## generally works if all seqlevels are used
lg1 = lg[c(1, 3, 5)]
export(lg1, tempfile(), "bw") ## works
## subset works if all seqlevels are used
lg2 = lg[1:4]
export(lg2, tempfile(), "bw") ## fails
lg3 = keepSeqlevels(lg2, unique(as.character(seqnames(lg2))))
export(lg3, tempfile(), "bw") ## works
#+END_SRC
This fails with the latest bioc-devel (rtracklayer_1.23.18) and works
with bioc-stable.
A solution may be to remove unused seqlevels in the object, perhaps with
a warning/message that not all seqlevels were exported.
Best wishes
Julian
_______________________________________________
Bioc-devel at r-project.org <mailto:Bioc-devel at r-project.org> mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel