Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace NaN in protein metadata #110

Closed
jonrkarr opened this issue May 29, 2020 · 8 comments
Closed

Replace NaN in protein metadata #110

jonrkarr opened this issue May 29, 2020 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@jonrkarr
Copy link
Member

Example:
https://testapi.datanator.info/proteins/meta/meta_combo/?uniprot_id=P37173

@jonrkarr jonrkarr added the bug Something isn't working label May 29, 2020
@jonrkarr
Copy link
Member Author

jonrkarr commented May 29, 2020

I changed the frontend to use JSON5 so that it won't fail to parse JSON strings from the API when they include NaN.

To fully take advantage of this, everywhere the frontend detect null it should check null or NaN. Because this applies to many places in the code (and it would take some work to update this), it would still be helpful to replace this NaN with null on the backend.

lzy7071 added a commit to KarrLab/datanator_query_python that referenced this issue May 29, 2020
lzy7071 added a commit to KarrLab/datanator_query_python that referenced this issue May 29, 2020
@lzy7071
Copy link
Contributor

lzy7071 commented May 29, 2020

Agreed. My temporary solution is also essentially converting NaN to null on the backed. The difficulty lies in the fact that the fields that contain NaN are not constant. I might have to iterate through all the 2.8M documents in uniprot collection.

@jonrkarr
Copy link
Member Author

Is it always NaN or sometimes "NaN"? The former will be handled by JSON5.

@lzy7071
Copy link
Contributor

lzy7071 commented May 29, 2020

Is it always NaN or sometimes "NaN"? The former will be handled by JSON5.

Fairly certain it's NaN, as in numpy.nan, since they were generated by dataframe.

@jonrkarr
Copy link
Member Author

If you know which collections/fields this is limited to, I can check for NaN where needed on the frontend. Then it won't be so important to fix this in the database.

@lzy7071
Copy link
Contributor

lzy7071 commented May 29, 2020

halflives object in rna_halflife, affected endpoints:

  • /rna/halflife/get_info_by_name

  • /rna/halflife/get_info_by_ko
    (Both of them are temporarily fixed, but not on the database side)

modifications object in uniprot collection, affected endpoints include anything that doesn't project out modifications object:

  • /protein/meta_combo/*

  • /protein/proximity_abundance/proximity_abundance_kegg

  • /protein/precise_abundance (temporarily fixed)

@jonrkarr
Copy link
Member Author

jonrkarr commented Jun 1, 2020

This is now fully handled in the frontend.

  • I used JSON5 to handle NaN
  • All NaN are automatically converted to null

As a result, we no longer need to fix this in the backend.

Going forward, if the backend needs to communicate NaN (as different from null), we will need to remove (2) above and more carefully interpret NaN vs null throughout the frontend code.

@jonrkarr jonrkarr closed this as completed Jun 1, 2020
@lzy7071
Copy link
Contributor

lzy7071 commented Jun 1, 2020

Awesome! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants