broadinstitute / gnomad-browser

Explore gnomAD datasets on the web
https://gnomad.broadinstitute.org
MIT License
80 stars 44 forks source link

Fix graphql type error #1644

Closed rileyhgrant closed 1 month ago

rileyhgrant commented 1 month ago

Resolves a long standing type error in the GraphQL API.

The original type for the odds_ratio field of the contingency_table_test of the joint frequency data's frequency comparison stats (used for the discrepant frequencies flag) was a Float. However, some small percentage of the odds_ratio values were infinity, there could be several infinities in this array for a given variant due to odds_ratio being calculated for differing genetic ancestry groups.

These GraphQL errors likely had extremely little impact on users, as the gnomAD browser's frontend was requesting, but not actually using, the odds_ratio data, instead preferring a different field to display a relevant p_value. The only users who would have been impacted by this would have been those using our API, and who had requested and used the odds_ratio field of in the frequency comparison stats. I believe those users would have had a null returned to them, rather than an infinity.

This PR addresses this with 2 minor edits:

  1. Changes the type that was previously a float to a string. This is a bit odd since some large percentage of these values are truly floats, but due to the existence of a more useful field for seeing at a glance the values relevant to discrepant frequencies (stat_union) I believe this quick fix is appropriate.
  2. Removes the unused values from the frontend's API request. These were left in there after the stat_union field was added, and while requested, the frontend does not use the data at all.