tooluniverse 0.1.4__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tooluniverse might be problematic. Click here for more details.
- tooluniverse/__init__.py +340 -4
- tooluniverse/admetai_tool.py +84 -0
- tooluniverse/agentic_tool.py +563 -0
- tooluniverse/alphafold_tool.py +96 -0
- tooluniverse/base_tool.py +129 -6
- tooluniverse/boltz_tool.py +207 -0
- tooluniverse/chem_tool.py +192 -0
- tooluniverse/compose_scripts/__init__.py +1 -0
- tooluniverse/compose_scripts/biomarker_discovery.py +293 -0
- tooluniverse/compose_scripts/comprehensive_drug_discovery.py +186 -0
- tooluniverse/compose_scripts/drug_safety_analyzer.py +89 -0
- tooluniverse/compose_scripts/literature_tool.py +34 -0
- tooluniverse/compose_scripts/output_summarizer.py +279 -0
- tooluniverse/compose_scripts/tool_description_optimizer.py +681 -0
- tooluniverse/compose_scripts/tool_discover.py +705 -0
- tooluniverse/compose_scripts/tool_graph_composer.py +448 -0
- tooluniverse/compose_tool.py +371 -0
- tooluniverse/ctg_tool.py +1002 -0
- tooluniverse/custom_tool.py +81 -0
- tooluniverse/dailymed_tool.py +108 -0
- tooluniverse/data/admetai_tools.json +155 -0
- tooluniverse/data/agentic_tools.json +1156 -0
- tooluniverse/data/alphafold_tools.json +87 -0
- tooluniverse/data/boltz_tools.json +9 -0
- tooluniverse/data/chembl_tools.json +16 -0
- tooluniverse/data/clait_tools.json +108 -0
- tooluniverse/data/clinicaltrials_gov_tools.json +326 -0
- tooluniverse/data/compose_tools.json +202 -0
- tooluniverse/data/dailymed_tools.json +70 -0
- tooluniverse/data/dataset_tools.json +646 -0
- tooluniverse/data/disease_target_score_tools.json +712 -0
- tooluniverse/data/efo_tools.json +17 -0
- tooluniverse/data/embedding_tools.json +319 -0
- tooluniverse/data/enrichr_tools.json +31 -0
- tooluniverse/data/europe_pmc_tools.json +22 -0
- tooluniverse/data/expert_feedback_tools.json +10 -0
- tooluniverse/data/fda_drug_adverse_event_tools.json +491 -0
- tooluniverse/data/fda_drug_labeling_tools.json +544 -168
- tooluniverse/data/fda_drugs_with_brand_generic_names_for_tool.py +76929 -148860
- tooluniverse/data/finder_tools.json +209 -0
- tooluniverse/data/gene_ontology_tools.json +113 -0
- tooluniverse/data/gwas_tools.json +1082 -0
- tooluniverse/data/hpa_tools.json +333 -0
- tooluniverse/data/humanbase_tools.json +47 -0
- tooluniverse/data/idmap_tools.json +74 -0
- tooluniverse/data/mcp_client_tools_example.json +113 -0
- tooluniverse/data/mcpautoloadertool_defaults.json +28 -0
- tooluniverse/data/medlineplus_tools.json +141 -0
- tooluniverse/data/monarch_tools.json +1 -1
- tooluniverse/data/openalex_tools.json +36 -0
- tooluniverse/data/opentarget_tools.json +82 -58
- tooluniverse/data/output_summarization_tools.json +101 -0
- tooluniverse/data/packages/bioinformatics_core_tools.json +1756 -0
- tooluniverse/data/packages/categorized_tools.txt +206 -0
- tooluniverse/data/packages/cheminformatics_tools.json +347 -0
- tooluniverse/data/packages/earth_sciences_tools.json +74 -0
- tooluniverse/data/packages/genomics_tools.json +776 -0
- tooluniverse/data/packages/image_processing_tools.json +38 -0
- tooluniverse/data/packages/machine_learning_tools.json +789 -0
- tooluniverse/data/packages/neuroscience_tools.json +62 -0
- tooluniverse/data/packages/original_tools.txt +0 -0
- tooluniverse/data/packages/physics_astronomy_tools.json +62 -0
- tooluniverse/data/packages/scientific_computing_tools.json +560 -0
- tooluniverse/data/packages/single_cell_tools.json +453 -0
- tooluniverse/data/packages/software_tools.json +4954 -0
- tooluniverse/data/packages/structural_biology_tools.json +396 -0
- tooluniverse/data/packages/visualization_tools.json +399 -0
- tooluniverse/data/pubchem_tools.json +215 -0
- tooluniverse/data/pubtator_tools.json +68 -0
- tooluniverse/data/rcsb_pdb_tools.json +1332 -0
- tooluniverse/data/reactome_tools.json +19 -0
- tooluniverse/data/semantic_scholar_tools.json +26 -0
- tooluniverse/data/special_tools.json +2 -25
- tooluniverse/data/tool_composition_tools.json +88 -0
- tooluniverse/data/toolfinderkeyword_defaults.json +34 -0
- tooluniverse/data/txagent_client_tools.json +9 -0
- tooluniverse/data/uniprot_tools.json +211 -0
- tooluniverse/data/url_fetch_tools.json +94 -0
- tooluniverse/data/uspto_downloader_tools.json +9 -0
- tooluniverse/data/uspto_tools.json +811 -0
- tooluniverse/data/xml_tools.json +3275 -0
- tooluniverse/dataset_tool.py +296 -0
- tooluniverse/default_config.py +165 -0
- tooluniverse/efo_tool.py +42 -0
- tooluniverse/embedding_database.py +630 -0
- tooluniverse/embedding_sync.py +396 -0
- tooluniverse/enrichr_tool.py +266 -0
- tooluniverse/europe_pmc_tool.py +52 -0
- tooluniverse/execute_function.py +1775 -95
- tooluniverse/extended_hooks.py +444 -0
- tooluniverse/gene_ontology_tool.py +194 -0
- tooluniverse/graphql_tool.py +158 -36
- tooluniverse/gwas_tool.py +358 -0
- tooluniverse/hpa_tool.py +1645 -0
- tooluniverse/humanbase_tool.py +389 -0
- tooluniverse/logging_config.py +254 -0
- tooluniverse/mcp_client_tool.py +764 -0
- tooluniverse/mcp_integration.py +413 -0
- tooluniverse/mcp_tool_registry.py +925 -0
- tooluniverse/medlineplus_tool.py +337 -0
- tooluniverse/openalex_tool.py +228 -0
- tooluniverse/openfda_adv_tool.py +283 -0
- tooluniverse/openfda_tool.py +393 -160
- tooluniverse/output_hook.py +1122 -0
- tooluniverse/package_tool.py +195 -0
- tooluniverse/pubchem_tool.py +158 -0
- tooluniverse/pubtator_tool.py +168 -0
- tooluniverse/rcsb_pdb_tool.py +38 -0
- tooluniverse/reactome_tool.py +108 -0
- tooluniverse/remote/boltz/boltz_mcp_server.py +50 -0
- tooluniverse/remote/depmap_24q2/depmap_24q2_mcp_tool.py +442 -0
- tooluniverse/remote/expert_feedback/human_expert_mcp_tools.py +2013 -0
- tooluniverse/remote/expert_feedback/simple_test.py +23 -0
- tooluniverse/remote/expert_feedback/start_web_interface.py +188 -0
- tooluniverse/remote/expert_feedback/web_only_interface.py +0 -0
- tooluniverse/remote/expert_feedback_mcp/human_expert_mcp_server.py +1611 -0
- tooluniverse/remote/expert_feedback_mcp/simple_test.py +34 -0
- tooluniverse/remote/expert_feedback_mcp/start_web_interface.py +91 -0
- tooluniverse/remote/immune_compass/compass_tool.py +327 -0
- tooluniverse/remote/pinnacle/pinnacle_tool.py +328 -0
- tooluniverse/remote/transcriptformer/transcriptformer_tool.py +586 -0
- tooluniverse/remote/uspto_downloader/uspto_downloader_mcp_server.py +61 -0
- tooluniverse/remote/uspto_downloader/uspto_downloader_tool.py +120 -0
- tooluniverse/remote_tool.py +99 -0
- tooluniverse/restful_tool.py +53 -30
- tooluniverse/scripts/generate_tool_graph.py +408 -0
- tooluniverse/scripts/visualize_tool_graph.py +829 -0
- tooluniverse/semantic_scholar_tool.py +62 -0
- tooluniverse/smcp.py +2452 -0
- tooluniverse/smcp_server.py +975 -0
- tooluniverse/test/mcp_server_test.py +0 -0
- tooluniverse/test/test_admetai_tool.py +370 -0
- tooluniverse/test/test_agentic_tool.py +129 -0
- tooluniverse/test/test_alphafold_tool.py +71 -0
- tooluniverse/test/test_chem_tool.py +37 -0
- tooluniverse/test/test_compose_lieraturereview.py +63 -0
- tooluniverse/test/test_compose_tool.py +448 -0
- tooluniverse/test/test_dailymed.py +69 -0
- tooluniverse/test/test_dataset_tool.py +200 -0
- tooluniverse/test/test_disease_target_score.py +56 -0
- tooluniverse/test/test_drugbank_filter_examples.py +179 -0
- tooluniverse/test/test_efo.py +31 -0
- tooluniverse/test/test_enrichr_tool.py +21 -0
- tooluniverse/test/test_europe_pmc_tool.py +20 -0
- tooluniverse/test/test_fda_adv.py +95 -0
- tooluniverse/test/test_fda_drug_labeling.py +91 -0
- tooluniverse/test/test_gene_ontology_tools.py +66 -0
- tooluniverse/test/test_gwas_tool.py +139 -0
- tooluniverse/test/test_hpa.py +625 -0
- tooluniverse/test/test_humanbase_tool.py +20 -0
- tooluniverse/test/test_idmap_tools.py +61 -0
- tooluniverse/test/test_mcp_server.py +211 -0
- tooluniverse/test/test_mcp_tool.py +247 -0
- tooluniverse/test/test_medlineplus.py +220 -0
- tooluniverse/test/test_openalex_tool.py +32 -0
- tooluniverse/test/test_opentargets.py +28 -0
- tooluniverse/test/test_pubchem_tool.py +116 -0
- tooluniverse/test/test_pubtator_tool.py +37 -0
- tooluniverse/test/test_rcsb_pdb_tool.py +86 -0
- tooluniverse/test/test_reactome.py +54 -0
- tooluniverse/test/test_semantic_scholar_tool.py +24 -0
- tooluniverse/test/test_software_tools.py +147 -0
- tooluniverse/test/test_tool_description_optimizer.py +49 -0
- tooluniverse/test/test_tool_finder.py +26 -0
- tooluniverse/test/test_tool_finder_llm.py +252 -0
- tooluniverse/test/test_tools_find.py +195 -0
- tooluniverse/test/test_uniprot_tools.py +74 -0
- tooluniverse/test/test_uspto_tool.py +72 -0
- tooluniverse/test/test_xml_tool.py +113 -0
- tooluniverse/tool_finder_embedding.py +267 -0
- tooluniverse/tool_finder_keyword.py +693 -0
- tooluniverse/tool_finder_llm.py +699 -0
- tooluniverse/tool_graph_web_ui.py +955 -0
- tooluniverse/tool_registry.py +416 -0
- tooluniverse/uniprot_tool.py +155 -0
- tooluniverse/url_tool.py +253 -0
- tooluniverse/uspto_tool.py +240 -0
- tooluniverse/utils.py +369 -41
- tooluniverse/xml_tool.py +369 -0
- tooluniverse-1.0.0.dist-info/METADATA +377 -0
- tooluniverse-1.0.0.dist-info/RECORD +186 -0
- {tooluniverse-0.1.4.dist-info → tooluniverse-1.0.0.dist-info}/WHEEL +1 -1
- tooluniverse-1.0.0.dist-info/entry_points.txt +9 -0
- tooluniverse-0.1.4.dist-info/METADATA +0 -141
- tooluniverse-0.1.4.dist-info/RECORD +0 -18
- {tooluniverse-0.1.4.dist-info → tooluniverse-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {tooluniverse-0.1.4.dist-info → tooluniverse-1.0.0.dist-info}/top_level.txt +0 -0
tooluniverse/__init__.py
CHANGED
|
@@ -1,17 +1,353 @@
|
|
|
1
|
+
from importlib.metadata import version
|
|
2
|
+
from typing import Any, Optional, List
|
|
1
3
|
from .execute_function import ToolUniverse
|
|
2
|
-
from .
|
|
3
|
-
from .
|
|
4
|
-
|
|
4
|
+
from .base_tool import BaseTool
|
|
5
|
+
from .default_config import default_tool_files
|
|
6
|
+
|
|
7
|
+
# Version information - read from package metadata or pyproject.toml
|
|
8
|
+
__version__ = version("tooluniverse")
|
|
9
|
+
from .tool_registry import register_tool, get_tool_registry
|
|
10
|
+
|
|
11
|
+
# Check if lazy loading is enabled
|
|
12
|
+
# LAZY_LOADING_ENABLED = os.getenv('TOOLUNIVERSE_LAZY_LOADING', 'true').lower() in ('true', '1', 'yes')
|
|
13
|
+
LAZY_LOADING_ENABLED = (
|
|
14
|
+
False # LAZY LOADING DISABLED BECAUSE IT'S STILL UNDER DEVELOPMENT
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
# Import MCP functionality
|
|
18
|
+
try:
|
|
19
|
+
from .mcp_integration import _patch_tooluniverse
|
|
20
|
+
|
|
21
|
+
# Automatically patch ToolUniverse with MCP methods
|
|
22
|
+
_patch_tooluniverse()
|
|
23
|
+
|
|
24
|
+
except ImportError:
|
|
25
|
+
# MCP functionality not available
|
|
26
|
+
pass
|
|
27
|
+
|
|
28
|
+
# Import SMCP with graceful fallback and consistent signatures for type checking
|
|
29
|
+
try:
|
|
30
|
+
from .smcp import SMCP, create_smcp_server
|
|
31
|
+
|
|
32
|
+
_SMCP_AVAILABLE = True
|
|
33
|
+
except ImportError:
|
|
34
|
+
_SMCP_AVAILABLE = False
|
|
35
|
+
|
|
36
|
+
class SMCP: # type: ignore[no-redef]
|
|
37
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
38
|
+
raise ImportError(
|
|
39
|
+
"SMCP requires FastMCP. Install with: pip install fastmcp"
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
def create_smcp_server(
|
|
43
|
+
name: str = "SMCP Server",
|
|
44
|
+
tool_categories: Optional[List[str]] = None,
|
|
45
|
+
search_enabled: bool = True,
|
|
46
|
+
**kwargs: Any,
|
|
47
|
+
) -> SMCP:
|
|
48
|
+
raise ImportError("SMCP requires FastMCP. Install with: pip install fastmcp")
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class _LazyImportProxy:
|
|
52
|
+
"""A proxy that lazily imports modules and returns the requested class only when accessed."""
|
|
53
|
+
|
|
54
|
+
def __init__(self, module_name, class_name):
|
|
55
|
+
self._module_name = module_name
|
|
56
|
+
self._class_name = class_name
|
|
57
|
+
self._cached_class = None
|
|
58
|
+
|
|
59
|
+
def __call__(self, *args, **kwargs):
|
|
60
|
+
"""When the class is instantiated, import the module and create the instance."""
|
|
61
|
+
if self._cached_class is None:
|
|
62
|
+
try:
|
|
63
|
+
import importlib
|
|
64
|
+
|
|
65
|
+
module = importlib.import_module(
|
|
66
|
+
f".{self._module_name}", package="tooluniverse"
|
|
67
|
+
)
|
|
68
|
+
self._cached_class = getattr(module, self._class_name)
|
|
69
|
+
except (ImportError, AttributeError) as e:
|
|
70
|
+
raise ImportError(
|
|
71
|
+
f"Failed to lazily import {self._class_name} from {self._module_name}: {e}"
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
return self._cached_class(*args, **kwargs)
|
|
75
|
+
|
|
76
|
+
def __getattr__(self, name):
|
|
77
|
+
"""Forward attribute access to the actual class after importing."""
|
|
78
|
+
if self._cached_class is None:
|
|
79
|
+
try:
|
|
80
|
+
import importlib
|
|
81
|
+
|
|
82
|
+
module = importlib.import_module(
|
|
83
|
+
f".{self._module_name}", package="tooluniverse"
|
|
84
|
+
)
|
|
85
|
+
self._cached_class = getattr(module, self._class_name)
|
|
86
|
+
except (ImportError, AttributeError) as e:
|
|
87
|
+
raise ImportError(
|
|
88
|
+
f"Failed to lazily import {self._class_name} from {self._module_name}: {e}"
|
|
89
|
+
)
|
|
90
|
+
|
|
91
|
+
return getattr(self._cached_class, name)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Only import tool classes if lazy loading is disabled
|
|
95
|
+
MonarchTool: Any
|
|
96
|
+
MonarchDiseasesForMultiplePhenoTool: Any
|
|
97
|
+
ClinicalTrialsSearchTool: Any
|
|
98
|
+
ClinicalTrialsDetailsTool: Any
|
|
99
|
+
OpentargetTool: Any
|
|
100
|
+
OpentargetGeneticsTool: Any
|
|
101
|
+
OpentargetToolDrugNameMatch: Any
|
|
102
|
+
DiseaseTargetScoreTool: Any
|
|
103
|
+
FDADrugLabelTool: Any
|
|
104
|
+
FDADrugLabelSearchTool: Any
|
|
105
|
+
FDADrugLabelSearchIDTool: Any
|
|
106
|
+
FDADrugLabelGetDrugGenericNameTool: Any
|
|
107
|
+
FDADrugAdverseEventTool: Any
|
|
108
|
+
FDACountAdditiveReactionsTool: Any
|
|
109
|
+
ChEMBLTool: Any
|
|
110
|
+
EuropePMCTool: Any
|
|
111
|
+
SemanticScholarTool: Any
|
|
112
|
+
PubTatorTool: Any
|
|
113
|
+
EFOTool: Any
|
|
114
|
+
AgenticTool: Any
|
|
115
|
+
DatasetTool: Any
|
|
116
|
+
SearchSPLTool: Any
|
|
117
|
+
GetSPLBySetIDTool: Any
|
|
118
|
+
HPAGetGeneJSONTool: Any
|
|
119
|
+
HPAGetGeneXMLTool: Any
|
|
120
|
+
ReactomeRESTTool: Any
|
|
121
|
+
PubChemRESTTool: Any
|
|
122
|
+
URLHTMLTagTool: Any
|
|
123
|
+
URLToPDFTextTool: Any
|
|
124
|
+
MedlinePlusRESTTool: Any
|
|
125
|
+
UniProtRESTTool: Any
|
|
126
|
+
PackageTool: Any
|
|
127
|
+
USPTOOpenDataPortalTool: Any
|
|
128
|
+
XMLDatasetTool: Any
|
|
129
|
+
ToolFinderEmbedding: Any
|
|
130
|
+
ToolFinderKeyword: Any
|
|
131
|
+
ToolFinderLLM: Any
|
|
132
|
+
EmbeddingDatabase: Any
|
|
133
|
+
EmbeddingSync: Any
|
|
134
|
+
RCSBTool: Any
|
|
135
|
+
GWASAssociationSearch: Any
|
|
136
|
+
GWASStudySearch: Any
|
|
137
|
+
GWASSNPSearch: Any
|
|
138
|
+
GWASAssociationByID: Any
|
|
139
|
+
GWASStudyByID: Any
|
|
140
|
+
GWASSNPByID: Any
|
|
141
|
+
GWASVariantsForTrait: Any
|
|
142
|
+
GWASAssociationsForTrait: Any
|
|
143
|
+
GWASAssociationsForSNP: Any
|
|
144
|
+
GWASStudiesForTrait: Any
|
|
145
|
+
GWASSNPsForGene: Any
|
|
146
|
+
GWASAssociationsForStudy: Any
|
|
147
|
+
MCPClientTool: Any
|
|
148
|
+
MCPAutoLoaderTool: Any
|
|
149
|
+
ADMETAITool: Any
|
|
150
|
+
AlphaFoldRESTTool: Any
|
|
151
|
+
if not LAZY_LOADING_ENABLED:
|
|
152
|
+
# Import all tool classes immediately (old behavior)
|
|
153
|
+
from .restful_tool import MonarchTool, MonarchDiseasesForMultiplePhenoTool
|
|
154
|
+
from .ctg_tool import ClinicalTrialsSearchTool, ClinicalTrialsDetailsTool
|
|
155
|
+
from .graphql_tool import (
|
|
156
|
+
OpentargetTool,
|
|
157
|
+
OpentargetGeneticsTool,
|
|
158
|
+
OpentargetToolDrugNameMatch,
|
|
159
|
+
DiseaseTargetScoreTool,
|
|
160
|
+
)
|
|
161
|
+
from .openfda_tool import (
|
|
162
|
+
FDADrugLabelTool,
|
|
163
|
+
FDADrugLabelSearchTool,
|
|
164
|
+
FDADrugLabelSearchIDTool,
|
|
165
|
+
FDADrugLabelGetDrugGenericNameTool,
|
|
166
|
+
)
|
|
167
|
+
from .openfda_adv_tool import FDADrugAdverseEventTool, FDACountAdditiveReactionsTool
|
|
168
|
+
from .chem_tool import ChEMBLTool
|
|
169
|
+
from .europe_pmc_tool import EuropePMCTool
|
|
170
|
+
from .semantic_scholar_tool import SemanticScholarTool
|
|
171
|
+
from .pubtator_tool import PubTatorTool
|
|
172
|
+
from .efo_tool import EFOTool
|
|
173
|
+
from .agentic_tool import AgenticTool
|
|
174
|
+
from .dataset_tool import DatasetTool
|
|
175
|
+
from .dailymed_tool import SearchSPLTool, GetSPLBySetIDTool
|
|
176
|
+
from .hpa_tool import HPAGetGeneJSONTool, HPAGetGeneXMLTool
|
|
177
|
+
from .reactome_tool import ReactomeRESTTool
|
|
178
|
+
from .pubchem_tool import PubChemRESTTool
|
|
179
|
+
from .url_tool import URLHTMLTagTool, URLToPDFTextTool
|
|
180
|
+
from .medlineplus_tool import MedlinePlusRESTTool
|
|
181
|
+
from .uniprot_tool import UniProtRESTTool
|
|
182
|
+
from .package_tool import PackageTool
|
|
183
|
+
from .uspto_tool import USPTOOpenDataPortalTool
|
|
184
|
+
from .xml_tool import XMLDatasetTool
|
|
185
|
+
from .tool_finder_embedding import ToolFinderEmbedding
|
|
186
|
+
from .tool_finder_keyword import ToolFinderKeyword
|
|
187
|
+
from .tool_finder_llm import ToolFinderLLM
|
|
188
|
+
from .embedding_database import EmbeddingDatabase
|
|
189
|
+
from .embedding_sync import EmbeddingSync
|
|
190
|
+
from .rcsb_pdb_tool import RCSBTool
|
|
191
|
+
from .gwas_tool import (
|
|
192
|
+
GWASAssociationSearch,
|
|
193
|
+
GWASStudySearch,
|
|
194
|
+
GWASSNPSearch,
|
|
195
|
+
GWASAssociationByID,
|
|
196
|
+
GWASStudyByID,
|
|
197
|
+
GWASSNPByID,
|
|
198
|
+
GWASVariantsForTrait,
|
|
199
|
+
GWASAssociationsForTrait,
|
|
200
|
+
GWASAssociationsForSNP,
|
|
201
|
+
GWASStudiesForTrait,
|
|
202
|
+
GWASSNPsForGene,
|
|
203
|
+
GWASAssociationsForStudy,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
# from .admetai_tool import ADMETAITool
|
|
207
|
+
from .mcp_client_tool import MCPClientTool, MCPAutoLoaderTool
|
|
208
|
+
from .admetai_tool import ADMETAITool
|
|
209
|
+
from .alphafold_tool import AlphaFoldRESTTool
|
|
210
|
+
else:
|
|
211
|
+
# With lazy loading, create lazy import proxies that import modules only when accessed
|
|
212
|
+
MonarchTool = _LazyImportProxy("restful_tool", "MonarchTool")
|
|
213
|
+
MonarchDiseasesForMultiplePhenoTool = _LazyImportProxy(
|
|
214
|
+
"restful_tool", "MonarchDiseasesForMultiplePhenoTool"
|
|
215
|
+
)
|
|
216
|
+
ClinicalTrialsSearchTool = _LazyImportProxy("ctg_tool", "ClinicalTrialsSearchTool")
|
|
217
|
+
ClinicalTrialsDetailsTool = _LazyImportProxy(
|
|
218
|
+
"ctg_tool", "ClinicalTrialsDetailsTool"
|
|
219
|
+
)
|
|
220
|
+
OpentargetTool = _LazyImportProxy("graphql_tool", "OpentargetTool")
|
|
221
|
+
OpentargetGeneticsTool = _LazyImportProxy("graphql_tool", "OpentargetGeneticsTool")
|
|
222
|
+
OpentargetToolDrugNameMatch = _LazyImportProxy(
|
|
223
|
+
"graphql_tool", "OpentargetToolDrugNameMatch"
|
|
224
|
+
)
|
|
225
|
+
DiseaseTargetScoreTool = _LazyImportProxy("graphql_tool", "DiseaseTargetScoreTool")
|
|
226
|
+
FDADrugLabelTool = _LazyImportProxy("openfda_tool", "FDADrugLabelTool")
|
|
227
|
+
FDADrugLabelSearchTool = _LazyImportProxy("openfda_tool", "FDADrugLabelSearchTool")
|
|
228
|
+
FDADrugLabelSearchIDTool = _LazyImportProxy(
|
|
229
|
+
"openfda_tool", "FDADrugLabelSearchIDTool"
|
|
230
|
+
)
|
|
231
|
+
FDADrugLabelGetDrugGenericNameTool = _LazyImportProxy(
|
|
232
|
+
"openfda_tool", "FDADrugLabelGetDrugGenericNameTool"
|
|
233
|
+
)
|
|
234
|
+
FDADrugAdverseEventTool = _LazyImportProxy(
|
|
235
|
+
"openfda_adv_tool", "FDADrugAdverseEventTool"
|
|
236
|
+
)
|
|
237
|
+
FDACountAdditiveReactionsTool = _LazyImportProxy(
|
|
238
|
+
"openfda_adv_tool", "FDACountAdditiveReactionsTool"
|
|
239
|
+
)
|
|
240
|
+
ChEMBLTool = _LazyImportProxy("chem_tool", "ChEMBLTool")
|
|
241
|
+
EuropePMCTool = _LazyImportProxy("europe_pmc_tool", "EuropePMCTool")
|
|
242
|
+
SemanticScholarTool = _LazyImportProxy(
|
|
243
|
+
"semantic_scholar_tool", "SemanticScholarTool"
|
|
244
|
+
)
|
|
245
|
+
PubTatorTool = _LazyImportProxy("pubtator_tool", "PubTatorTool")
|
|
246
|
+
EFOTool = _LazyImportProxy("efo_tool", "EFOTool")
|
|
247
|
+
AgenticTool = _LazyImportProxy("agentic_tool", "AgenticTool")
|
|
248
|
+
DatasetTool = _LazyImportProxy("dataset_tool", "DatasetTool")
|
|
249
|
+
SearchSPLTool = _LazyImportProxy("dailymed_tool", "SearchSPLTool")
|
|
250
|
+
GetSPLBySetIDTool = _LazyImportProxy("dailymed_tool", "GetSPLBySetIDTool")
|
|
251
|
+
HPAGetGeneJSONTool = _LazyImportProxy("hpa_tool", "HPAGetGeneJSONTool")
|
|
252
|
+
HPAGetGeneXMLTool = _LazyImportProxy("hpa_tool", "HPAGetGeneXMLTool")
|
|
253
|
+
ReactomeRESTTool = _LazyImportProxy("reactome_tool", "ReactomeRESTTool")
|
|
254
|
+
PubChemRESTTool = _LazyImportProxy("pubchem_tool", "PubChemRESTTool")
|
|
255
|
+
URLHTMLTagTool = _LazyImportProxy("url_tool", "URLHTMLTagTool")
|
|
256
|
+
URLToPDFTextTool = _LazyImportProxy("url_tool", "URLToPDFTextTool")
|
|
257
|
+
MedlinePlusRESTTool = _LazyImportProxy("medlineplus_tool", "MedlinePlusRESTTool")
|
|
258
|
+
UniProtRESTTool = _LazyImportProxy("uniprot_tool", "UniProtRESTTool")
|
|
259
|
+
PackageTool = _LazyImportProxy("package_tool", "PackageTool")
|
|
260
|
+
USPTOOpenDataPortalTool = _LazyImportProxy("uspto_tool", "USPTOOpenDataPortalTool")
|
|
261
|
+
XMLDatasetTool = _LazyImportProxy("xml_tool", "XMLDatasetTool")
|
|
262
|
+
ToolFinderEmbedding = _LazyImportProxy(
|
|
263
|
+
"tool_finder_embedding", "ToolFinderEmbedding"
|
|
264
|
+
)
|
|
265
|
+
ToolFinderKeyword = _LazyImportProxy("tool_finder_keyword", "ToolFinderKeyword")
|
|
266
|
+
ToolFinderLLM = _LazyImportProxy("tool_finder_llm", "ToolFinderLLM")
|
|
267
|
+
EmbeddingDatabase = _LazyImportProxy("embedding_database", "EmbeddingDatabase")
|
|
268
|
+
EmbeddingSync = _LazyImportProxy("embedding_sync", "EmbeddingSync")
|
|
269
|
+
RCSBTool = _LazyImportProxy("rcsb_pdb_tool", "RCSBTool")
|
|
270
|
+
GWASAssociationSearch = _LazyImportProxy("gwas_tool", "GWASAssociationSearch")
|
|
271
|
+
GWASStudySearch = _LazyImportProxy("gwas_tool", "GWASStudySearch")
|
|
272
|
+
GWASSNPSearch = _LazyImportProxy("gwas_tool", "GWASSNPSearch")
|
|
273
|
+
GWASAssociationByID = _LazyImportProxy("gwas_tool", "GWASAssociationByID")
|
|
274
|
+
GWASStudyByID = _LazyImportProxy("gwas_tool", "GWASStudyByID")
|
|
275
|
+
GWASSNPByID = _LazyImportProxy("gwas_tool", "GWASSNPByID")
|
|
276
|
+
GWASVariantsForTrait = _LazyImportProxy("gwas_tool", "GWASVariantsForTrait")
|
|
277
|
+
GWASAssociationsForTrait = _LazyImportProxy("gwas_tool", "GWASAssociationsForTrait")
|
|
278
|
+
GWASAssociationsForSNP = _LazyImportProxy("gwas_tool", "GWASAssociationsForSNP")
|
|
279
|
+
GWASStudiesForTrait = _LazyImportProxy("gwas_tool", "GWASStudiesForTrait")
|
|
280
|
+
GWASSNPsForGene = _LazyImportProxy("gwas_tool", "GWASSNPsForGene")
|
|
281
|
+
GWASAssociationsForStudy = _LazyImportProxy("gwas_tool", "GWASAssociationsForStudy")
|
|
282
|
+
MCPClientTool = _LazyImportProxy("mcp_client_tool", "MCPClientTool")
|
|
283
|
+
MCPAutoLoaderTool = _LazyImportProxy("mcp_client_tool", "MCPAutoLoaderTool")
|
|
284
|
+
ADMETAITool = _LazyImportProxy("admetai_tool", "ADMETAITool")
|
|
285
|
+
AlphaFoldRESTTool = _LazyImportProxy("alphafold_tool", "AlphaFoldRESTTool")
|
|
286
|
+
|
|
5
287
|
|
|
6
288
|
__all__ = [
|
|
289
|
+
"__version__",
|
|
7
290
|
"ToolUniverse",
|
|
291
|
+
"BaseTool",
|
|
292
|
+
"register_tool",
|
|
293
|
+
"get_tool_registry",
|
|
8
294
|
"MonarchTool",
|
|
9
295
|
"MonarchDiseasesForMultiplePhenoTool",
|
|
296
|
+
"ClinicalTrialsSearchTool",
|
|
297
|
+
"ClinicalTrialsDetailsTool",
|
|
10
298
|
"OpentargetTool",
|
|
11
299
|
"OpentargetGeneticsTool",
|
|
12
300
|
"OpentargetToolDrugNameMatch",
|
|
301
|
+
"DiseaseTargetScoreTool",
|
|
13
302
|
"FDADrugLabelTool",
|
|
14
303
|
"FDADrugLabelSearchTool",
|
|
15
304
|
"FDADrugLabelSearchIDTool",
|
|
16
|
-
"FDADrugLabelGetDrugGenericNameTool"
|
|
305
|
+
"FDADrugLabelGetDrugGenericNameTool",
|
|
306
|
+
"FDADrugAdverseEventTool",
|
|
307
|
+
"FDACountAdditiveReactionsTool",
|
|
308
|
+
"ChEMBLTool",
|
|
309
|
+
"EuropePMCTool",
|
|
310
|
+
"SemanticScholarTool",
|
|
311
|
+
"PubTatorTool",
|
|
312
|
+
"EFOTool",
|
|
313
|
+
"AgenticTool",
|
|
314
|
+
"DatasetTool",
|
|
315
|
+
"SearchSPLTool",
|
|
316
|
+
"GetSPLBySetIDTool",
|
|
317
|
+
"HPAGetGeneJSONTool",
|
|
318
|
+
"HPAGetGeneXMLTool",
|
|
319
|
+
"ReactomeRESTTool",
|
|
320
|
+
"PubChemRESTTool",
|
|
321
|
+
"MedlinePlusRESTTool",
|
|
322
|
+
"UniProtRESTTool",
|
|
323
|
+
"PackageTool",
|
|
324
|
+
"SMCP",
|
|
325
|
+
"create_smcp_server",
|
|
326
|
+
"USPTOOpenDataPortalTool",
|
|
327
|
+
"XMLDatasetTool",
|
|
328
|
+
"ToolFinderKeyword",
|
|
329
|
+
"ToolFinderLLM",
|
|
330
|
+
"URLHTMLTagTool",
|
|
331
|
+
"URLToPDFTextTool",
|
|
332
|
+
"RCSBTool",
|
|
333
|
+
"GWASAssociationSearch",
|
|
334
|
+
"GWASStudySearch",
|
|
335
|
+
"GWASSNPSearch",
|
|
336
|
+
"GWASAssociationByID",
|
|
337
|
+
"GWASStudyByID",
|
|
338
|
+
"GWASSNPByID",
|
|
339
|
+
"GWASVariantsForTrait",
|
|
340
|
+
"GWASAssociationsForTrait",
|
|
341
|
+
"GWASAssociationsForSNP",
|
|
342
|
+
"GWASStudiesForTrait",
|
|
343
|
+
"GWASSNPsForGene",
|
|
344
|
+
"GWASAssociationsForStudy",
|
|
345
|
+
"MCPClientTool",
|
|
346
|
+
"MCPAutoLoaderTool",
|
|
347
|
+
"ADMETAITool",
|
|
348
|
+
"default_tool_files",
|
|
349
|
+
"EmbeddingDatabase",
|
|
350
|
+
"EmbeddingSync",
|
|
351
|
+
"ToolFinderEmbedding",
|
|
352
|
+
"AlphaFoldRESTTool",
|
|
17
353
|
]
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import numpy
|
|
2
|
+
from .base_tool import BaseTool
|
|
3
|
+
from .tool_registry import register_tool
|
|
4
|
+
import torch
|
|
5
|
+
|
|
6
|
+
# Patch for numpy.VisibleDeprecationWarning for newer numpy versions
|
|
7
|
+
if not hasattr(numpy, "VisibleDeprecationWarning"):
|
|
8
|
+
import numpy.exceptions
|
|
9
|
+
|
|
10
|
+
numpy.VisibleDeprecationWarning = numpy.exceptions.VisibleDeprecationWarning
|
|
11
|
+
|
|
12
|
+
_original_torch_load = torch.load
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# Patch for torch.load to set weights_only=False by default
|
|
16
|
+
def _patched_torch_load(*args, **kwargs):
|
|
17
|
+
if "weights_only" not in kwargs:
|
|
18
|
+
kwargs["weights_only"] = False
|
|
19
|
+
return _original_torch_load(*args, **kwargs)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
torch.load = _patched_torch_load
|
|
23
|
+
|
|
24
|
+
from admet_ai import ADMETModel # noqa: E402
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@register_tool("ADMETAITool")
|
|
28
|
+
class ADMETAITool(BaseTool):
|
|
29
|
+
"""Tool to predict ADMET properties for a given SMILES string using the admet-ai Python package."""
|
|
30
|
+
|
|
31
|
+
def __init__(self, **kwargs):
|
|
32
|
+
super().__init__(**kwargs)
|
|
33
|
+
|
|
34
|
+
def _predict(self, smiles: str) -> dict:
|
|
35
|
+
"""
|
|
36
|
+
Gets ADMET predictions for the given smiles
|
|
37
|
+
"""
|
|
38
|
+
model = ADMETModel()
|
|
39
|
+
preds = model.predict(smiles=smiles)
|
|
40
|
+
return preds
|
|
41
|
+
|
|
42
|
+
def run(self, arguments: dict) -> dict:
|
|
43
|
+
"""
|
|
44
|
+
Predicts ADMET properties for a given SMILES string.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
smiles: The SMILES string(s) of the molecule(s).
|
|
48
|
+
|
|
49
|
+
Returns:
|
|
50
|
+
A dictionary mapping each SMILES string to a subdictionary of selected ADMET properties and their predicted values.
|
|
51
|
+
"""
|
|
52
|
+
smiles = arguments.get("smiles", [])
|
|
53
|
+
if not smiles:
|
|
54
|
+
return {"error": "SMILES string cannot be empty."}
|
|
55
|
+
|
|
56
|
+
# Get the columns to select from the tool definition
|
|
57
|
+
columns = getattr(self, "columns", None)
|
|
58
|
+
if columns is None and hasattr(self, "tool_config") and self.tool_config:
|
|
59
|
+
columns = self.tool_config.get("columns", None)
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
predictions = self._predict(smiles)
|
|
63
|
+
if (hasattr(predictions, "empty") and predictions.empty) or (
|
|
64
|
+
not hasattr(predictions, "empty") and not predictions
|
|
65
|
+
):
|
|
66
|
+
return {"error": "No predictions could be extracted."}
|
|
67
|
+
|
|
68
|
+
# Expand columns to include _drugbank_approved_percentile columns if present
|
|
69
|
+
if columns is not None:
|
|
70
|
+
expanded_columns = []
|
|
71
|
+
for col in columns:
|
|
72
|
+
expanded_columns.append(col)
|
|
73
|
+
percentile_col = f"{col}_drugbank_approved_percentile"
|
|
74
|
+
if percentile_col in predictions.columns:
|
|
75
|
+
expanded_columns.append(percentile_col)
|
|
76
|
+
predictions = predictions[expanded_columns]
|
|
77
|
+
|
|
78
|
+
# Organize output: {smiles: {col: value, ...}, ...}
|
|
79
|
+
result = {}
|
|
80
|
+
for idx, row in predictions.iterrows():
|
|
81
|
+
result[idx] = {col: row[col] for col in predictions.columns}
|
|
82
|
+
return result
|
|
83
|
+
except Exception as e:
|
|
84
|
+
return {"error": f"An unexpected error occurred: {e}"}
|