[BioC] Bug in G/IRanges when slicing with an Rle containing only 1 runLength/value

Steve Lianoglou mailinglist.honeypot at gmail.com
Thu Sep 30 02:16:29 CEST 2010


Hi,

Subject says it all (I think), and I don't believe I've seen it reported before:

R> library(GenomicRanges)
R> gr <- GRanges(seqnames='chr1', IRanges(1:5, width=10), strand='+')
R> gr[strand(gr) == '+']
Error in .IRanges.checkAndTranslateSingleBracketSubscript(x, i) :
  invalid subscript type

R> gr2 <- gr
R> strand(gr2)[5] <- '-'
R> gr2[strand(gr2) == '+']
GRanges with 4 ranges and 0 elementMetadata values
    seqnames    ranges strand |
       <Rle> <IRanges>  <Rle> |
[1]     chr1   [1, 10]      + |
[2]     chr1   [2, 11]      + |
[3]     chr1   [3, 12]      + |
[4]     chr1   [4, 13]      + |


R> gr[Rle(rep(TRUE, 5))]
Error in .IRanges.checkAndTranslateSingleBracketSubscript(x, i) :
  invalid subscript type

R>  gr[Rle(c(rep(TRUE, 4), F))]
GRanges with 4 ranges and 0 elementMetadata values
    seqnames    ranges strand |
       <Rle> <IRanges>  <Rle> |
[1]     chr1   [1, 10]      + |
[2]     chr1   [2, 11]      + |
[3]     chr1   [3, 12]      + |
[4]     chr1   [4, 13]      + |

sessionInfo()
R version 2.13.0 Under development (unstable) (2010-09-20 r52948)
Platform: x86_64-apple-darwin10.4.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] GenomicRanges_1.1.25 IRanges_1.7.37

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the Bioconductor mailing list