I’m searching for a way to find all drugs/compounds for a given target. When I click on the endpoint link on the API page, I just get an error message. Is there swagger documentation for the end point?
Hello @Mark_Fortner!
Thank you for your enquiry and welcome to the Open Targets Community.
The information you are looking for is described in the Known Drugs table of the platform. For example, for the target ENSG00000142192
(APP), in this table you can see all the drugs that have APP as a target and their indications.
The way to access this table in the GraphQL API is by accessing the knownDrugs
endpoint from target
.
Using the same example - all drugs targeting APP (ENSG00000142192) and their indications- the API query would be:
query targetDrugAssociations {
target(ensemblId: "ENSG00000142192") {
knownDrugs {
uniqueDrugs
rows {
label
prefName
drugId
}
}
}
}
Run this query in the GraphQL Playground.
A very handy way to consult the different API endpoints is through the Docs
tab of GraphQL Playground. From there you can browse through all the fields exposed in the API and consult the description of each field.
I hope I could answer your question!
Please feel free to comment below if you have any further ones.
Best,
Irene
Is there any way to query by UniProt accession, or Entrez Gene ID?
Hi Irene, the query above is generating an error message when I run in playground:
“error”: “Unexpected token < in JSON at position 1”
Can you see what’s wrong?
-Will
Hi @Mark_Fortner!
No, unfortunately you cannot query the target
endpoint by UniProt accession or Entrez gene ID. We only support Ensembl gene IDs.
Cheers,
Andrew
Hi @William_Chen!
Welcome to the Open Targets Community!
Can you please try and rerun the following query?
query findKnownDrugsForAGivenTarget {
target(ensemblId: "ENSG00000142192") {
knownDrugs {
uniqueDrugs
rows {
drug{
id
isApproved
yearOfFirstApproval
hasBeenWithdrawn
blackBoxWarning
name
}
disease{
name
id
}
phase
status
ctIds
}
}
}
}
Run this query in our GraphQL API playground
If you continue to encounter an error, please upload a screenshot and we can investigate further.
Thank you!
Cheers,
Andrew
Indeed this works - thanks a lot!