[BioC] bug in IRanges::disjoin and strange behavior of c

Kasper Daniel Hansen khansen at stat.berkeley.edu
Mon Feb 1 16:25:55 CET 2010


On Jan 29, 2010, at 16:11 PM, Michael Lawrence wrote:

> c behaviour
> =========
> 
> It seems to behave strangely in connection with do.call and a named list:
> 
> ir = IRanges(start = 1:3, end = 2:4)
> do.call(c, list(ir, ir))  ## What I expect, a single IRange with 6 entries.
> do.call(c, list(ir1 = ir, ir2 = ir))  ## This I don't get
> 
> $ir1
> IRanges of length 3
>    start end width
> [1]     1   2     2
> [2]     2   3     2
> [3]     3   4     2
> 
> $ir2
> IRanges of length 3
>    start end width
> [1]     1   2     2
> [2]     2   3     2
> [3]     3   4     2
> 
> My guess is that this is something with c and method dispatching and do.call.
> 
> 
> Yes, it is known that there is strange behavior here. The combination of dispatching on a .Primitive and the "..." signature pushes things a bit too far.

What I don't get is why this works when the list has no names and why it fails with a named list.  This is potentially dangerous behavior.

Kasper



More information about the Bioconductor mailing list