[BioC] Combining two CompressedNormalIRangesList objects doesn't work

Steve Lianoglou mailinglist.honeypot at gmail.com
Mon Oct 25 07:35:44 CEST 2010


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



More information about the Bioconductor mailing list