Dear Community!
A new comer here! I am wondering how one can download data for drug-disease associations?
For example, there is option to access the data via JSON, TSV or API.
GraphQL playground suggests this code to get the data. Obviously, $size variable should be changed to accommodate the complete table download. However, I am not sure how? I tried to find possible solutions in this forum but I am not finding anything that could help me…
I’d really appreciate your advice
Blockquote
query KnownDrugsQuery(
$efoId: String!
$cursor: String
$freeTextQuery: String
$size: Int = 10
) {
disease(efoId: $efoId) {
id
knownDrugs(cursor: $cursor, freeTextQuery: $freeTextQuery, size: $size) {
count
cursor
rows {
phase
status
urls {
name
url
}
disease {
id
name
}
drug {
id
name
mechanismsOfAction {
rows {
actionType
targets {
id
}
}
}
}
urls {
url
name
}
drugType
mechanismOfAction
target {
id
approvedName
approvedSymbol
}
}
}
}
}
Blockquote
Hi @Alex_Rowen, and welcome to the Open Targets Community!
There’s a few ways you can download data for drug-disease associations.
1. Using the API
If you copy the code that’s in the API query drawer, the API will return the data in our Known Drugs table. If you change the $size parameter, it should return the number of rows you have specified.
For example, if change it to $size: Int = 1, then I will only get the top row. Please let us know if you’re experiencing issues with this. You can DM me if your query is confidential.
2. Using the data downloads
You can download our data directly (see the Platform documentation). You will find the information on Known Drugs in our Evidence dataset.
I hope this helps! Let me know if you have follow up questions
Thank you very much for your swift response!
I tried changing the $size variable. However, I am not sure what the number for the complete dataset is. It appears that neither the known drug number nor the row number is the right value. There is an additional parameter (counts) - also not entirely sure what that reflects.
Could you maybe explain a bit more how to correctly set the $size parameter to retrieve the full dataset?
Thank you for taking the time to look into my inquiry!
Hi Alex,
You’re welcome!
The count parameter is the number of rows in the table. If you set the size parameter to the same number as the count parameter, then you get the full dataset.
The full dataset given by the API will list the same drug multiple times if it has different sets of clinical trials, which is why the number of rows (counts) is higher than the total number of drugs. Does that make sense?
If you want a list of drugs associated with your disease of interest, you can also download the evidence set, filter for the disease you are interested in, and you will then pick up the list of drugs associated with that disease.
Thank you so much! This is very helpful!
1 Like