bug in IRanges::disjoin and strange behavior of c
1
0
Entering edit mode
@kasper-daniel-hansen-2979
Last seen 10 months ago
United States
Disjoin bug ======== It seems to have a bug when there are names on the IRanges: library(IRanges) ir = IRanges(start = 1:3, end = 2:4) disjoin(ir) ## Correct names(ir) = c("a", "b", "c") disjoin(ir) ## Wrong IRanges of length 3 start end width names [1] 1 1 1 a [2] 2 2 1 b [3] 3 3 1 c Warning messages: 1: In x at start[] <- numeric2integer(value) : number of items to replace is not a multiple of replacement length 2: In width(x) + numeric2integer(value) : longer object length is not a multiple of shorter object length 3: In width(x) + numeric2integer(value) - end(x) : longer object length is not a multiple of shorter object length 4: In x at width[] <- width(x) + numeric2integer(value) - end(x) : number of items to replace is not a multiple of replacement length The last range from 4 to 4 is not included in the output. 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. Using fresh IRanges 1.5.36 from devel. Kasper
IRanges IRanges • 789 views
ADD COMMENT
0
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years ago
United States
On Fri, Jan 29, 2010 at 10:31 AM, Kasper Daniel Hansen < khansen@stat.berkeley.edu> wrote: > Disjoin bug > ======== > > It seems to have a bug when there are names on the IRanges: > > library(IRanges) > ir = IRanges(start = 1:3, end = 2:4) > disjoin(ir) ## Correct > > names(ir) = c("a", "b", "c") > disjoin(ir) ## Wrong > > IRanges of length 3 > start end width names > [1] 1 1 1 a > [2] 2 2 1 b > [3] 3 3 1 c > Warning messages: > 1: In x@start[] <- numeric2integer(value) : > number of items to replace is not a multiple of replacement length > 2: In width(x) + numeric2integer(value) : > longer object length is not a multiple of shorter object length > 3: In width(x) + numeric2integer(value) - end(x) : > longer object length is not a multiple of shorter object length > 4: In x@width[] <- width(x) + numeric2integer(value) - end(x) : > number of items to replace is not a multiple of replacement length > > The last range from 4 to 4 is not included in the output. > > Thanks, I just fixed this. > > 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. > Using fresh IRanges 1.5.36 from devel. > > Kasper > > _______________________________________________ > 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]]
ADD COMMENT

Login before adding your answer.

Traffic: 931 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6