$npx -y skills add QSong-github/DrugClaw --skill iupharQuery the IUPHAR/BPS Guide to Pharmacology REST API for drug targets, ligands (drugs/compounds), and their interactions. Use whenever the user asks about pharmacological targets, receptor–ligand relationships, drug mechanisms of action, or wants to look up any drug or target name
| 1 | # IUPHAR/BPS Guide to Pharmacology Skill |
| 2 | |
| 3 | Query the expert-curated IUPHAR database for ligands (drugs/compounds), targets |
| 4 | (receptors/enzymes/channels), and ligand–target interactions. |
| 5 | |
| 6 | - **Source**: <https://www.guidetopharmacology.org/> |
| 7 | - **API docs**: <https://www.guidetopharmacology.org/webServices.jsp> |
| 8 | - **Auth**: None (open access) |
| 9 | |
| 10 | ## Entity auto-detection |
| 11 | |
| 12 | `query_entity(name)` tries ligand search first; if no hits, falls back to |
| 13 | target search. |
| 14 | |
| 15 | | Input example | Detected as | What you get | |
| 16 | |---|---|---| |
| 17 | | `morphine` | ligand | ligandId, type, approved status, INN … | |
| 18 | | `5-HT1A receptor` | target | targetId, type, gene IDs, family IDs … | |
| 19 | | `GABA receptor` | target | target info + top 10 ligand–target interactions | |
| 20 | |
| 21 | ## API |
| 22 | |
| 23 | | Function | Input | Returns | |
| 24 | |---|---|---| |
| 25 | | `query_entity(name)` | single entity string | dict with `entity`, `type`, `results`, `interactions` | |
| 26 | | `query_entities(names)` | list of entity strings | `{name: result_dict}` | |
| 27 | | `summarize(result)` | output of `query_entity` | concise human-readable text | |
| 28 | | `search_ligand(name)` | drug/compound name | list of ligand dicts | |
| 29 | | `get_ligand(id)` | numeric ligand ID | full ligand detail dict | |
| 30 | | `search_target(name)` | target name | list of target dicts | |
| 31 | | `get_target(id)` | numeric target ID | full target detail dict | |
| 32 | | `get_interactions(target_id)` | numeric target ID | list of interaction dicts | |
| 33 | |
| 34 | ## Usage |
| 35 | |
| 36 | ```python |
| 37 | from importlib.util import spec_from_file_location, module_from_spec |
| 38 | spec = spec_from_file_location("iuphar", "<path>/13_IUPHAR_BPS_Guide_to_Pharmacology.py") |
| 39 | iuphar = module_from_spec(spec); spec.loader.exec_module(iuphar) |
| 40 | |
| 41 | # Single query |
| 42 | r = iuphar.query_entity("morphine") |
| 43 | print(iuphar.summarize(r)) |
| 44 | |
| 45 | # Batch query |
| 46 | results = iuphar.query_entities(["aspirin", "5-HT1A receptor"]) |
| 47 | for name, res in results.items(): |
| 48 | print(iuphar.summarize(res)) |
| 49 | ``` |
| 50 | |
| 51 | See `if __name__ == "__main__"` block in the `.py` file for more runnable |
| 52 | examples (single ligand, single target, batch, direct ID lookup). |
| 53 | |
| 54 | ## Key fields returned |
| 55 | |
| 56 | **Ligand**: `ligandId`, `name`, `type`, `approved`, `inn`, `species` |
| 57 | |
| 58 | **Target**: `targetId`, `name`, `abbreviation`, `type`, `familyIds`, `geneIds` |
| 59 | |
| 60 | **Interaction**: `ligandId`, `targetId`, `action`, `affinityRange`, `affinityType`, `endogenous`, `species` |