tooluniverse.humanbase_tool module

class tooluniverse.humanbase_tool.BaseTool(tool_config)[source][source]

Bases: object

__init__(tool_config)[source][source]
classmethod get_default_config_file()[source][source]

Get the path to the default configuration file for this tool type.

This method uses a robust path resolution strategy that works across different installation scenarios:

  1. Installed packages: Uses importlib.resources for proper package resource access

  2. Development mode: Falls back to file-based path resolution

  3. Legacy Python: Handles importlib.resources and importlib_resources

Override this method in subclasses to specify a custom defaults file.

Returns:

Path or resource object pointing to the defaults file

classmethod load_defaults_from_file()[source][source]

Load defaults from the configuration file

run(arguments=None)[source][source]

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

check_function_call(function_call_json)[source][source]
get_required_parameters()[source][source]

Retrieve required parameters from the endpoint definition. Returns: list: List of required parameters for the given endpoint.

tooluniverse.humanbase_tool.register_tool(tool_type_name=None, config=None)[source][source]

Decorator to automatically register tool classes and their configs.

Usage:

@register_tool(‘CustomToolName’, config={…}) class MyTool:

pass

class tooluniverse.humanbase_tool.HumanBaseTool(tool_config)[source][source]

Bases: BaseTool

Tool to retrieve protein-protein interactions and biological processes from HumanBase.

__init__(tool_config)[source][source]
run(arguments)[source][source]

Main entry point for the tool.

get_official_gene_name(gene_name)[source][source]

Retrieve the official gene symbol (same as EnrichrTool method)

Parameters:

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

Returns:

The official gene symbol.

Return type:

str

get_entrez_ids(gene_names)[source][source]

Convert gene names to Entrez IDs using NCBI Entrez API.

Parameters:

gene_names (list) – List of gene names to convert.

Returns:

List of Entrez IDs corresponding to the gene names.

Return type:

list

humanbase_ppi_retrieve(genes, tissue, max_node=10, interaction=None)[source][source]

Retrieve protein-protein interactions and biological processes from HumanBase.

Parameters:
  • genes (list) – List of gene names to analyze.

  • tissue (str) – Tissue type for tissue-specific interactions.

  • max_node (int) – Maximum number of nodes to retrieve.

  • interaction (str) – Specific interaction type to filter by.

Returns:

(NetworkX Graph of interactions, list of biological processes)

Return type:

tuple