[Bioc-sig-seq] Creating IRangesList from a list of IRanges

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Nov 10 18:53:39 CET 2009


Hi,

On Nov 10, 2009, at 11:54 AM, David Rossell wrote:

> Hi, I'm frequently faced with the need to convert a regular list of  
> IRanges
> objects to an IRangesList object. However, there doesn't seem to be an
> as(x,"IRangesList") coercer when x is a list.
>
> I know I can use the constructor IRanges(x[[1]],x[[2]],x[[3]]) but  
> this is
> not very convenient when x is a long list. I searched around but I  
> couldn't
> find anything about this topic. Am I missing something obvious? Help  
> anyone?

What version of IRanges are you using? I have v.1.5.4 installed right  
now and this works for me:

R> il <- list(IRanges(start=c(1, 5, 30), end=c(20, 30, 50)),
              IRanges(start=c(100, 200, 300), end=c(110, 210, 310)))

R> IRangesList(il)
CompressedIRangesList of length 2
[[1]]
IRanges of length 3
     start end width
[1]     1  20    20
[2]     5  30    26
[3]    30  50    21

[[2]]
IRanges of length 3
     start end width
[1]   100 110    11
[2]   200 210    11
[3]   300 310    11

Isn't that what you're after?

-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 Bioc-sig-sequencing mailing list