goatools.obo_parser module¶
Read and store Gene Ontology’s obo file.
- class goatools.obo_parser.OBOReader(obo_file='go-basic.obo', optional_attrs=None)[source]¶
Bases:
objectRead goatools.org’s obo file. Load into this iterable class.
Download obo from: http://geneontology.org/ontology/go-basic.obo
>>> reader = OBOReader() >>> for rec in reader: print(rec)
- class goatools.obo_parser.GOTerm(default_namespace='default')[source]¶
Bases:
objectGO term, actually contain a lot more properties than interfaced here
- get_all_lower()[source]¶
Return all parent GO IDs through both reverse ‘is_a’ and all relationships.
- get_all_parent_edges()[source]¶
Return tuples for all parent GO IDs, containing current GO ID and parent GO ID.
- get_all_child_edges()[source]¶
Return tuples for all child GO IDs, containing current GO ID and child GO ID.
- get_goterms_upper_rels(relationship_set)[source]¶
Returns a set containing parents and specified relationship GO Terms.
- class goatools.obo_parser.GODag(obo_file: str = 'go-basic.obo', optional_attrs: set | None = None, load_obsolete: bool = False, prt=stdout)[source]¶
Bases:
dictHolds the GO DAG as a dict. Loads go-basic.obo or OBO Graphs JSON (go-basic.json).
- paths_to_top(term, relationships=None)[source]¶
Returns all possible paths to the root node
Each path includes the term given. The order of the path is top -> bottom, i.e. it starts with the root and ends with the given term (inclusively).
Parameters:¶
- term:
the ID of the GO term, where the paths begin (i.e. the accession ‘GO:0003682’)
- relationships:
Optional. Controls which relationship types are traversed in addition to the default ‘is_a’ hierarchy. Requires the GODag to have been loaded with
optional_attrs={'relationship'}.None(default): traverse only ‘is_a’ parents.True: traverse ‘is_a’ parents and all optional relationships (e.g. ‘part_of’, ‘regulates’, …).A
setorlistof relationship-type strings: traverse ‘is_a’ parents plus only the listed relationship types (e.g.{'part_of'}).
Returns:¶
a list of lists of GO Terms
- make_graph_pydot(recs, nodecolor, edgecolor, dpi, wrap_width, format='png', draw_parents=True, draw_children=True)[source]¶
draw AMIGO style network, lineage containing one query record.
- make_graph_pygraphviz(recs, nodecolor, edgecolor, dpi, wrap_width, format='png', draw_parents=True, draw_children=True)[source]¶
Draw AMIGO style network, lineage containing one query record.