fix: raise clear error when window_size is too large#1152
fix: raise clear error when window_size is too large#1152suhr25 wants to merge 2 commits intomalariagen:masterfrom
Conversation
…gwss Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
|
Hi @jonbrenas, |
|
Hi @suhr25, would there be a way to instead raise a warning and modify the |
Replace hard error when window_size exceeds available SNPs with a warning, and automatically adjust window_size to the maximum valid value so that computation can proceed. Signed-off-by: Suhrid Marwah <suhridmarwah07@gmail.com>
1b9797e to
a05bab0
Compare
|
Thanks for the suggestion! @jonbrenas Let me know if you would prefer any different handling. |
|
Hi @jonbrenas, |
|
Thanks @suhr25, Because we want to have a moving statistics, the window size would need to be a factor smaller than the number of SNPs (let's say, 10 by default but it should be a parameter). The window size should thus be adjusted, unless it falls under a given number (again it should be a parameter with a default value say 1 000), in which your original error message probably becomes the solution. |
|
Sure thanks, |
SUMMARY
Fixes a crash when
window_sizeis too large in Fst GWSS by raising a clear error instead of returning empty data.FIX
Before
After
VERIFICATION
Using a large
window_sizeon a small region used to crash with anIndexError. Now it raises a clearValueError. A test confirms this behavior.