[Bioc-sig-seq] RangedData objects. Redefining widths with conditions.

Ivan Gregoretti ivangreg at gmail.com
Thu Apr 22 23:15:40 CEST 2010


Cool. I'll try it. Thank you.

Ivan

Ivan Gregoretti, PhD
National Institute of Diabetes and Digestive and Kidney Diseases
National Institutes of Health




On Thu, Apr 22, 2010 at 5:11 PM, Steve Lianoglou
<mailinglist.honeypot at gmail.com> wrote:
> Hi,
>
> On Thu, Apr 22, 2010 at 4:17 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
>> Hello everybody,
>>
>> How do you resize() the ranges of a RangedData object?
>>
>>
>> In the past (IRanges 1.4.11), I could
>>
>> 1) extend forward 200 bases from the start in '+' ranges OR
>> 2) extend backward 200 bases from the end in '-' ranges.
>>
>> The syntax was something like this:
>>
>> resize(ranges(A), width = 200, start = A$strand == "+")
>>
>> In IRanges 1.5.70, the "start" argument of resize() has been
>> depracated and replaced by "fix".
>>
>> Can somebody show how to get the task accomplished with the new resize()?
>
> I'm pretty sure you use `fix` just like you use start:
>
> R> strands <- c("+", '-', '+', '-', '-')
> R> ir <- IRanges(c(1,10,20,30, 40), width=5)
> R> ir
> IRanges of length 5
>    start end width
> [1]     1   5     5
> [2]    10  14     5
> [3]    20  24     5
> [4]    30  34     5
> [5]    40  44     5
>
> R> resize(ir, width=8, fix=ifelse(strands == '+', 'start', 'end'))
> IRanges of length 5
>    start end width
> [1]     1   8     8
> [2]     7  14     8
> [3]    20  27     8
> [4]    27  34     8
> [5]    37  44     8
>
> --
> 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 Bioc-sig-sequencing mailing list