Annotations

class GAFAnnotation

Bases: object

Struct representing a single annotation from a GAF file.

Fields

db_object_idstr

The gene product identifier (e.g., UniProt ID).

go_termstr

The GO term ID (e.g., GO:0008150).

evidencestr

The evidence code for the annotation (e.g., IEA).

db_object_id
evidence
go_term
class TermCounter

Bases: object

Struct holding annotation counts and information content (IC) for GO terms.

Fields

countsdict

Mapping from GO term ID to annotation count.

total_by_nsdict

Mapping from namespace to total annotation count.

icdict

Mapping from GO term ID to information content (IC).

counts
ic
total_by_ns
build_term_counter(py_annotations)

Build a term counter (counts, IC) from GAF annotations.

Parameters:

py_annotations (list of GAFAnnotation) – List of GAFAnnotation Python objects.

Returns:

Struct with counts and IC values.

Return type:

TermCounter

load_gaf(path)

Load a GAF annotation file and cache the gene-to-GO mapping.

Parameters:

path (str) – Path to the GAF file.

Returns:

List of parsed GAF annotations.

Return type:

list of GAFAnnotation

Annotation Functions

import go3
go3.load_go_terms()
annots = go3.load_gaf("goa_human.gaf")
counter = go3.build_term_counter(annots)
  • load_gaf: Loads a GAF file and parses gene-to-GO annotations.

  • build_term_counter: Builds annotation counts and IC values for all terms.

  • GAFAnnotation: Class representing a single annotation.

  • TermCounter: Class holding counts and IC values.