[BioC] unexpected result of rep(Rle(), times=<vector or Rle>)
Patrick Aboyoun
paboyoun at fhcrc.org
Mon Feb 1 20:09:39 CET 2010
Chuck,
This was an oversight on my part. I was focused on long Rle vectors and
didn't fully test when the 'times' argument was an integer vector with
the same length as 'x'. I just checked in a patch to the IRanges package
in BioC 2.5 (R 2.10) and BioC 2.6 (R-devel). Given that you are using
BioC 2.5, you will need IRanges version 1.4.11 or greater. It will be
available via biocLite in the next 24 hours or so. If you need it
sooner, you can check it out directly via svn from the Bioconductor
repository.
> suppressMessages(library(IRanges))
> x <- rep(1:4,c(1,2,1,2))
> Rle(rep(x,x))
'integer' Rle of length 16 with 4 runs
Lengths: 1 4 3 8
Values : 1 2 3 4
> rep(Rle(x), x)
'integer' Rle of length 16 with 4 runs
Lengths: 1 4 3 8
Values : 1 2 3 4
> sessionInfo()
R version 2.10.1 (2009-12-14)
x86_64-unknown-linux-gnu
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] IRanges_1.4.11
Patrick
Charles C. Berry wrote:
>
> Using IRanges_1.4.0 here (checked elsewhere with 1.4.8):
>
> I would expect
>
> rep( Rle(x), times=Rle(x) ) == Rle( rep(x, x) )
>
> but
>
>> x <- rep(1:4,c(1,2,1,2))
>> Rle(rep(x,x))
> 'integer' Rle of length 16 with 4 runs
> Lengths: 1 4 3 8
> Values : 1 2 3 4
>> rep(Rle(x),times=Rle(x))
> 'integer' Rle of length 18 with 4 runs
> Lengths: 1 5 3 9
> Values : 1 2 3 4
>> rep(Rle(x),times=x)
> 'integer' Rle of length 18 with 4 runs
> Lengths: 1 5 3 9
> Values : 1 2 3 4
>>
>
> Is this the intended behavior?
>
> If so, why?
>
> Chuck
>
>
>
> Charles C. Berry (858) 534-2098
> Dept of Family/Preventive
> Medicine
> E mailto:cberry at tajo.ucsd.edu UC San Diego
> http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego
> 92093-0901
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list