iranges

Counting overlaps as expected with R data.table foverlaps() or IRanges

六眼飞鱼酱① 提交于 2020-06-27 12:44:55
问题 I'm having difficulty counting overlaps of intervals as I would expect. Here is an R data.table with intervals defined by start to end: > library(data.table) > dt1 = data.table(start=c(1, 5, 3), end=c(10, 15, 8)) > print(dt1) start end 1: 1 10 2: 5 15 3: 3 8 Here is how I would consider overlaps for these intervals, from 0 to 20: [0, 1]: 0 (there are no intervals here) [1, 3]: 1 (there is only one interval here, from [1, 10]) [3, 5]: 2 (two intervals here, both [1, 10] and [3, 8]) [5, 8]: 3

Counting overlaps as expected with R data.table foverlaps() or IRanges

风流意气都作罢 提交于 2020-06-27 12:44:05
问题 I'm having difficulty counting overlaps of intervals as I would expect. Here is an R data.table with intervals defined by start to end: > library(data.table) > dt1 = data.table(start=c(1, 5, 3), end=c(10, 15, 8)) > print(dt1) start end 1: 1 10 2: 5 15 3: 3 8 Here is how I would consider overlaps for these intervals, from 0 to 20: [0, 1]: 0 (there are no intervals here) [1, 3]: 1 (there is only one interval here, from [1, 10]) [3, 5]: 2 (two intervals here, both [1, 10] and [3, 8]) [5, 8]: 3

Combining IRanges objects and maintaining mcols

若如初见. 提交于 2019-12-25 01:18:49
问题 I'll start with an example, and then describe the logic I'm trying to use. I have two normal IRanges objects that span the same total range, but may do so in a different number of ranges. Each IRanges has one mcol , but that mcol is different across IRanges . a #IRanges object with 1 range and 1 metadata column: # start end width | on_betalac # <integer> <integer> <integer> | <logical> # [1] 1 167 167 | FALSE b #IRanges object with 3 ranges and 1 metadata column: # start end width | on_other