# Retrieving \>50 pathways from evidences

**URL:** <https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767>\
**Category:** GraphQL API\
**Created:** [22 September 2022 07:26 UTC](https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767 "2022-09-22T07:26:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![keithzikai.chew](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@keithzikai.chew](https://community.opentargets.org/u/keithzikai.chew)\
**Post date:** [22 September 2022 07:26 UTC](https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767/1 "2022-09-22T07:26:28Z")

</div>

Hi all,

I would just like to ask a question to confirm this issue. When looking for pathways associated with a disease + target (i.e. i have disease and target IDs as input), that would be under “disease\>evidences\>rows\>pathways” of the API schema, to which there is no pagination, that is to say, there is no way to retrieve more than 50 pathways using GraphQL API, even if I don’t mind querying multiple times?

Thanks.

Best,  
Keith

---

<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:** [22 September 2022 07:59 UTC](https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767/2 "2022-09-22T07:59:59Z")

</div>

Hi @keithzikai.chew, and welcome to the Open Targets Community! 🕺

You should be able to retrieve additional evidence using the `page` argument in the API. Take a look at this Community post, for example:

> [@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…

---

<div class="post-metadata">

**Author:** ![keithzikai.chew](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@keithzikai.chew](https://community.opentargets.org/u/keithzikai.chew)\
**Post date:** [22 September 2022 08:24 UTC](https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767/3 "2022-09-22T08:24:31Z")

</div>

> [@Returning all associations data using the Platform API](https://community.opentargets.org/t/returning-all-associations-data-using-the-platform-api/324/2):
>
> { size: x, index:y }

Hi @hcornu ! Thanks for the prompt reply!

However, I was referring to finding evidence that supports a specific target-disease association, and not finding the associations themselves. I am looking into pathway evidences from datasources like reactome and slapenrich, which some evidences exceed 50 results. The docs do not mention of the “page” argument for evidences unlike for associations. Is this correct?

Cheers,  
Keith

---

<div class="post-metadata">

**Author:** ![JarrodBaker](https://dub1.discourse-cdn.com/flex017/user_avatar/community.opentargets.org/jarrodbaker/32/44_2.png) [@JarrodBaker](https://community.opentargets.org/u/JarrodBaker)\
**Post date:** [22 September 2022 09:41 UTC](https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767/4 "2022-09-22T09:41:52Z")

</div>

Hi Keith

Pagination on Evidence is possible, although it is a little more tricky than other areas.

Consider the following query and parameters:

```auto
query PaginatedEvidence($ensgId: String!, $efo: [String!]!, $ds: [String!]!) {
  target(ensemblId: $ensgId) {
    evidences(efoIds:$efo, datasourceIds:$ds) {
      count
      rows {
        id
      }
      cursor
    }
  }
}

```

parameterised over:

```auto
{
  "ensgId": "ENSG00000141736",
  "efo": ["EFO_0000311"],
  "ds": ["reactome", "slapenrich"]
}

```

The response will show that there are 63 entries, but there are only 25 rows returned.

You’ll notice that as part of the request we asked for a `cursor`. This can either have a value or be `null`. If the value is `null` then there are no more records. If there is a value, then you can use that value as a parameter into a follow up query:

```auto
query PaginatedEvidence($ensgId: String!, $efo: [String!]!, $ds: [String!]!) {
  target(ensemblId: $ensgId) {
    evidences(efoIds:$efo, datasourceIds:$ds, cursor: "WzEsIjVlMGExNmQyNzhhZWEyMzU3MDg5MWZlYTBiMGZiZjI0MmUyZGMwYmQiXQ==") {
      count
      rows {
        id
      }
      cursor
    }
  }
}

```

This will return the next set of 25 results, and _another different_ cursor will be returned as part of the response, which will collect the following page until eventually no cursor will be returned and you know you have all the results.

Depending on what you wish to do with the data, you might be better off exploring accessing it through Google Cloud Big Query where the data is available as a public dataset.

A query such as:

```auto
SELECT pathways
FROM `open-targets-prod.platform.evidence` 
WHERE datasourceId IN ('slapenrich', 'reactome') AND targetId = 'ENSG00000141736' AND diseaseId = 'EFO_0000311'
LIMIT 10

```

---

<div class="post-metadata">

**Author:** ![keithzikai.chew](https://avatars.discourse-cdn.com/v4/letter/k/4da419/32.png) [@keithzikai.chew](https://community.opentargets.org/u/keithzikai.chew)\
**Post date:** [22 September 2022 10:03 UTC](https://community.opentargets.org/t/retrieving-50-pathways-from-evidences/767/5 "2022-09-22T10:03:01Z")

</div>

Hi @JarrodBaker ,

Thanks so much for this! I’ll give it a shot.

Cheers,  
Keith
