AnneChao / SpadeR

SpadeR provides simple R functions to compute various biodiversity indices and related (dis)similarity measures based on individual-based (abundance) data or sampling-unit-based (incidence) data taken from one or multiple communities/assemblages.
27 stars 10 forks source link

Overflow with large experiments #5

Open timydaley opened 8 years ago

timydaley commented 8 years ago

Hi, I'm applying SpadeR to estimate immune repertoire. These experiments are extremely large, on the order of millions. I'm getting the following error:

Diversity(TCR_L3_24_F89_sample, datatype = "abundance") Error in if (f1 - f2 * f3/2/f4 > 0 & f3 != 0) { : missing value where TRUE/FALSE needed In addition: Warning messages: 1: In f2 * f3 : NAs produced by integer overflow 2: In f2 * f3 : NAs produced by integer overflow

Where f2 and f3 are respectively

TCR_L3_24_F89_sample_hist[2,2] [1] 79859 TCR_L3_24_F89_sample_hist[3,2] [1] 38548

As it is currently written, SpadeR cannot be applied to this scale of experiments. If the estimates were done in double precision arithmetic then there would naturally be some loss in numerical accuracy, but I think it would be minimal.