has_ancestor
- has_ancestor(reference, ancestor, /, direction='up', **kwargs)[source]
Check that the first identifier has the second as an ancestor.
- Parameters:
reference (str | NormalizedNamableReference) – The reference
ancestor (str | NormalizedNamableReference) – The ancestor
kwargs (Unpack[HierarchyKwargs]) – Keyword arguments for
get_hierarchy()direction (Literal['up', 'down'])
- Returns:
If the decendant has the given ancestor
- Return type:
Check that
GO:0008219(cell death) is an ancestor ofGO:0006915(apoptotic process):>>> apoptosis = Reference.from_curie("GO:0006915", name="apoptotic process") >>> cell_death = Reference.from_curie("GO:0008219", name="cell death") >>> assert has_ancestor(apoptosis, cell_death)
Check that
GO:0070246(natural killer cell apoptotic process) is a descendant ofGO:0006915(apoptotic process)>>> nk_apoptosis = Reference.from_curie( ... "GO:0070246", name="natural killer cell apoptotic process" ... ) >>> apoptosis = Reference.from_curie("GO:0006915", name="apoptotic process") >>> assert has_ancestor(nk_apoptosis, apoptosis)