Main Content

geneont

Data structure containing Gene Ontology (GO) information

Description

A geneont object is a data structure containing Gene Ontology information.

You can explore and traverse Gene Ontology terms using “is_a” and “part_of” relationships.

Creation

Description

GeneontObj = geneont creates GeneontObj, a geneont object, from the gene_ontology.obo file in the MATLAB® current directory. The function also creates multiple term objects, one for each term in the GeneontObj object.

You can use parenthesis () indexing with either GO identifiers (numbers) or by GO terms (term objects) to create a subontology.

GeneontObj is a handle object. To learn how this affects your use of the object, see Copying Objects in the MATLAB Programming Fundamentals documentation.

GeneontObj = geneont('File',filename) creates GeneontObj from the filename file. filename must be on the MATLAB search path.

GeneontObj = geneont('Live',true) creates GeneontObj from the current version of the Gene Ontology database.

Note

The full Gene Ontology database may take several minutes to download when you run this function using the 'Live' property.

example

GeneontObj = geneont('Live',true,'ToFile',filepath) creates GeneontObj from the current version of the Gene Ontology database and saves the contents of this file to filepath.

Input Arguments

expand all

Name of a gene ontology file in the current directory, specified as a string or character vector. The file must be an Open Biomedical Ontology (OBO)-formatted file that is on the MATLAB search path.

Indication to use the current online Gene Ontology database, specified as false (do not use the online database) or true (use the online database).

File to save the online database, specified as a string or character vector representing the path to a (new) file. If the value does not include path information, the file is saved to the current directory.

Properties

expand all

This property is read-only.

Date and time the OBO file was last updated, returned as a character vector. The OBO file is the Open Biomedical Ontology file from which the geneont object was created.

Example: '02:12:2008 19:30'

Data Types: char

This property is read-only.

Namespace to which GO terms are assigned, returned as a character vector. Currently, 'gene_ontology' is the only possible namespace. However, other namespaces may be used in the future. Use this namespace information to determine the ontology namespace to which the GO terms in a geneont object are assigned.

Example: 'gene_ontology'

Data Types: char

This property is read-only.

Format version of the OBO file, returned as a character vector. The OBO file is the Open Biomedical Ontology file from which the geneont object was created.

Example: '1.2'

Data Types: char

This property is read-only.

term objects of GeneontObj, returned as a column vector of handles.

Note

Although terms is a column vector with handles to term objects, in the MATLAB Command Window, terms displays as a structure array, with one structure for each GO term in the geneont object.

Use the information in this structure to access (by GO ID) the terms of a geneont object and to view the properties of individual terms. For an example, see Use terms to Explore Gene Ontology.

Example: '02:12:2008 19:30'

Data Types: char

Object Functions

getancestorsFind terms that are ancestors of specified Gene Ontology (GO) term
getdescendentsFind terms that are descendents of specified Gene Ontology (GO) term
getmatrixConvert geneont object into relationship matrix
getrelativesFind terms that are relatives of specified Gene Ontology (GO) term

Examples

collapse all

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

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

Display information about the geneont object.

get(GeneontObj)
                 default_namespace: 'gene_ontology'
                    format_version: '1.2'
                      data_version: 'releases/2022-01-13'
                           version: ''
                              date: ''
                          saved_by: ''
                 auto_generated_by: ''
                         subsetdef: {17×1 cell}
                            import: ''
                    synonymtypedef: 'systematic_synonym "Systematic synonym" EXACT'
                           idspace: ''
    default_relationship_id_prefix: ''
                        id_mapping: ''
                            remark: ''
                           typeref: ''
                  unrecognized_tag: {'ontology'  'go'}
                             Terms: [47266×1 geneont.term]

Search for all GO terms in the geneont object that contain the character vector ribosome in the field name, and use the geneont.terms property to create a MATLAB® structure array of term objects containing those terms.

comparison = regexpi(get(GeneontObj.terms,'name'),'ribosome');
indices = find(~cellfun('isempty',comparison));
terms_with_ribosmome = GeneontObj.terms(indices)
  33×1 struct array with fields:

    id
    name
    ontology
    definition
    comment
    synonym
    is_a
    part_of
    obsolete

Note: Although the terms property is a column vector with handles to term objects, in the MATLAB Command Window, terms displays as a structure array, with one structure for each GO term in the geneont object.

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

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

View the terms property of GeneontObj.

GeneontObj.terms
  47266×1 struct array with fields:

    id
    name
    ontology
    definition
    comment
    synonym
    is_a
    part_of
    obsolete

Note: Although the terms property is an array of handles to term objects, in the MATLAB® Command Window, terms displays as a structure array, with one structure for each GO term in the geneont object.

View the properties of the term object in the 14,723rd position in the geneont object.

GeneontObj.terms(14723)
            id: 31445
          name: 'regulation of heterochromatin assembly'
      ontology: 'biological process'
    definition: '"Any process that modulates the frequency, rate, extent or location of heterochromatin formation." [GOC:mah]'
       comment: ''
       synonym: {'synonym'  '"regulation of heterochromatin formation" EXACT []'}
          is_a: [3×1 double]
       part_of: [0×1 double]
      obsolete: 0

Create a cell array of character vectors that list the ontology property for each term in the geneont object.

ontologies = get(GeneontObj.terms,'ontology');

Create a logical mask that identifies all the terms with an ontology property of 'cellular component'.

mask = strcmp(ontologies,'cellular component');

Apply the logical mask to all the terms GeneontObj to return a structure array of term objects, containing only terms with an ontology property of 'cellular component'.

cell_comp_terms = GeneontObj.terms(mask)
  4469×1 struct array with fields:

    id
    name
    ontology
    definition
    comment
    synonym
    is_a
    part_of
    obsolete

Create a subontology of all the cellular component terms by indexing into GeneontObj with the masked term objects.

subontology = GeneontObj(cell_comp_terms)
Gene Ontology object with 4469 Terms.

This example shows how to create a subontology by indexing into a geneont object by using the GO identifier.

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

GeneontObj = geneont('LIVE', true)
Gene Ontology object with 47266 Terms.

Create a subontology by returning the terms with GO identifiers of GO:000005 through GO:000010.

subontology1 = GeneontObj(5:10)
Gene Ontology object with 6 Terms.

Create a subontology by returning the term with a GO identifier of GO:000100.

subontology2 = GeneontObj(100)
Gene Ontology object with 1 Terms.

You can create a subontology by indexing into a geneont object using the GO term.

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

GeneontObj = geneont('LIVE', true)
Gene Ontology object with 47266 Terms.

Create an array of term objects containing the fifth through tenth terms of the geneont object.

termObject = GeneontObj.terms(5:10)
  6×1 struct array with fields:

    id
    name
    ontology
    definition
    comment
    synonym
    is_a
    part_of
    obsolete

Note: The GO term of 5 is the position of the term object in the geneont object, and is not necessarily the same as the term object with a GO identifier of GO:000005 used in the example "Index Into a geneont Object using the GO Identifier." This is because there are many terms that are obsolete and are not included as term objects in the geneont object.

Create a subontology by returning the fifth through tenth terms of the geneont object.

subontology3 = GeneontObj(termObject)
Gene Ontology object with 6 Terms.

Copyright 2022The MathWorks, Inc.

Version History

Introduced before R2006a