Multiple questions about GraphQL schemata

Hi!

I am struggling a lot with the lack of documentation of the GraphQL endpoint.

  "associations on the fly"
  associatedTargets(
    "List of disease or target IDs"
    Bs: \[String!\],

    "Use the disease ontology to retrieve all its descendants and capture their associated evidence."
    enableIndirect: Boolean,

    "List of datasource settings"
    datasources: \[DatasourceSettingsInput!\],

    "List of the facet IDs to filter by (using AND)"
    facetFilters: \[String!\],

    "Filter to apply to the ids with string prefixes"
    BFilter: String,

    "Ordering for the associations. By default is score desc"
    orderByScore: String,

    "Pagination settings with index and size"
    page: Pagination): AssociatedTargets!

What is the format of orderByScore? How to sort by other scores than just “score desc”, e.g. how to sort by a datatype score? E.g. genetics_association if available?

input DatasourceSettingsInput {
  id: String!
  weight: Float!
  propagate: Boolean!
  required: Boolean = false
}

What is propagate? How does weighting work? How to require at least “one of” a list of datasources?

Thanks a lot for any help.

Hi @jpfeuffer and welcome to the Open Targets Community! :tada:

Thanks for the feedback! We know the GraphQL documentation is not always very descriptive, we’re working on improving it.

What is the format of orderByScore? How to sort by other scores than just “score desc”, e.g. how to sort by a datatype score? E.g. genetics_association if available?

orderByScore is a string, where you can input:

  • score type: either "score" or an id from datatypeScores or datasourceScores e.g. "gwas_credible_sets"

  • sort type: either "desc" or "asc"

orderByScore can either be:

  1. Empty —> sorts by descending "score"

  2. Just the score type —> sorts that score type in descending order.

  3. Just the sort type —> sort in the specified way on "score".

  4. Both score type and sort type separated by a space like score_type sort_type e.g. "gwas_credible_sets asc" → sort targets in ascending order by their gwas_credible_sets score

On the Platform webpage, you can see view the API query that we use to build the Associations on the Fly page to see how this is constructed (Export —> API Query), which might help to understand how some of the functions work.

What is propagate? How does weighting work?

See this previous question on the Community for an explanation of the propagate boolean and the weighting. We also explain the weighting in more detail in our documentation.

How to require at least “one of” a list of datasources?

You can require a datasource like this (and you can set multiple data sources as “required: true”) :

query DiseaseAssociationsQuery {
  disease(efoId: "MONDO_0004975") {
    id
    associatedTargets(
      datasources: [{ id: "gwas_credible_sets", weight: 1, propagate: true, required: true }]
    ) {
      count
        }
      }
    }

Note that additional required data sources are added as “OR” filters.

Let us know if you have further questions!

Thank you very much! That helps tremendously. It would be great if a condensed version of this ended up in the comments of your graphQL schema at some point.
I assume this would help people (and LLMs) a lot in the future.

Regarding:

Note that additional required data sources are added as “AND” filters.

Which sounds like it means that filtering for traits that have ANY genetics evidence is not possible, right? Could we hack our way around this by creating a weighted score on our own that includes all datasource evidence scores of the genetics type somehow?

Apologies, that’s my mistake! It’s an OR filter (I’ll update my original reply).

Which means that you can filter for traits that have any genetics evidence by requiring all of the genetics data sources.