tvbgo

knowledge.semanticweb.tvbgo

TVB-GO Module

This module provides utilities for working with TVB and the Gene Ontology.

.. moduleauthor:: Leon K. Martin

Attributes:

import json import os from os.path import abspath, dirname, join from urllib.request import urlopen, urlretrieve from urllib.request import urlretrieve import goatools import networkx as nx import numpy as np import pandas as pd import wget from goatools import obo_parser

Functions:

Functions

Name Description
add_node Add a node to a given graph.
get_annotated_parameters Retrieve parameters that have been annotated.
get_go Retrieve the Gene Ontology DAG (Directed Acyclic Graph) from the online repository.
get_term This function retrieves the definition of a given Gene Ontology term,
go_term2id Convert a Gene Ontology term to its corresponding ID.
graph_from_table Generate a graph based on a given table.
rename2clust Rename a keyword based on predefined clusters.
retrieve_go_id Search for a Gene Ontology term and retrieve its ID.
rmv_extrachars Remove special characters from a term.

add_node

knowledge.semanticweb.tvbgo.add_node(n, g, type=None, **kwargs)

Add a node to a given graph.

Parameters

n : node The node to be added. g : NetworkX graph The graph to which the node will be added. type : str, optional Type of the node. **kwargs Additional keyword arguments.

get_annotated_parameters

knowledge.semanticweb.tvbgo.get_annotated_parameters()

Retrieve parameters that have been annotated.

Returns

list List of annotated parameters.

get_go

knowledge.semanticweb.tvbgo.get_go()

Retrieve the Gene Ontology DAG (Directed Acyclic Graph) from the online repository.

Returns

go : GODag object The Gene Ontology DAG.

get_term

knowledge.semanticweb.tvbgo.get_term(go_id)

This function retrieves the definition of a given Gene Ontology term, using EMBL-EBI’s QuickGO browser. Input: go_id - a valid Gene Ontology ID, e.g. GO:0048527.

Parameters

go_id : str A valid Gene Ontology ID, e.g., GO:0048527.

Returns

dict Term information.

Raises

ValueError If information from QuickGO is not retrievable.

go_term2id

knowledge.semanticweb.tvbgo.go_term2id(term)

Convert a Gene Ontology term to its corresponding ID.

Parameters

term : str The Gene Ontology term to convert.

Returns

str or None The corresponding GO ID or None if not found.

graph_from_table

knowledge.semanticweb.tvbgo.graph_from_table(df_tvbgo=df_tvbgo)

Generate a graph based on a given table.

Parameters

df_tvbgo : DataFrame, optional Data table used to generate the graph. Defaults to the module-level df_tvbgo.

Returns

NetworkX graph Generated graph.

rename2clust

knowledge.semanticweb.tvbgo.rename2clust(kw)

Rename a keyword based on predefined clusters.

Parameters

kw : str Keyword to rename.

Returns

str Renamed keyword.

retrieve_go_id

knowledge.semanticweb.tvbgo.retrieve_go_id(term)

Search for a Gene Ontology term and retrieve its ID.

Parameters

term : str The Gene Ontology term to search.

Returns

str or None The corresponding GO ID or None if not found.

rmv_extrachars

knowledge.semanticweb.tvbgo.rmv_extrachars(term)

Remove special characters from a term.

Parameters

term : str The term from which special characters should be removed.

Returns

str Term without special characters.