Main Content


Find terms that are descendents of specified Gene Ontology (GO) term



DescendentIDs = getdescendents(GeneontObj,ID) searches GeneontObj, a geneont object, for GO terms that are descendents of the GO term(s) specified by ID, which is a GO term identifier or vector of identifiers. The result DescendentIDs is a vector of GO term identifiers including ID.

[DescendentIDs,Counts] = getdescendents(GeneontObj,ID) also returns the number of times each descendent is found. Counts is a column vector with the same number of elements as terms in GeneontObj.


The Counts return value is useful when you tally counts in gene enrichment studies.

___ = getdescendents(GeneontObj,ID,Name,Value), for any output arguments, specifies additional options using one or more name-value arguments. For example, you can restrict the search to have up to two levels up in the gene ontology by specifying DescendentIDs = getdescendents(GeneontObj,ID,Height=2).


collapse all

Download the current version of the Gene Ontology database from the Web into a geneont object.

GO = geneont('Live',true)
Gene Ontology object with 47266 Terms.

Retrieve the descendants of the "aldo-keto reductase activity" GO term with a GO identifier of 4033.

descendants = getdescendants(GO,4033)
descendants = 9×1


Create a subordinate Gene Ontology.

subontology = GO(descendants)
Gene Ontology object with 9 Terms.

Create and display a report of the subordinate Gene Ontology terms, that includes the GO identifier and name.

rpt = [num2goid(cell2mat(get(subontology.terms,'id')))...
fprintf('%s --> %s \n',rpt{:})
GO:0004032 --> alditol:NADP+ 1-oxidoreductase activity 
GO:0004033 --> aldo-keto reductase (NADP) activity 
GO:0008106 --> alcohol dehydrogenase (NADP+) activity 
GO:0032018 --> 2-methylbutanol:NADP oxidoreductase activity 
GO:0032866 --> D-xylose:NADP reductase activity 
GO:0032867 --> L-arabinose:NADP reductase activity 
GO:0050236 --> pyridoxine:NADP 4-dehydrogenase activity 
GO:0052650 --> NADP-retinol dehydrogenase activity 
GO:0052675 --> 3-methylbutanol:NADP oxidoreductase activity 

View relationships of the subordinate Gene Ontology by using the getmatrix method to create a connection matrix to pass to the digraph function.

cm = getmatrix(subontology);
BG = digraph(cm,get(subontology.terms,"name"));

Figure contains an axes object. The axes object contains an object of type graphplot.

Input Arguments

collapse all

Gene ontology object, specified as the output of the geneont command.

Example: geneont('Live',true)

Gene ontology ID numbers, specified as a nonnegative integer vector.

Example: 5

Data Types: single | double

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: DescendentIDs = getdescendents(GeneontObj,5,Depth=2)

Names are case-insensitive.

Number of search levels down in gene ontology, specified as a positive integer.

Example: 4

Data Types: single | double

Relations to match, specified as one of the following:

  • 'is_a'

  • 'part_of'

  • 'both'

Example: 'is_a'

Data Types: char | string

Indication to exclude ID from DescendentIDs, specified as false or true. This argument can fail to apply when getdescendents reaches the term while searching the ontology.

Example: true

Data Types: logical

Output Arguments

collapse all

ID numbers of descendents of GeneontObj, returned as a nonnegative integer vector. By default, DescendentIDs includes ID, unless you set the Exclude argument to true.

Number of times each relative is found, returned as a column vector of integers. Counts has the same number of elements as terms in GeneontObj.

Version History

Introduced before R2006a