aiagents4pharma 1.45.1__py3-none-any.whl → 1.46.1__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.
- aiagents4pharma/talk2aiagents4pharma/configs/app/__init__.py +0 -0
- aiagents4pharma/talk2aiagents4pharma/configs/app/frontend/__init__.py +0 -0
- aiagents4pharma/talk2aiagents4pharma/configs/app/frontend/default.yaml +102 -0
- aiagents4pharma/talk2aiagents4pharma/configs/config.yaml +1 -0
- aiagents4pharma/talk2aiagents4pharma/tests/test_main_agent.py +144 -54
- aiagents4pharma/talk2biomodels/api/__init__.py +1 -1
- aiagents4pharma/talk2biomodels/configs/app/__init__.py +0 -0
- aiagents4pharma/talk2biomodels/configs/app/frontend/__init__.py +0 -0
- aiagents4pharma/talk2biomodels/configs/app/frontend/default.yaml +72 -0
- aiagents4pharma/talk2biomodels/configs/config.yaml +1 -0
- aiagents4pharma/talk2biomodels/tests/test_api.py +0 -30
- aiagents4pharma/talk2biomodels/tests/test_get_annotation.py +1 -1
- aiagents4pharma/talk2biomodels/tools/get_annotation.py +1 -10
- aiagents4pharma/talk2knowledgegraphs/configs/app/frontend/default.yaml +42 -26
- aiagents4pharma/talk2knowledgegraphs/configs/config.yaml +1 -0
- aiagents4pharma/talk2knowledgegraphs/configs/tools/multimodal_subgraph_extraction/default.yaml +4 -23
- aiagents4pharma/talk2knowledgegraphs/configs/utils/database/milvus/__init__.py +3 -0
- aiagents4pharma/talk2knowledgegraphs/configs/utils/database/milvus/default.yaml +61 -0
- aiagents4pharma/talk2knowledgegraphs/entrypoint.sh +1 -11
- aiagents4pharma/talk2knowledgegraphs/milvus_data_dump.py +11 -10
- aiagents4pharma/talk2knowledgegraphs/tests/test_agents_t2kg_agent.py +193 -73
- aiagents4pharma/talk2knowledgegraphs/tests/test_tools_milvus_multimodal_subgraph_extraction.py +1375 -667
- aiagents4pharma/talk2knowledgegraphs/tests/test_utils_database_milvus_connection_manager.py +812 -0
- aiagents4pharma/talk2knowledgegraphs/tests/test_utils_extractions_milvus_multimodal_pcst.py +723 -539
- aiagents4pharma/talk2knowledgegraphs/tools/milvus_multimodal_subgraph_extraction.py +474 -58
- aiagents4pharma/talk2knowledgegraphs/utils/database/__init__.py +5 -0
- aiagents4pharma/talk2knowledgegraphs/utils/database/milvus_connection_manager.py +586 -0
- aiagents4pharma/talk2knowledgegraphs/utils/extractions/milvus_multimodal_pcst.py +240 -8
- aiagents4pharma/talk2scholars/configs/app/frontend/default.yaml +67 -31
- {aiagents4pharma-1.45.1.dist-info → aiagents4pharma-1.46.1.dist-info}/METADATA +10 -1
- {aiagents4pharma-1.45.1.dist-info → aiagents4pharma-1.46.1.dist-info}/RECORD +33 -23
- aiagents4pharma/talk2biomodels/api/kegg.py +0 -87
- {aiagents4pharma-1.45.1.dist-info → aiagents4pharma-1.46.1.dist-info}/WHEEL +0 -0
- {aiagents4pharma-1.45.1.dist-info → aiagents4pharma-1.46.1.dist-info}/licenses/LICENSE +0 -0
@@ -1,87 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
This module contains the API for fetching Kegg database
|
3
|
-
"""
|
4
|
-
|
5
|
-
import re
|
6
|
-
|
7
|
-
import requests
|
8
|
-
|
9
|
-
|
10
|
-
def fetch_from_api(base_url: str, query: str) -> str:
|
11
|
-
"""Fetch data from the given API endpoint."""
|
12
|
-
try:
|
13
|
-
response = requests.get(base_url + query, timeout=10)
|
14
|
-
response.raise_for_status()
|
15
|
-
return response.text
|
16
|
-
except requests.exceptions.RequestException as e:
|
17
|
-
print(f"Error fetching data for query {query}: {e}")
|
18
|
-
return ""
|
19
|
-
|
20
|
-
|
21
|
-
def fetch_kegg_names(ids: list[str], batch_size: int = 10) -> dict[str, str]:
|
22
|
-
"""
|
23
|
-
Fetch the names of multiple KEGG entries using the KEGG REST API in batches.
|
24
|
-
|
25
|
-
Args:
|
26
|
-
ids (List[str]): List of KEGG IDs.
|
27
|
-
batch_size (int): Maximum number of IDs to include in a single request.
|
28
|
-
|
29
|
-
Returns:
|
30
|
-
Dict[str, str]: A mapping of KEGG IDs to their names.
|
31
|
-
"""
|
32
|
-
if not ids:
|
33
|
-
return {}
|
34
|
-
|
35
|
-
base_url = "https://rest.kegg.jp/get/"
|
36
|
-
entry_name_map = {}
|
37
|
-
|
38
|
-
# Process IDs in batches
|
39
|
-
for i in range(0, len(ids), batch_size):
|
40
|
-
batch = ids[i : i + batch_size]
|
41
|
-
query = "+".join(batch)
|
42
|
-
entry_data = fetch_from_api(base_url, query)
|
43
|
-
|
44
|
-
# if not entry_data:
|
45
|
-
# continue
|
46
|
-
entries = entry_data.split("///")
|
47
|
-
for entry in entries:
|
48
|
-
if not entry.strip():
|
49
|
-
continue
|
50
|
-
lines = entry.strip().split("\n")
|
51
|
-
entry_line = next((line for line in lines if line.startswith("ENTRY")), None)
|
52
|
-
name_line = next((line for line in lines if line.startswith("NAME")), None)
|
53
|
-
|
54
|
-
# if not entry_line and not name_line:
|
55
|
-
# continue
|
56
|
-
entry_id = entry_line.split()[1]
|
57
|
-
# Split multiple names in the NAME field and clean them
|
58
|
-
names = [
|
59
|
-
re.sub(r"[^a-zA-Z0-9\s]", "", name).strip()
|
60
|
-
for name in name_line.replace("NAME", "").strip().split(";")
|
61
|
-
]
|
62
|
-
# Join cleaned names into a single string
|
63
|
-
entry_name_map[entry_id] = " ".join(names).strip()
|
64
|
-
|
65
|
-
return entry_name_map
|
66
|
-
|
67
|
-
|
68
|
-
def fetch_kegg_annotations(
|
69
|
-
data: list[dict[str, str]], batch_size: int = 10
|
70
|
-
) -> dict[str, dict[str, str]]:
|
71
|
-
"""Fetch KEGG entry descriptions grouped by database type."""
|
72
|
-
grouped_data = {}
|
73
|
-
for entry in data:
|
74
|
-
db_type = entry["Database"].lower()
|
75
|
-
grouped_data.setdefault(db_type, []).append(entry["Id"])
|
76
|
-
|
77
|
-
results = {}
|
78
|
-
for db_type, ids in grouped_data.items():
|
79
|
-
results[db_type] = fetch_kegg_names(ids, batch_size=batch_size)
|
80
|
-
|
81
|
-
return results
|
82
|
-
|
83
|
-
|
84
|
-
# def get_protein_name_or_label(data: List[Dict[str, str]],
|
85
|
-
# batch_size: int = 10) -> Dict[str, Dict[str, str]]:
|
86
|
-
# """Fetch descriptions for KEGG-related identifiers."""
|
87
|
-
# return fetch_kegg_annotations(data, batch_size=batch_size)
|
File without changes
|
File without changes
|