Retrieving >50 pathways from evidences

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

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

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

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

Hi Keith

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

Consider the following query and parameters:

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

parameterised over:

{
  "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:

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:

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

Hi @JarrodBaker ,

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

Cheers,
Keith