Skip to content
Prev 4090 / 21312 Next

[Bioc-devel] Biostrings: XStringViews subsetting operator does not reduce element metadata

Hi Jirka,

Clearly a bug. Thanks for the catch!

The regression was introduced a couple of years ago when the definition
of the Views class was modified. Should be fixed in IRanges release
(1.16.6) and devel (1.17.34). Both should become available via
biocLite() in the next 24 hours or so.

FWIW I did a systematic tour of the "[" methods that are defined for
Vector subclasses in the IRanges package, and found that all of them
are now propagating and subsetting the metadata columns, except the
method for Rle objects, which drops them:

   x <- Rle(13:11, 1:3)
   mcols(x) <- DataFrame(aa=letters[1:6])

Then:

   > x
   integer-Rle of length 6 with 3 runs
     Lengths:  1  2  3
     Values : 13 12 11
   > mcols(x)
   DataFrame with 6 rows and 1 column
              aa
     <character>
   1           a
   2           b
   3           c
   4           d
   5           e
   6           f
   > x[2:1]
   integer-Rle of length 2 with 2 runs
     Lengths:  1  1
     Values : 12 13
   > mcols(x[2:1])
   NULL

I didn't touch that one though. Not sure putting metadata cols on an Rle
is a good idea in the first place, because it kind of defeats the
purpose of using an Rle. I suspect this is the reason why Rle's cannot
receive names:

   > names(x) <- LETTERS[1:6]
   Error in names(x) <- LETTERS[1:6] : class 'Rle' has no 'names' slot

so it's kind of unexpected that you can put metadata cols on them.

Cheers,
H.
On 02/21/2013 04:46 AM, Ji?? Hon wrote: