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

Julian Gehring julian.gehring at embl.de
Fri Mar 28 16:09:30 CET 2014


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



More information about the Bioc-devel mailing list