biom-format icon indicating copy to clipboard operation
biom-format copied to clipboard

Throw error if trying to create a biom table containing NaNs

Open AmandaBirmingham opened this issue 1 year ago • 0 comments

Currently, the code allows a user to create a biom table that contains NaNs. However, trying to use such a table frequently leads to obscure errors: the equality test doesn't work (because NaN != NaN), transform doesn't work for sparse representations (because 0/NaN is set to 0, not NaN, because transform doesn't touch zero entries in sparse matrix), and sometimes even doing an explicit NaN-aware compare (where you check whether the same positions contain NaN in two tables) fails (for a non-NaN-related reason :) because matrix.data's order is different depending on whether it was instantiated as sparse or not. (@wasade indicates that the usual way to handle NaNs in a biom table is to set them to zero, which makes these issues go away.)

Since NaNs can't be truly supported in the current code, as a user, I would like it a lot if I just got an error up front if I tried to make a biom table that contained a NaN, rather than hitting an inscrutable issue downstream.

AmandaBirmingham avatar Oct 04 '24 23:10 AmandaBirmingham