[BioC] Recycling vars with IRanges::reflect

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Apr 12 23:03:49 CEST 2010


Hey Patrick,

Just pulled this from SVN, thanks!

-steve


On Mon, Apr 12, 2010 at 4:10 PM, Patrick Aboyoun <paboyoun at fhcrc.org> wrote:
> Steve,
> I'm not sure if this is a doc bug or a bug in code, but either way it was a
> bug. Given that it would be reasonable to recycle the bounds argument to be
> equilength with x, I patched IRanges in BioC 2.6 to perform the recycling.
> This new version of the IRanges package will be available from
> bioconductor.org within 36 hours.
>
>> reflect(IRanges(c(1,20,30), width=5), IRanges(1, 34))
> IRanges of length 3
>    start end width
> [1]    30  34     5
> [2]    11  15     5
> [3]     1   5     5
>>
>> sessionInfo()
> R version 2.11.0 beta (2010-04-12 r51689)
> i386-apple-darwin9.8.0
>
> 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] IRanges_1.5.76
>
>
>
> Cheers,
> Patrick
>
> On 4/12/10 12:22 PM, Steve Lianoglou wrote:
>>
>> Hi all,
>>
>> I was messing around with the IRanges::reflect method, wanting to
>> reflect an IRanges object (with many inner ranges) within 1 large
>> bounds. For instance, something like so:
>>
>> R>  reflect(IRanges(c(1,20,30), width=5), IRanges(1, 34))
>>
>> However I get this message:
>>
>> Error in reflect(IRanges(c(1, 20, 30), width = 5), IRanges(1, 34)) :
>>   'bounds' must be a Ranges object of length equal to that of 'x'
>>
>> Which, I guess, is fine, because I can always do:
>>
>> R>  reflect(IRanges(c(1,20,30), width=5), IRanges(c(1,1,1), c(34,34,34)))
>>
>> But the section that address "reflect" in ?reflect says:
>>
>>     reflect "reflects" or reverses each range in x relative to the
>>     corresponding range in bounds, which is *recycled as necessary*.
>>
>> (ASCII-emphasis mine)
>>
>> But it seems that neither the `bounds` or `x` var is recycled anyway I
>> slice it. So, I'm curious if there's a discrepancy between the
>> documentation and (i) the implementation; or (ii) my understanding.
>>
>> btw - I'm using IRanges_1.5.74
>>
>> Thanks,
>> -steve
>>
>>
>
>



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