# Query disease association for target list in BigQuery

**URL:** <https://community.opentargets.org/t/query-disease-association-for-target-list-in-bigquery/755>\
**Category:** Google BigQuery/Cloud\
**Created:** [14 September 2022 15:48 UTC](https://community.opentargets.org/t/query-disease-association-for-target-list-in-bigquery/755 "2022-09-14T15:48:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CGW](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@CGW](https://community.opentargets.org/u/CGW)\
**Post date:** [14 September 2022 15:48 UTC](https://community.opentargets.org/t/query-disease-association-for-target-list-in-bigquery/755/1 "2022-09-14T15:48:37Z")

</div>

Hi,  
How do I format a SQL query in BigQuery of a predefined target list (with ensembl IDs) to return disease associations?  
Super grateful for any guidance.  
Thanks, CGW

---

<div class="post-metadata">

**Author:** ![hcornu](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/hcornu/32/716_2.png) [@hcornu](https://community.opentargets.org/u/hcornu)\
**Post date:** [15 September 2022 09:14 UTC](https://community.opentargets.org/t/query-disease-association-for-target-list-in-bigquery/755/2 "2022-09-15T09:14:40Z")

</div>

Hi @CGW, and welcome to the Open Targets Community! 🥳

Please could you take a look at the following posts, and see if they answer your question?

> [@Get marketed drugs for a set of targets with BigQuery](https://community.opentargets.org/t/get-marketed-drugs-for-a-set-of-targets-with-bigquery/101):
>
> At Open Targets, we have several ways of accessing our data. In this post, we illustrate how to make the best use of it from the BigQuery workspace. Batch search using BigQuery This query is an example of how to extract the drugs that are on the market for a restricted list of targets. SELECT targets.approvedSymbol, targets.id, ARRAY\_AGG(drugs.id) AS drugIds FROM `open-targets-prod.platform.molecule` AS drugs, UNNEST(linkedTargets.rows.list) AS linkedTarget JOIN `open-targets-prod.pla…

> [@How to find targets associated with a disease using the new GraphQL API or Google BigQuery](https://community.opentargets.org/t/how-to-find-targets-associated-with-a-disease-using-the-new-graphql-api-or-google-bigquery/122):
>
> Problem The Open Targets helpdesk recently received the following question: I have used the older version of the Open Targets Platform (21.02), and the previous API technique, to get targets associated with disease and their overall scores. But now after updating (to version 21.04) I can’t do it with the new GraphQL API technique. Could you help me with this? How can I get associated targets with disease and their overall scores using the new GraphQL API? To make it easier, I need to get t…

> [@Returning all associations data using the Platform API](https://community.opentargets.org/t/returning-all-associations-data-using-the-platform-api/324/2):
>
> Hello @anticancer.org.uk! wave Welcome to the Open Targets Community! tada Thank you for submitting your question about how to access associations data using our GraphQL API. I have responded below and also included two other ways of accessing the data for more systematic and comprehensive queries. How do I access associations data using the Open Targets Platform GraphQL API? To access all associations data for a given target or disease/phenotype through our GraphQL API, you you will nee…

  

There are also some [sample queries available in our documentation](https://platform-docs.opentargets.org/data-access/google-bigquery), as well as in [our Google Cloud dataset homepage](https://console.cloud.google.com/marketplace/product/bigquery-public-data/open-targets-platform?project=open-targets-prod).

  

These should help you get started 😃

---

<div class="post-metadata">

**Author:** ![CGW](https://avatars.discourse-cdn.com/v4/letter/c/ecd19e/32.png) [@CGW](https://community.opentargets.org/u/CGW)\
**Post date:** [20 September 2022 22:25 UTC](https://community.opentargets.org/t/query-disease-association-for-target-list-in-bigquery/755/3 "2022-09-20T22:25:37Z")

</div>

Thanks for the helpful posts provided above. For BigQuery,  
what is the best/most efficient way to define ‘Where’ for a target list of 100s (e.g. from a CSV file) as compared to the case below with just a couple of targets?

```auto
WHERE drugs.maximumClinicalTrialPhase = 4 AND 
    targets.approvedSymbol IN (
        'ERBB3',
        'EGFR'
    )

```

Thanks, CGW

---

<div class="post-metadata">

**Author:** ![hcornu](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/hcornu/32/716_2.png) [@hcornu](https://community.opentargets.org/u/hcornu)\
**Post date:** [21 September 2022 14:39 UTC](https://community.opentargets.org/t/query-disease-association-for-target-list-in-bigquery/755/4 "2022-09-21T14:39:43Z")

</div>

Hi @CGW!

For large lists of targets, the most efficient way to query the data is to use our data downloads.

Our amazing Irene Lopez created a parallel post to walk you through this: [Get marketed drugs for a set of targets with the data downloads](https://community.opentargets.org/t/get-marketed-drugs-for-a-set-of-targets-with-the-data-downloads/102)

Here too, there is some [information available in the documentation](https://platform-docs.opentargets.org/data-access/datasets).

For target-disease associations, we have a number of download files available, depending on the information you are looking for. Check out the files we have available here: [Open Targets Platform](https://platform.opentargets.org/downloads)
