Open mr-september opened 2 years ago
Thanks @mr-september for opening this issue. I think this functionality is not yet implemented in webchem, but PubChem does have a solution that might be relevant called PUG VIEW Annotations: https://pubchemdocs.ncbi.nlm.nih.gov/pug-view#_Toc495044630.
For molecular weight, the url would look like this: https://pubchem.ncbi.nlm.nih.gov/rest/pug_view/annotations/heading/JSON?heading=Molecular%20Weight
While the results are not filtered to a required range, you can extract the values and filter yourself. Since the format is JSON, extracting the data should be relatively simple. Does this help your problem?
@Aariq, my understanding is that with annotation, we could query any section on a PubChem page (similarly to pc_sect()
) and then get the values in that section for all (?) PubChem entries. This mechanism is different from most other webchem functions where we query a compound or a list of compounds but the output looks quite useful. Do you think it would be worth implementing annotations as a new feature?
I'm not sure... The cheminfo link above seems very helpful, but I'm not sure recreating that is 100% in scope for webchem. Definitely something to consider for the future though.
Thanks for the replies.
@stitam would that PUG_REST api essentially return all entries with known Molecular Weight? Is that how a post-hoc filtering can work?
I found another database that was promising, but doesn't seem to have public-facing APIs... yet... HMDB, last known effort in setting up an API was in 2016. I've contacted HMDB's maintainers, hoping they just haven't publicly documented it yet.
Another alternative could be ChemSpider. With this API you can filter by mass:
https://developer.rsc.org/docs/compounds-v1-trial/1/types/FilterByIntrinsicPropertyRequestMass
webchem includes a number of ChemSpider functions, but it does not implement this API because it is not 100% in scope for webchem, as @Aariq mentioned.
For example, like this for PubChem: http://www.cheminfo.org/Chemistry/Database/PubChem/Search_by_exact_mass_in_PubChem/index.html