[BioC] coverage() in IRanges gives >0 coverage when weight == 0

Charles Berry ccberry at ucsd.edu
Tue Sep 3 17:05:48 CEST 2013


Ludo Pagie <ludo.pagie at ...> writes:

> 
> Hi all,
> 
> I don't understand what's going on here.I'm trying to compute the
> coverage of a few ranges. I specify a weight for these ranges and for
> some positions I get a coverage even though I know these positions are
> only covered by ranges which have 0 weight.
> Worse, the value I do get for these positions depends on the number of
> ranges I feed into the function. Here's some code using extracts of
> the data I'm working on:
> 

See 

   R FAQ 7.31 Why doesn't R think these numbers are equal?

coverage() uses floating point arithmetic to get the value and is subject
to round-off error. The amount of round-off error depends on the particulars,
so you will get different values for (a+b) - a depending on what b is

> (1e5+1e-10)-1e5
[1] 1.018634e-10
> (1e6+1e-10)-1e6
[1] 1.164153e-10
>



More information about the Bioconductor mailing list