GOTerm Object

A PyGOTerm represents one term in the loaded Gene Ontology.

Main fields

Field

Type

Description

id

str

GO identifier (for example GO:0006397)

name

str

Human-readable label

namespace

str

One of biological_process, molecular_function, cellular_component

definition

str

GO definition text

parents

list[str]

Immediate is_a parents

children

list[str]

Immediate is_a children

depth

int | None

Maximum distance to root

level

int | None

Minimum distance to root

is_obsolete

bool

Obsolescence flag

alt_ids

list[str]

Alternate GO IDs

replaced_by

str | None

Suggested canonical replacement for obsolete terms

consider

list[str]

Alternative replacements

synonyms

list[str]

Synonym strings

xrefs

list[str]

Cross-references

relationships

list[tuple[str, str]]

Additional relationships (for example part_of)

comment

str | None

GO comment field

Example

import go3

go3.load_go_terms("go-basic.obo")
term = go3.get_term_by_id("GO:0006397")

print(term.id)
print(term.name)
print(term.namespace)
print(term.parents[:5])

API reference

class PyGOTerm

Bases: object

Python-exposed struct representing a GO term (for use in the Python API).

Fields

idstr

GO term identifier.

namestr

Human-readable name of the term.

namespacestr

Ontology namespace.

definitionstr

Textual definition of the term.

parentslist of str

List of parent GO term IDs.

childrenlist of str

List of child GO term IDs.

depthOptional[int]

Maximum distance to a root term.

levelOptional[int]

Minimum distance to a root term.

is_obsoletebool

True if the term is obsolete.

alt_idslist of str

Alternative GO IDs for this term.

replaced_byOptional[str]

If obsolete, the term that replaces this one.

considerlist of str

Suggested replacement terms if obsolete.

synonymslist of str

List of synonyms.

xrefslist of str

Cross-references to other databases.

relationshipslist of (str, str)

Other relationships (e.g., part_of).

commentOptional[str]

Additional comments.

alt_ids
children
comment
consider
definition
depth
id
is_obsolete
level
name
namespace
parents
relationships
replaced_by
synonyms
xrefs