This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Retrieving MeSH Pharmacological Classification for Compounds in pubChem

I would like to extract, together with the other properties, the MeSH pharmacological classification for any compound in pubchem. For example, for Aspirin I'd like to retrieve "Analgesics, Non-Narcotic" and "Antipyretics".

It seems this is not possible using PUG REST like for retrieving other compound's properties, like this https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/1/property/MolecularFormula,MolecularWeight,InChIKey/CSV beacuse there's no reference to MeSH terms in Compound Property Table.

Does anyone have any idea on how to do it? Thank you so much

pubchem mesh meshterms mesh classification

1 answer

You cannot do this via PUG alone. You need to perform some multi-level Entrez EUtils wrangling for this.

Two possibilities:

a) Learn and understand EUtils and the relationships between the various NCBI databases to some depth

b) Use our Cheminformatics toolkit www.xemistry.com/academic for free academic versions)

Example: Get the full MeSH term tree for Aspirin in JSON form with a Python statement:

cspy
pycactvs>Ens('name:aspirin').jget('E_MESH_TERMS')
'[{"id":68001241,"terms":["Aspirin","Acetylsalicylic Acid","Acid, Acetylsalicylic","2-(Acetyloxy)benzoic Acid","Acylpyrin","Aloxiprimum","Colfarit","Dispril","Easprin","Ecotrin","Endosprin","Magnecyl","Micristin","Polopirin","Polopiryna","Solprin","Solupsan","Zorprin","Acetysal"],"url":"https://www.ncbi.nlm.nih.gov/sites/entrez?Db=mesh&Cmd=ShowDetailView&TermToSearch=68001241","ontotree":{"name":"68001241","type":"data","values":["Aspirin"],"children":[]}},{"id":68058633,"terms":["Antipyretics","Antipyretic Agents","Agents, Antipyretic","Antifebrile Agents","Agents, Antifebrile","Antipyretic Effect","Effect, Antipyretic","Antipyretic Effects","Effects, Antipyretic"],"url":"https://www.ncbi.nlm.nih.gov/sites/entrez?Db=mesh&Cmd=ShowDetailView&TermToSearch=68058633","ontotree":{"name":"68058633","type":"data","values":["Antipyretics"],"children":[]}},{"id":68016861,"terms":["Cyclooxygenase Inhibitors","Inhibitors, Cyclo-Oxygenase","Inhibitors, Cyclo Oxygenase","Inhibitors, Cyclooxygenase","Prostaglandin Synthesis Antagonists","Antagonists, Prostaglandin Synthesis","Inhibitors, Prostaglandin-Endoperoxide Synthase","Inhibitors, Prostaglandin Endoperoxide Synthase","Prostaglandin Endoperoxide Synthase Inhibitors",... (shortened)

Example: Get the full MeSH term tree in nested list/dict form in Tcl:

csts
cactvs>ens get name:aspirin E_MESH_TERMS
{68001241 {Aspirin {Acetylsalicylic Acid} {Acid, Acetylsalicylic} {2-(Acetyloxy)benzoic Acid} Acylpyrin Aloxiprimum Colfarit Dispril Easprin Ecotrin Endosprin Magnecyl Micristin Polopirin Polopiryna Solprin Solupsan Zorprin Acetysal} https://www.ncbi.nlm.nih.gov/sites/entrez?Db=mesh&Cmd=ShowDetailView&TermToSearch=68001241 {68001241 Aspirin}} {68058633 {Antipyretics {Antipyretic Agents} {Agents, Antipyretic} {Antifebrile Agents} {Agents, Antifebrile} {Antipyretic Effect} {Effect, Antipyretic} {Antipyretic Effects} {Effects, Antipyretic}} https://www.ncbi.nlm.nih.gov/sites/entrez?Db=mesh&Cmd=ShowDetailView&TermToSearch=68058633 {68058633 Antipyretics}} {68016861 {{Cyclooxygenase Inhibitors} {Inhibitors, Cyclo-Oxygenase} {Inhibitors, Cyclo Oxygenase} {Inhibitors, Cyclooxygenase} {Prostaglandin Synthesis Antagonists} {Antagonists, Prostaglandin Synthesis} {Inhibitors, Prostaglandin-Endoperoxide Synthase} {Inhibitors, Prostaglandin Endoperoxide Synthase} {Prostaglandin Endoperoxide Synthase Inhibitors} {Prostaglandin Synthase Inhibitors} {Cyclo-Oxygenase Inhibitors} {Cyclo Oxygenase Inhibitors} {Inhibitors, Prostaglandin Synthase}} https://www.ncbi.nlm.nih.gov/sites/entrez?Db=mesh&Cmd=ShowDetailView&TermToSearch=68016861 {68016861 {{Cyclooxygenase Inhibitors}} {68000894 {Anti-Inflammatory Agents, Non-Steroidal} {68000893 {Anti-Inflammatory Agents}} {68018501 {Antirheumatic Agents}}} {68000894 {Anti-Inflammatory Agents, Non-Steroidal} {68000893 {Anti-Inflammatory Agents}} {68018501 ... (shortened)

You can then dig deeper into the MeSH data with script commands isolating the desired nodes from the tree. You data is in there:

...ontotree":{"name":"68058633","type":"data","values":["Antipyretics"],"children":[]}},{"id":68016861,"terms":["Cyclooxygenase Inhibi...

Log in to answer this question.