tooluniverse 0.2.0__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 +1 -1
- 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 +1 -1
- 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-1.0.0.dist-info/entry_points.txt +9 -0
- tooluniverse/generate_mcp_tools.py +0 -113
- tooluniverse/mcp_server.py +0 -3340
- tooluniverse-0.2.0.dist-info/METADATA +0 -139
- tooluniverse-0.2.0.dist-info/RECORD +0 -21
- tooluniverse-0.2.0.dist-info/entry_points.txt +0 -4
- {tooluniverse-0.2.0.dist-info → tooluniverse-1.0.0.dist-info}/WHEEL +0 -0
- {tooluniverse-0.2.0.dist-info → tooluniverse-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {tooluniverse-0.2.0.dist-info → tooluniverse-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
# test_medlineplus.py
|
|
2
|
+
|
|
3
|
+
from tooluniverse import ToolUniverse
|
|
4
|
+
import json
|
|
5
|
+
|
|
6
|
+
# Step 1: Initialize ToolUniverse and load all tools (including MedlinePlus tools)
|
|
7
|
+
tooluni = ToolUniverse()
|
|
8
|
+
tooluni.load_tools()
|
|
9
|
+
|
|
10
|
+
# Step 2: Define example inputs
|
|
11
|
+
VALID_TERM_EN = "diabetes" # English health topic keyword
|
|
12
|
+
VALID_DB_EN = "healthTopics" # English health topics database
|
|
13
|
+
VALID_TERM_ES = "diabetes" # Spanish health topic keyword
|
|
14
|
+
VALID_DB_ES = "healthTopicsSpanish" # Spanish health topics database
|
|
15
|
+
|
|
16
|
+
# ICD-10 CM examples
|
|
17
|
+
VALID_CS_ICD10 = "2.16.840.1.113883.6.90"
|
|
18
|
+
VALID_CODE_ICD10 = "E11.9" # Diabetes without complications
|
|
19
|
+
|
|
20
|
+
# RXCUI examples
|
|
21
|
+
VALID_CS_RXCUI = "2.16.840.1.113883.6.88"
|
|
22
|
+
VALID_CODE_RXCUI = "637188" # RXCUI for Chantix
|
|
23
|
+
VALID_DN_RXCUI = "Chantix 0.5 MG Oral Tablet"
|
|
24
|
+
|
|
25
|
+
# Genetics examples
|
|
26
|
+
VALID_CONDITION = "alzheimer-disease" # Genetic condition URL slug
|
|
27
|
+
VALID_GENE = "BRCA1" # Gene URL slug
|
|
28
|
+
|
|
29
|
+
# Invalid examples
|
|
30
|
+
INVALID_TERM = "" # Empty keyword
|
|
31
|
+
INVALID_CS = "INVALID_CS" # Invalid code system
|
|
32
|
+
INVALID_CODE = "INVALID_CODE" # Invalid code value
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def print_result(result, tool_name):
|
|
36
|
+
"""Print formatted results"""
|
|
37
|
+
if isinstance(result, dict):
|
|
38
|
+
if "error" in result:
|
|
39
|
+
print("⚠️ Error:", result["error"])
|
|
40
|
+
if "detail" in result:
|
|
41
|
+
print("Detail:", result["detail"])
|
|
42
|
+
return
|
|
43
|
+
|
|
44
|
+
# Define output formats
|
|
45
|
+
formats = {
|
|
46
|
+
"MedlinePlus_search_topics_by_keyword": {
|
|
47
|
+
"title": "📚 Health Topic Search Results",
|
|
48
|
+
"items": "topics",
|
|
49
|
+
"fields": {
|
|
50
|
+
"title": "Title",
|
|
51
|
+
"meta_desc": "Description",
|
|
52
|
+
"url": "Link",
|
|
53
|
+
"language": "Language",
|
|
54
|
+
"rank": "Rank",
|
|
55
|
+
"also_called": "Also Known As",
|
|
56
|
+
"summary": "Detailed Summary",
|
|
57
|
+
"groups": "Categories",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
"MedlinePlus_connect_lookup_by_code": {
|
|
61
|
+
"title": "🔍 Code Lookup Results",
|
|
62
|
+
"items": "responses",
|
|
63
|
+
"fields": {"title": "Title", "summary": "Summary", "url": "Link"},
|
|
64
|
+
},
|
|
65
|
+
"MedlinePlus_get_genetics_condition_by_name": {
|
|
66
|
+
"title": "🧬 Genetic Condition Information",
|
|
67
|
+
"fields": {
|
|
68
|
+
"name": "Condition Name",
|
|
69
|
+
"description": "Description",
|
|
70
|
+
"genes": "Related Genes",
|
|
71
|
+
"synonyms": "Synonyms",
|
|
72
|
+
"ghr_page": "Detailed Information Page",
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
"MedlinePlus_get_genetics_gene_by_name": {
|
|
76
|
+
"title": "🧬 Gene Information",
|
|
77
|
+
"fields": {
|
|
78
|
+
"name": "Gene Name",
|
|
79
|
+
"function": "Function Description",
|
|
80
|
+
"health_conditions": "Related Health Conditions",
|
|
81
|
+
"synonyms": "Synonyms",
|
|
82
|
+
"ghr_page": "Detailed Information Page",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
"MedlinePlus_get_genetics_index": {
|
|
86
|
+
"title": "📋 Genetics Topics List",
|
|
87
|
+
"items": "topics",
|
|
88
|
+
"fields": {"name": "Name", "url": "Link"},
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
# Get tool output format
|
|
93
|
+
fmt = formats.get(tool_name, {})
|
|
94
|
+
if not fmt:
|
|
95
|
+
print("\nRaw Response:")
|
|
96
|
+
print(json.dumps(result, indent=2, ensure_ascii=False))
|
|
97
|
+
return
|
|
98
|
+
|
|
99
|
+
# Print title
|
|
100
|
+
print(f"\n{fmt['title']}:")
|
|
101
|
+
|
|
102
|
+
# Handle list type responses
|
|
103
|
+
if "items" in fmt:
|
|
104
|
+
items = result.get(fmt["items"], [])
|
|
105
|
+
if not items:
|
|
106
|
+
print("No related content found")
|
|
107
|
+
return
|
|
108
|
+
for i, item in enumerate(items, 1):
|
|
109
|
+
print(f"\n{i}. {item.get(list(fmt['fields'].keys())[0], '')}")
|
|
110
|
+
for field, label in fmt["fields"].items():
|
|
111
|
+
value = item.get(field, "")
|
|
112
|
+
if isinstance(value, list):
|
|
113
|
+
print(f" {label}:")
|
|
114
|
+
for v in value:
|
|
115
|
+
print(f" - {v}")
|
|
116
|
+
else:
|
|
117
|
+
print(f" {label}: {value}")
|
|
118
|
+
return
|
|
119
|
+
|
|
120
|
+
# Handle dictionary type responses
|
|
121
|
+
for field, label in fmt["fields"].items():
|
|
122
|
+
value = result.get(field, "")
|
|
123
|
+
if isinstance(value, list):
|
|
124
|
+
print(f"\n{label}:")
|
|
125
|
+
for item in value:
|
|
126
|
+
print(f"- {item}")
|
|
127
|
+
else:
|
|
128
|
+
print(f"\n{label}: {value}")
|
|
129
|
+
|
|
130
|
+
elif isinstance(result, str):
|
|
131
|
+
print("\nRaw Response Text:")
|
|
132
|
+
print(result)
|
|
133
|
+
else:
|
|
134
|
+
print("\nOther Type Response:")
|
|
135
|
+
print(result)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
# Step 3: Define test case list
|
|
139
|
+
test_queries = [
|
|
140
|
+
# Health topic search - using simpler search terms
|
|
141
|
+
{
|
|
142
|
+
"name": "MedlinePlus_search_topics_by_keyword",
|
|
143
|
+
"arguments": {"term": "heart", "db": "healthTopics", "rettype": "topic"},
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "MedlinePlus_search_topics_by_keyword",
|
|
147
|
+
"arguments": {"term": "diabetes", "db": "healthTopics", "rettype": "topic"},
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "MedlinePlus_search_topics_by_keyword",
|
|
151
|
+
"arguments": {"term": "cancer", "db": "healthTopics", "rettype": "brief"},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"name": "MedlinePlus_search_topics_by_keyword",
|
|
155
|
+
"arguments": {
|
|
156
|
+
"term": "diabetes",
|
|
157
|
+
"db": "healthTopicsSpanish",
|
|
158
|
+
"rettype": "topic",
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
# Code lookup
|
|
162
|
+
{
|
|
163
|
+
"name": "MedlinePlus_connect_lookup_by_code",
|
|
164
|
+
"arguments": {
|
|
165
|
+
"cs": "2.16.840.1.113883.6.90",
|
|
166
|
+
"c": "E11.9",
|
|
167
|
+
"language": "en",
|
|
168
|
+
"format": "json",
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "MedlinePlus_connect_lookup_by_code",
|
|
173
|
+
"arguments": {
|
|
174
|
+
"cs": "2.16.840.1.113883.6.88",
|
|
175
|
+
"c": "637188",
|
|
176
|
+
"dn": "Chantix 0.5 MG Oral Tablet",
|
|
177
|
+
"language": "en",
|
|
178
|
+
"format": "xml",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
# Genetics information
|
|
182
|
+
{
|
|
183
|
+
"name": "MedlinePlus_get_genetics_condition_by_name",
|
|
184
|
+
"arguments": {"condition": "alzheimer-disease", "format": "json"},
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "MedlinePlus_get_genetics_gene_by_name",
|
|
188
|
+
"arguments": {"gene": "BRCA1", "format": "json"},
|
|
189
|
+
},
|
|
190
|
+
{"name": "MedlinePlus_get_genetics_index", "arguments": {}},
|
|
191
|
+
# Error testing
|
|
192
|
+
{
|
|
193
|
+
"name": "MedlinePlus_search_topics_by_keyword",
|
|
194
|
+
"arguments": {"term": "", "db": "healthTopics", "rettype": "topic"},
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "MedlinePlus_connect_lookup_by_code",
|
|
198
|
+
"arguments": {
|
|
199
|
+
"cs": "INVALID_CS",
|
|
200
|
+
"c": "INVALID_CODE",
|
|
201
|
+
"language": "en",
|
|
202
|
+
"format": "json",
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
]
|
|
206
|
+
|
|
207
|
+
# Step 4: Loop through all test cases and print example output
|
|
208
|
+
for idx, query in enumerate(test_queries):
|
|
209
|
+
print(f"\n{'='*80}")
|
|
210
|
+
print(f"[{idx+1}] Running tool: {query['name']}")
|
|
211
|
+
print(f"Arguments: {query['arguments']}")
|
|
212
|
+
print(f"{'='*80}")
|
|
213
|
+
|
|
214
|
+
try:
|
|
215
|
+
result = tooluni.run(query)
|
|
216
|
+
print_result(result, query["name"])
|
|
217
|
+
except Exception as e:
|
|
218
|
+
print("⚠️ Exception:", e)
|
|
219
|
+
|
|
220
|
+
print("\n🎉 MedlinePlus Testing Complete!")
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# === openfda_test_all_tools.py ===
|
|
2
|
+
|
|
3
|
+
from tooluniverse import ToolUniverse
|
|
4
|
+
|
|
5
|
+
# Step 1: Initialize tool universe
|
|
6
|
+
tooluni = ToolUniverse()
|
|
7
|
+
tooluni.load_tools()
|
|
8
|
+
|
|
9
|
+
# Step 2: Define test queries for the openalex tool
|
|
10
|
+
test_queries = [
|
|
11
|
+
{
|
|
12
|
+
"name": "openalex_literature_search",
|
|
13
|
+
"arguments": {
|
|
14
|
+
"search_keywords": "cancer",
|
|
15
|
+
"max_results": 10,
|
|
16
|
+
"year_from": 2020,
|
|
17
|
+
"year_to": 2023,
|
|
18
|
+
"open_access": True,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Step 3: Run all test queries
|
|
24
|
+
for idx, query in enumerate(test_queries):
|
|
25
|
+
print(
|
|
26
|
+
f"\n[{idx+1}] Running tool: {query['name']} with arguments: {query['arguments']}"
|
|
27
|
+
)
|
|
28
|
+
result = tooluni.run(query)
|
|
29
|
+
print("✅ Success. Example output snippet:")
|
|
30
|
+
print(
|
|
31
|
+
result if isinstance(result, dict) else str(result)
|
|
32
|
+
) # Print snippet if result is big
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from tooluniverse import ToolUniverse
|
|
2
|
+
|
|
3
|
+
# Step 1: Initialize tool universe
|
|
4
|
+
tooluni = ToolUniverse()
|
|
5
|
+
tooluni.load_tools()
|
|
6
|
+
|
|
7
|
+
# Step 2: Define test queries for the opentargets tool
|
|
8
|
+
test_queries = [
|
|
9
|
+
{"name": "Tool_Finder", "arguments": {"diseaseName": "Bardet-Biedl syndrome"}},
|
|
10
|
+
{
|
|
11
|
+
"name": "OpenTargets_get_drug_adverse_events_by_chemblId",
|
|
12
|
+
"arguments": {"chemblId": "CHEMBL980"},
|
|
13
|
+
},
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
# Step 3: Run all test queries
|
|
17
|
+
for idx, query in enumerate(test_queries):
|
|
18
|
+
# try:
|
|
19
|
+
print(
|
|
20
|
+
f"\n[{idx+1}] Running tool: {query['name']} with arguments: {query['arguments']}"
|
|
21
|
+
)
|
|
22
|
+
result = tooluni.run(query)
|
|
23
|
+
print("✅ Success. Example output snippet:")
|
|
24
|
+
print(
|
|
25
|
+
result if isinstance(result, dict) else str(result)
|
|
26
|
+
) # Print snippet if result is big
|
|
27
|
+
# except Exception as e:
|
|
28
|
+
# print(f"❌ Failed. Error: {str(e)}")
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# test_pubchem_tools.py
|
|
2
|
+
|
|
3
|
+
from tooluniverse import ToolUniverse
|
|
4
|
+
|
|
5
|
+
# Step 1: Initialize ToolUniverse and load all tools (including PubChem tools)
|
|
6
|
+
tooluni = ToolUniverse()
|
|
7
|
+
tooluni.load_tools()
|
|
8
|
+
|
|
9
|
+
# Step 2: Define example inputs
|
|
10
|
+
# Please confirm before execution:
|
|
11
|
+
# - 2244 (Aspirin) is actually available in PubChem
|
|
12
|
+
# - "Aspirin" matches its CID
|
|
13
|
+
# - "CC(=O)OC1=CC=CC=C1C(=O)O" is the standard SMILES for aspirin
|
|
14
|
+
VALID_CID = 1983 # 2244 # Aspirin CID
|
|
15
|
+
VALID_NAME = "Aspirin" # Name query
|
|
16
|
+
VALID_SMILES = (
|
|
17
|
+
"C1=NC2=C(N1)C(=O)N=C(N2)N" # "CC(=O)OC1=CC=CC=C1C(=O)O" # Aspirin SMILES
|
|
18
|
+
)
|
|
19
|
+
VALID_SUBSTRUCTURE = "c1ccccc1" # Benzene ring substructure
|
|
20
|
+
VALID_THRESHOLD = 0.95 # 90 # 90% similarity threshold (integer)
|
|
21
|
+
INVALID_CID = -1 # Intentionally invalid
|
|
22
|
+
|
|
23
|
+
# For XRefs test, specify at least one external resource, e.g. "RegistryID", "RN"
|
|
24
|
+
VALID_XREF_TYPES = ["RegistryID", "RN"]
|
|
25
|
+
|
|
26
|
+
# Step 3: Define test case list
|
|
27
|
+
test_queries = [
|
|
28
|
+
# 1. Get molecular properties by CID
|
|
29
|
+
{"name": "PubChem_get_compound_properties_by_CID", "arguments": {"cid": VALID_CID}},
|
|
30
|
+
# 1.5 Get associated patents by CID
|
|
31
|
+
{"name": "PubChem_get_associated_patents_by_CID", "arguments": {"cid": VALID_CID}},
|
|
32
|
+
{
|
|
33
|
+
"name": "get_webpage_title",
|
|
34
|
+
"arguments": {"url": "https://pubchem.ncbi.nlm.nih.gov/patent/US6015577"},
|
|
35
|
+
},
|
|
36
|
+
# 2. Query CID by name
|
|
37
|
+
{"name": "PubChem_get_CID_by_compound_name", "arguments": {"name": VALID_NAME}},
|
|
38
|
+
# 3. Query CID by SMILES
|
|
39
|
+
{"name": "PubChem_get_CID_by_SMILES", "arguments": {"smiles": VALID_SMILES}},
|
|
40
|
+
# 4. Substructure search
|
|
41
|
+
{
|
|
42
|
+
"name": "PubChem_search_compounds_by_substructure",
|
|
43
|
+
"arguments": {"smiles": VALID_SUBSTRUCTURE},
|
|
44
|
+
},
|
|
45
|
+
# 5. Similarity search (using SMILES and threshold)
|
|
46
|
+
{
|
|
47
|
+
"name": "PubChem_search_compounds_by_similarity",
|
|
48
|
+
"arguments": {"smiles": VALID_SMILES, "threshold": VALID_THRESHOLD},
|
|
49
|
+
},
|
|
50
|
+
# 6. Get 2D structure image (PNG)
|
|
51
|
+
{
|
|
52
|
+
"name": "PubChem_get_compound_2D_image_by_CID",
|
|
53
|
+
"arguments": {"cid": VALID_CID, "image_size": "150x150"},
|
|
54
|
+
},
|
|
55
|
+
# 7. Get synonyms
|
|
56
|
+
{"name": "PubChem_get_compound_synonyms_by_CID", "arguments": {"cid": VALID_CID}},
|
|
57
|
+
# 8. Get external references (XRefs), need to pass at least one resource name
|
|
58
|
+
{
|
|
59
|
+
"name": "PubChem_get_compound_xrefs_by_CID",
|
|
60
|
+
"arguments": {"cid": VALID_CID, "xref_types": VALID_XREF_TYPES},
|
|
61
|
+
},
|
|
62
|
+
# 9. Invalid CID test → expect error
|
|
63
|
+
{
|
|
64
|
+
"name": "PubChem_get_compound_properties_by_CID",
|
|
65
|
+
"arguments": {"cid": INVALID_CID},
|
|
66
|
+
},
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
# Step 4: Loop through all test cases and print example output
|
|
70
|
+
for idx, query in enumerate(test_queries):
|
|
71
|
+
print(
|
|
72
|
+
f"\n[{idx+1}] Running tool: {query['name']} with arguments: {query['arguments']}"
|
|
73
|
+
)
|
|
74
|
+
result = tooluni.run(query)
|
|
75
|
+
|
|
76
|
+
# Check if contains "error"
|
|
77
|
+
if isinstance(result, dict) and "error" in result:
|
|
78
|
+
print("⚠️ Received error response:")
|
|
79
|
+
print(result)
|
|
80
|
+
continue
|
|
81
|
+
|
|
82
|
+
# Otherwise print example based on return type
|
|
83
|
+
print("✅ Success. Example output snippet:")
|
|
84
|
+
if isinstance(result, dict):
|
|
85
|
+
# Dictionary: print first 3 key-value pairs
|
|
86
|
+
print("Returned JSON, example first 3 key-value pairs:")
|
|
87
|
+
# cnt = 0
|
|
88
|
+
# for k, v in result.items():
|
|
89
|
+
# print(f" {k}: {v}")
|
|
90
|
+
# cnt += 1
|
|
91
|
+
# if cnt >= 3:
|
|
92
|
+
# break
|
|
93
|
+
print(result)
|
|
94
|
+
elif isinstance(result, list):
|
|
95
|
+
# List: print length and first item
|
|
96
|
+
print(f"Returned list with {len(result)} items, example first item:")
|
|
97
|
+
print(result[0])
|
|
98
|
+
elif isinstance(result, str):
|
|
99
|
+
# Text (CSV, TXT): print first line
|
|
100
|
+
# snippet = result.strip().split("\n")[0]
|
|
101
|
+
# print(f"Returned text (first line): {snippet} …")
|
|
102
|
+
print(result)
|
|
103
|
+
elif isinstance(result, (bytes, bytearray)):
|
|
104
|
+
# Binary (PNG): check PNG file header
|
|
105
|
+
if result.startswith(b"\x89PNG"):
|
|
106
|
+
print(
|
|
107
|
+
f"Returned PNG image ({len(result)} bytes), file header matches PNG signature."
|
|
108
|
+
)
|
|
109
|
+
else:
|
|
110
|
+
print(f"Returned binary ({len(result)} bytes).")
|
|
111
|
+
else:
|
|
112
|
+
# Other unexpected cases
|
|
113
|
+
repr_str = repr(result)
|
|
114
|
+
print(repr_str if len(repr_str) <= 200 else repr_str[:200] + "…")
|
|
115
|
+
|
|
116
|
+
print("\n🎉 PubChem testing completed!")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
from tooluniverse import ToolUniverse
|
|
2
|
+
|
|
3
|
+
# Step 1: Initialize tool universe and load available tools
|
|
4
|
+
tooluni = ToolUniverse()
|
|
5
|
+
tooluni.load_tools()
|
|
6
|
+
|
|
7
|
+
# Define test queries based on the updated pubtator_tools.json
|
|
8
|
+
test_queries = [
|
|
9
|
+
{
|
|
10
|
+
"name": "PubTator3_EntityAutocomplete",
|
|
11
|
+
"arguments": {"text": "BRAF", "entity_type": "GENE", "max_results": 5},
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "PubTator3_EntityAutocomplete",
|
|
15
|
+
"arguments": {"text": "TP53"}, # only required parameter
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "PubTator3_LiteratureSearch",
|
|
19
|
+
"arguments": {"query_text": "cancer", "page": 0, "page_size": 10},
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "PubTator3_LiteratureSearch",
|
|
23
|
+
"arguments": {"query_text": "diabetes"}, # minimal required args
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
# Run individual test queries
|
|
28
|
+
for idx, query in enumerate(test_queries):
|
|
29
|
+
try:
|
|
30
|
+
print(
|
|
31
|
+
f"\n[{idx+1}] Running tool: {query['name']} with arguments: {query['arguments']}"
|
|
32
|
+
)
|
|
33
|
+
result = tooluni.run(query)
|
|
34
|
+
print("✅ Success. Output snippet:")
|
|
35
|
+
print(result if isinstance(result, dict) else str(result)[:500])
|
|
36
|
+
except Exception as e:
|
|
37
|
+
print(f"❌ Failed running {query['name']}. Error: {e}")
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
from tooluniverse import ToolUniverse
|
|
2
|
+
|
|
3
|
+
# Step 1: Initialize tool universe
|
|
4
|
+
tooluni = ToolUniverse()
|
|
5
|
+
tooluni.load_tools()
|
|
6
|
+
|
|
7
|
+
# Step 2: Define test queries
|
|
8
|
+
# commented out = already tested but didn't add return_Schema. uncommented = not tested.
|
|
9
|
+
test_queries = [
|
|
10
|
+
{"name": "get_sequence_by_pdb_id", "arguments": {"pdb_id": "1XYZ"}},
|
|
11
|
+
{"name": "get_protein_metadata_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
12
|
+
{"name": "get_polymer_entity_ids_by_pdb_id", "arguments": {"pdb_id": "1A3N"}},
|
|
13
|
+
{
|
|
14
|
+
"name": "get_polymer_entity_type_by_entity_id",
|
|
15
|
+
"arguments": {"entity_id": "1A8M_1"},
|
|
16
|
+
},
|
|
17
|
+
{"name": "get_source_organism_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
18
|
+
{"name": "get_citation_info_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
19
|
+
{"name": "get_sequence_lengths_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
20
|
+
{"name": "get_mutation_annotations_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
21
|
+
{
|
|
22
|
+
"name": "get_em_3d_fitting_and_reconstruction_details",
|
|
23
|
+
"arguments": {"pdb_id": "6VXX"},
|
|
24
|
+
},
|
|
25
|
+
{"name": "get_assembly_summary", "arguments": {"assembly_id": "1A8M-1"}},
|
|
26
|
+
{"name": "get_assembly_info_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
27
|
+
{"name": "get_taxonomy_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
28
|
+
{"name": "get_release_deposit_dates_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
29
|
+
{"name": "get_host_organism_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
30
|
+
{"name": "get_ec_number_by_entity_id", "arguments": {"entity_id": "1T5D_1"}},
|
|
31
|
+
{"name": "get_gene_name_by_entity_id", "arguments": {"entity_id": "3W2S_1"}},
|
|
32
|
+
{
|
|
33
|
+
"name": "get_polymer_molecular_weight_by_entity_id",
|
|
34
|
+
"arguments": {"entity_id": "1A8M_1"},
|
|
35
|
+
},
|
|
36
|
+
{"name": "get_ligand_bond_count_by_pdb_id", "arguments": {"pdb_id": "1T5D"}},
|
|
37
|
+
{
|
|
38
|
+
"name": "get_crystal_growth_conditions_by_pdb_id",
|
|
39
|
+
"arguments": {"pdb_id": "1A8M"},
|
|
40
|
+
},
|
|
41
|
+
{"name": "get_polymer_entity_annotations", "arguments": {"entity_id": "1T5D_1"}},
|
|
42
|
+
{
|
|
43
|
+
"name": "get_oligosaccharide_descriptors_by_entity_id",
|
|
44
|
+
"arguments": {"entity_id": "5FMB_2"},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "get_sequence_positional_features_by_instance_id",
|
|
48
|
+
"arguments": {"instance_id": "1NDO.A"},
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "get_crystallographic_properties_by_pdb_id",
|
|
52
|
+
"arguments": {"pdb_id": "1A8M"},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "get_structure_validation_metrics_by_pdb_id",
|
|
56
|
+
"arguments": {"pdb_id": "1A8M"},
|
|
57
|
+
},
|
|
58
|
+
{"name": "get_structure_title_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
59
|
+
{"name": "get_polymer_entity_count_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
60
|
+
{"name": "get_emdb_ids_by_pdb_id", "arguments": {"pdb_id": "6VXX"}},
|
|
61
|
+
{
|
|
62
|
+
"name": "get_uniprot_accession_by_entity_id",
|
|
63
|
+
"arguments": {"entity_id": "1A8M_1"},
|
|
64
|
+
},
|
|
65
|
+
{"name": "get_crystallization_ph_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
66
|
+
{"name": "get_space_group_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
67
|
+
{"name": "get_protein_classification_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
68
|
+
{
|
|
69
|
+
"name": "get_structure_determination_software_by_pdb_id",
|
|
70
|
+
"arguments": {"pdb_id": "1A8M"},
|
|
71
|
+
},
|
|
72
|
+
{"name": "get_refinement_resolution_by_pdb_id", "arguments": {"pdb_id": "1A8M"}},
|
|
73
|
+
{"name": "get_binding_affinity_by_pdb_id", "arguments": {"pdb_id": "3W2S"}},
|
|
74
|
+
{"name": "get_ligand_smiles_by_chem_comp_id", "arguments": {"chem_comp_id": "ATP"}},
|
|
75
|
+
{"name": "get_core_refinement_statistics", "arguments": {"pdb_id": "1A8M"}},
|
|
76
|
+
{"name": "get_target_cofactor_info", "arguments": {"pdb_id": "1A8M"}},
|
|
77
|
+
{"name": "get_chem_comp_audit_info", "arguments": {"pdb_id": "1T5D"}},
|
|
78
|
+
{"name": "get_chem_comp_charge_and_ambiguity", "arguments": {"pdb_id": "1T5D"}},
|
|
79
|
+
]
|
|
80
|
+
|
|
81
|
+
# Step 3: Run test queries
|
|
82
|
+
for query in test_queries:
|
|
83
|
+
result = tooluni.run(query)
|
|
84
|
+
print(f"Query: {query}")
|
|
85
|
+
print("--" * 20)
|
|
86
|
+
print(f"Result: {result}")
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# test_reactome.py
|
|
2
|
+
|
|
3
|
+
from tooluniverse import ToolUniverse
|
|
4
|
+
|
|
5
|
+
# Step 1: Initialize ToolUniverse and load all tools (including Reactome tools)
|
|
6
|
+
tooluni = ToolUniverse()
|
|
7
|
+
tooluni.load_tools()
|
|
8
|
+
|
|
9
|
+
# Step 2: Define some IDs that are valid in Content Service
|
|
10
|
+
VALID_PATHWAY_FOR_REACTIONS = (
|
|
11
|
+
"R-HSA-73817" # This ID returns reactions, but info and participants will 404
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
# Step 3: Define test queries for Reactome tools
|
|
15
|
+
test_queries = [
|
|
16
|
+
# 3. Get all Reactions under a Pathway (using verified valid ID)
|
|
17
|
+
{
|
|
18
|
+
"name": "Reactome_get_pathway_reactions",
|
|
19
|
+
"arguments": {"stId": VALID_PATHWAY_FOR_REACTIONS},
|
|
20
|
+
},
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
# Step 4: Run all test queries
|
|
24
|
+
for idx, query in enumerate(test_queries):
|
|
25
|
+
print(
|
|
26
|
+
f"\n[{idx+1}] Running tool: {query['name']} with arguments: {query['arguments']}"
|
|
27
|
+
)
|
|
28
|
+
result = tooluni.run(query)
|
|
29
|
+
|
|
30
|
+
# If result contains "error" key, consider it as "server error", print and continue to next
|
|
31
|
+
if isinstance(result, dict) and "error" in result:
|
|
32
|
+
print("⚠️ Received error response:")
|
|
33
|
+
print(result)
|
|
34
|
+
continue
|
|
35
|
+
|
|
36
|
+
# Otherwise treat as "normal response", print example output
|
|
37
|
+
print("✅ Success. Example output snippet:")
|
|
38
|
+
if isinstance(result, list):
|
|
39
|
+
print(f"List with {len(result)} items, example first item:")
|
|
40
|
+
print(result[0])
|
|
41
|
+
elif isinstance(result, dict):
|
|
42
|
+
print("Returned dictionary, example first 3 key-value pairs:")
|
|
43
|
+
count = 0
|
|
44
|
+
for k, v in result.items():
|
|
45
|
+
print(f" {k}: {v}")
|
|
46
|
+
count += 1
|
|
47
|
+
if count >= 3:
|
|
48
|
+
break
|
|
49
|
+
else:
|
|
50
|
+
# If result is None or other type, print repr directly
|
|
51
|
+
s = repr(result)
|
|
52
|
+
print(s if len(s) <= 200 else s[:200] + "…")
|
|
53
|
+
|
|
54
|
+
print("\n🎉 Reactome testing completed!")
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from tooluniverse import ToolUniverse
|
|
2
|
+
|
|
3
|
+
# ...existing code to initialize the ToolUniverse...
|
|
4
|
+
tooluni = ToolUniverse()
|
|
5
|
+
tooluni.load_tools()
|
|
6
|
+
|
|
7
|
+
test_queries = [
|
|
8
|
+
{
|
|
9
|
+
"name": "SemanticScholar_search_papers",
|
|
10
|
+
"arguments": {
|
|
11
|
+
"query": "cancer immunotherapy",
|
|
12
|
+
"limit": 3,
|
|
13
|
+
# "api_key": "YOUR_API_KEY" # Uncomment and add your API key if available
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
for idx, query in enumerate(test_queries):
|
|
19
|
+
print(
|
|
20
|
+
f"\n[{idx+1}] Running tool: {query['name']} with arguments: {query['arguments']}"
|
|
21
|
+
)
|
|
22
|
+
result = tooluni.run(query)
|
|
23
|
+
print("✅ Success. Example output snippet:")
|
|
24
|
+
print(result if isinstance(result, dict) else str(result))
|