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

Martin Morgan mtmorgan at fhcrc.org
Thu Sep 30 18:02:41 CEST 2010


On 09/29/2010 05:16 PM, Steve Lianoglou wrote:
> 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

Thanks, fixed in 1.1.31. Martin

> 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
>



More information about the Bioconductor mailing list