I’m trying to query a list of selected diseases for their descendants. I’ve seen from the documentation that there are different ways to query for descendants.
To get the direct descendants only I’d suggest to use the children endpoint.
Briefly:
descendants returns a list containing all the terms in the ontology tree that descend from a given term. You’ll get not only the direct descendants of your trait of interest but also the descendants of those children, and so on.
children returns an object with only the direct descendants of your trait. You can fetch the ID and/or the name.
parents.descendants, therefore, returns a list of objects for each parent term of your given term, including all their descendants (both direct and indirect). This is why you will find the ID you’re interested in within these lists.
For a more graphical explanation, I suggest you look at the response of this query for rheumatoid arthritis in the API playground and compare it with our ontology widget.
query diseaseAnnotation {
disease(efoId: "EFO_0000685") {
id
name
descendants
children {
id
}
parents {
id
descendants
}
}
}
Thank you for your question. It is our intention to improve the documentation of our API to make these questions clearer.