Open i-marques opened 7 months ago
Hi,
I get exactly the same error with SAIGE v1.3.1:
vector::_M_range_check: __n (which is 2538) >= this->size() (which is 2538)
I found out that the program crashes in src/Binary_ComputeExact.cpp
line 47 in the function ComputeExact::CalTestStat
:
m_teststat.at(m_idx) = stat ;
where the 0-based index m_idx
should be smaller than the size of vector m_teststat
:
(gdb) p m_teststat
std::vector of length 2538
(gdb) p m_idx
2538
In my case, increasing the minmac option prevented from having this error so far.
Hi @weizhouUMICH ,
I found the bug causing this error in the file ER_binary_func.cpp.
It is an overflow when computing n_choose_r
and factorial
with n>=13
.
It results in the wrong values of n_choose_r(13,0:13) in the total_k variable: {1, 4, 24, 88, 221, 399, 532, 532, 399, 221, 88, 24, 4, 1}
instead of {1, 13, 78, 286, 715, 1287, 1716, 1716, 1287, 715, 286, 78, 13, 1}
.
It results in the wrong value of the sum(total_k)
in the m_total variable: 2538, instead of 8192.
m_total is used to allocate the size of the m_teststat vector, which results in the error about too small vector.
Enclosed is a patch which computes n_choose_r while minimizing the risks of overflow. patch_nchooser.txt
Indeed, I was using the default values and increasing min_MAC solved the issue. Thank you!
Hi. I've been trying to use SAIGE to run GWAS. I am using R version 4.3.1 and SAIGE 1.2.0. I tested the code for chr 21 and 22 and these are running fine. When I started chr 1 to 22 I get this error message halfway each chr analysis:
1051.383 4.797 1059.989 isVcfEnd FALSE (2024-01-17 18:51:28.035157) ---- Analyzing Chunk 40 : chrom InitialChunk ---- Error: vector::_M_range_check: __n (which is 2538) >= this->size() (which is 2538) Execution halted
I don't think it a memory issue, I was saving 50GB for this to run and I can see it is using only around 21GB. Any idea how to solve it? Thanks