Skip to content

[Bioc-devel] rtracklayer: Export to bigwig with unused seqlevels

3 messages · Julian Gehring, Michael Lawrence

#
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
2 days later
#
Hi Michael,

Thanks, works all fine now.

Best wishes
Julian
On 28/03/14 22:05, Michael Lawrence wrote: