qurro icon indicating copy to clipboard operation
qurro copied to clipboard

Properly handle out-of-bounds numbers when creating a Qurro plot

Open fedarko opened this issue 4 years ago • 2 comments

We don't currently check that, e.g., the values in the input BIOM table are within the "representable" range for JavaScript (which iirc is -2^53 + 1 to 2^53 - 1, or something like that). This means that users with absurdly large values in their BIOM tables, or ostensibly users with super large or super small numeric values in their ranks/sample metadata/feature metadata, could run into problems using Qurro (esp since JS usually handles these sorts of situations by doing something weird silently).

It should be possible to handle this by detecting these situations up front in the python script and reacting accordingly.

Ideally we'd support arbitrarily large numbers through the use of something like BigNumbers in math.js, but implementing that and testing everything sounds like it'll take a while (esp since I doubt most users will ever encounter this kinda situation).

So IMO the most practical short-term approach here is just adding some simple code to the python side of things that detects super large numbers in the table/ranks/s.metadata/f.metadata and raises a warning/error accordingly.

  • [x] Detect out-of-bounds numbers in BIOM tables
    • [ ] Detect out-of-bounds sums across all features' counts in a given sample (since this is the largest possible number that could be in a samples' numerator or denominator of a log-ratio)
      • the simplest way to do this is just run the vibe check on the BIOM table, then sum each column and run the vibe check on that
  • [x] Detect out-of-bounds numbers in feature rankings
  • [ ] Detect out-of-bounds numbers in sample metadata
  • [ ] Detect out-of-bounds numbers in feature metadata

fedarko avatar Nov 02 '19 03:11 fedarko