Skip to content

go

Module for Gene Ontology (GO) functions.

Aspect = Literal['cellular_component', 'biological_process', 'molecular_function'] module-attribute

The aspect of the GO term.

allowed_aspects = set(get_args(Aspect)) module-attribute

Allowed aspects for GO terms.

GoTerm dataclass

A Gene Ontology (GO) term.

Parameters:

Name Type Description Default
id str

The unique identifier for the GO term, e.g., 'GO:0043293'.

required
is_obsolete bool

Whether the GO term is obsolete.

required
name str

The name of the GO term.

required
definition str

The definition of the GO term.

required
aspect Aspect

The aspect of the GO term.

required

search_gene_ontology_term(term, aspect=None, include_obsolete=False, limit=100) async

Search for a Gene Ontology (GO) term by its name or ID.

Calls the EBI QuickGO API at https://www.ebi.ac.uk/QuickGO/api/index.html .

Examples:

To search for apoptosome terms do.

>>> from protein_quest.go import search_go_term
>>> r = await search_go_term('apoptosome')
>>> len(r)
5
>>> r[0]
GoTerm(id='GO:0043293', is_obsolete=False, name='apoptosome', definition='A multisubunit protein ...')

Parameters:

Name Type Description Default
term str

The GO term to search for. For example nucleus or GO:0006816.

required
aspect Aspect | None

The aspect to filter by. If not given, all aspects are included.

None
include_obsolete bool

Whether to include obsolete terms. By default, obsolete terms are excluded.

False
limit int

The maximum number of results to return.

100

Returns:

Type Description
list[GoTerm]

List of GO terms

Raises:

Type Description
ValueError

If the aspect is invalid.

write_go_terms_to_csv(terms, csv_file)

Write a list of GO terms to a CSV file.

Parameters:

Name Type Description Default
terms list[GoTerm]

The list of GO terms to write.

required
csv_file TextIOWrapper

The CSV file to write to.

required