tooluniverse.enrichr_tool 模块

class tooluniverse.enrichr_tool.EnrichrTool[源代码]

基类:BaseTool

用于使用 Enrichr 进行基因富集分析的工具。

__init__(tool_config)[源代码]
run(arguments)[源代码]

工具的主要入口点。

get_official_gene_name(gene_name)[源代码]

使用 MyGene.info API 根据给定的基因名称或同义词检索官方基因符号。

参数

gene_name (str): The gene name or synonym to query.

返回值

str: The official gene symbol if found; otherwise, raises an Exception.

submit_gene_list(gene_list)[源代码]

将基因列表提交至 Enrichr,并返回用户列表 ID。

参数

gene_list (str): Newline-separated string of gene names.

返回值

str: The user list ID from Enrichr.

get_enrichment_results(user_list_id, library)[源代码]

获取特定库的扩展结果。

参数

user_list_id (str): The user list ID from Enrichr. library (str): The name of the enrichment library.

返回值

dict: The enrichment results.

build_graph(genes, enrichment_results)[源代码]

初始化并构建包含基因节点和富集术语的图表。

参数

genes (list): List of gene names. enrichment_results (dict): Dictionary of enrichment results by library.

返回值

networkx.Graph: The constructed graph.

rank_paths_by_weight(G, source, target)[源代码]

在源节点和目标节点之间查找路径,并根据总边权重进行排序。

参数

G (networkx.Graph): The graph to search. source (str): The source node. target (str): The target node.

返回值

list: List of tuples (path, weight) sorted by weight descending.

rank_paths_to_term(G, gene, term)[源代码]

从每个基因到指定术语的路径中,根据总边权重进行查找和排序。

参数

G (networkx.Graph): The graph to search. gene (str): The source gene. term (str): The target term.

返回值

list or None: List of tuples (path, weight) sorted by weight descending, or None if no paths.

enrichr_api(genes, libs)[源代码]

主要 API 功能用于执行基因富集分析。

参数

genes (list): List of gene names. libs (list): List of enrichment libraries to use.

返回值

tuple: (connected_path, connections) dictionaries.