tooluniverse.hpa_tool moduleΒΆ

class tooluniverse.hpa_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.hpa_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.hpa_tool.HPASearchApiTool(tool_config)[source][source]ΒΆ

Bases: BaseTool

Base class for interacting with HPA’s search_download.php API. Uses HPA’s search and download API to get protein expression data.

__init__(tool_config)[source][source]ΒΆ
class tooluniverse.hpa_tool.HPAJsonApiTool(tool_config)[source][source]ΒΆ

Bases: BaseTool

Base class for interacting with HPA’s /{ensembl_id}.json API. More efficient for getting comprehensive gene data.

__init__(tool_config)[source][source]ΒΆ
class tooluniverse.hpa_tool.HPAXmlApiTool(tool_config)[source][source]ΒΆ

Bases: BaseTool

Base class for interacting with HPA’s /{ensembl_id}.xml API. Optimized for comprehensive XML data extraction.

__init__(tool_config)[source][source]ΒΆ
class tooluniverse.hpa_tool.HPAGetRnaExpressionBySourceTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Get RNA expression for a gene from specific biological sources using optimized columns parameter. This tool directly leverages the comprehensive columns table for efficient queries.

__init__(tool_config)[source][source]ΒΆ
run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetSubcellularLocationTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Get annotated subcellular locations for a protein using optimized columns parameter. Uses scml (main location) and scal (additional location) columns for efficient queries.

run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPASearchGenesTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Search for matching genes by gene name, keywords, or cell line names and return Ensembl ID list. This is the entry tool for many query workflows.

run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetComparativeExpressionTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Compare gene expression levels in specific cell lines and healthy tissues. Get expression data for comparison by gene name and cell line name.

__init__(tool_config)[source][source]ΒΆ
run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetDiseaseExpressionTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Get expression data for a gene in specific diseases and tissues. Get related expression information by gene name, tissue type, and disease name.

__init__(tool_config)[source][source]ΒΆ
run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetBiologicalProcessTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Get biological process information related to a gene. Get specific biological processes a gene is involved in by gene name.

__init__(tool_config)[source][source]ΒΆ
run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetCancerPrognosticsTool(tool_config)[source][source]ΒΆ

Bases: HPAJsonApiTool

Get prognostic value of a gene across various cancers. Uses the efficient JSON API to retrieve cancer prognostic data.

run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetProteinInteractionsTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Get protein-protein interaction partners for a gene. Uses search API to retrieve interaction data.

run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetRnaExpressionByTissueTool(tool_config)[source][source]ΒΆ

Bases: HPAJsonApiTool

Query RNA expression levels for a gene in specific tissues. More precise than general tissue expression queries.

run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetContextualBiologicalProcessTool(tool_config)[source][source]ΒΆ

Bases: BaseTool

Analyze a gene’s biological processes in the context of specific tissue or cell line. Enhanced with intelligent context validation and recommendation.

__init__(tool_config)[source][source]ΒΆ
run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetGenePageDetailsTool(tool_config)[source][source]ΒΆ

Bases: HPAXmlApiTool

Get detailed information about a gene page, including images, protein expression, antibody data, etc. Get the most comprehensive data by parsing HPA’s single gene XML endpoint. Enhanced version with improved image extraction and comprehensive data parsing based on optimization plan.

__init__(tool_config)[source][source]ΒΆ
run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetGeneJSONTool(tool_config)[source][source]ΒΆ

Bases: HPAJsonApiTool

Enhanced legacy tool - Get basic gene information using Ensembl Gene ID. Now uses the efficient JSON API instead of search API.

run(arguments: Dict[str, Any]) Dict[str, Any][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.

class tooluniverse.hpa_tool.HPAGetGeneXMLTool(tool_config)[source][source]ΒΆ

Bases: HPASearchApiTool

Legacy tool - Get gene TSV format data (alternative to XML).

run(arguments: Dict[str, Any]) Dict[str, Any][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.