I want to understand what the function coverage does to an IRange. for example the codes below:
ir <- IRanges (1:3, width = 3) ir IRanges object with 3 ranges and 0 metadata columns: start end width [1] 1 3 3 [2] 2 4 3 [3] 3 5 3 coverage (ir) integer-Rle of length 5 with 5 runs Lengths: 1 1 1 1 1 Values : 1 2 3 2 1
why the values repeats itself like 123 then 21
I figured it out. The right answer is that we count the ranges covering each number starting from 1 till the last number in the last range.
for example
ir <- IRanges (4:6, width = 3)
first, we draw a plot for that IRange staring from 1 which is not included in any range and ending with 8 which is the boundry of the last range
second, we count the ranges of the Ir that covers each of these number from 0 to 8
count = c (0,0,0,1,2,3,2,1)
numeric-Rle of length 8 with 6 runs
Lengths: 3 1 1 1 1 1
Values : 0 1 2 3 2 1