Thanks for looking into this Steve. The internals of IRanges are a dark and
confusing place. I just committed a fix that simply has
CompressedNormalIRangesLists keeping IRanges as its element type, not
NormalIRanges, as it is not possible in general to compress the elements
into a NormalIRanges.

Let me know if this works for you,
Michael

On Sun, Oct 24, 2010 at 10:37 PM, Steve Lianoglou <
mailinglist.honeypot@gmail.com> wrote:

> Sorry, forgot to attach the sessionInfo:
>
> R version 2.12.0 (2010-10-15)
> Platform: x86_64-apple-darwin9.8.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.2.0 IRanges_1.8.0
>
> loaded via a namespace (and not attached):
> [1] tools_2.12.0
>
>
> On Mon, Oct 25, 2010 at 1:35 AM, Steve Lianoglou
> <mailinglist.honeypot@gmail.com> wrote:
> > I'm tripping up on this because I want to combine two GappedRanges
> > objects, which essentially boils down to `c`(ombining)
> > CompressedNormalIRangesList objects:
> >
> > R> irl <- new("CompressedIRangesList"
> >    , elementMetadata = NULL
> >    , elementType = "IRanges"
> >    , metadata = list()
> >    , partitioning = new("PartitioningByEnd"
> >    , end = c(3L, 4L, 6L)
> >    , NAMES = NULL
> >    , elementMetadata = NULL
> >    , elementType = "integer"
> >    , metadata = list()
> > )
> >    , unlistData = new("IRanges"
> >    , start = c(11L, 21L, 23L, -2L, -2L, 21L)
> >    , width = c(5L, 1L, 8L, 18L, 13L, 2L)
> >    , NAMES = NULL
> >    , elementMetadata = NULL
> >    , elementType = "integer"
> >    , metadata = list()
> > ))
> >
> > R> c(irl, irl) ## works
> >
> > R> cnirl <- as(irl, 'CompressedNormalIRangesList')
> > R> c(cnirl, cnirl) ## error
> > Error in newCompressedList(class(tls[[1L]]), unlistData, end =
> partitionEnd,  :
> >  'unlistData' not of class NormalIRanges
> >
> > ## GappedRanges uses CompressedNormalIRangesList objects at its core
> > ## and also fails
> > R> g <- as(irl, 'GappedRanges')
> > R> c(g, g)
> > Error in newCompressedList(class(tls[[1L]]), unlistData, end =
> partitionEnd,  :
> >  'unlistData' not of class NormalIRanges
> >
> > Being able to debug(IRanges:::newCompressedList), I can see that it
> > expects to build "NormalIRanges" objects into a list since the value
> > of `elementTypeData`` is "NormalIRanges", but the value of
> > `unlistData` is simply an IRanges object, so the function fails by `if
> > (!extends(class(unlistData), elementTypeData))` evaluating to TRUE,
> > which then throws the error we see here.
> >
> > I've been chasing my tail for a bit trying to plumb the internals of
> > the IRanges inheritance hierarchy to pinpoint the exact place I can
> > make a change for this to work. I guess some special casing needs to
> > be applied in this function, or the setMethod("c", "CompressedList")
> > function to look for "NormalIRanges" objects, but I'm at a loss right
> > now and running out of steam.
> >
> > Can anybody offer some insight/fix?
> >
> > 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<http://cbio.mskcc.org/%7Elianos/contact>
> >
>
>
>
> --
> 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<http://cbio.mskcc.org/%7Elianos/contact>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

