Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,17 +8,39 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
-
Tool Name: diseaseGeneExtractor, Description: Retrieve disease genes., Arguments: a: str, b: str, Outputs: str
|
| 12 |
|
| 13 |
@tool
|
| 14 |
-
def
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -57,7 +79,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 57 |
|
| 58 |
agent = CodeAgent(
|
| 59 |
model=model,
|
| 60 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 61 |
max_steps=6,
|
| 62 |
verbosity_level=1,
|
| 63 |
grammar=None,
|
|
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 11 |
|
| 12 |
@tool
|
| 13 |
+
def resolve_gene(query: str) -> dict:
|
| 14 |
+
"""Return HGNC symbol, Ensembl ID, canonical coords (GRCh37/38), synonyms."""
|
| 15 |
+
|
| 16 |
+
@tool
|
| 17 |
+
def resolve_variant(query: str, assembly: str) -> dict:
|
| 18 |
+
"""Return rsID, position, liftover if needed, nearest genes."""
|
| 19 |
+
|
| 20 |
+
@tool
|
| 21 |
+
def query_gwas_associations(
|
| 22 |
+
gene_id: str | None = None, rsid: str | None = None,
|
| 23 |
+
region: tuple | None = None, trait_efo: str | None = None,
|
| 24 |
+
pval_max: float = 5e-8
|
| 25 |
+
) -> list[dict]:
|
| 26 |
+
"""GWAS Catalog hits with study metadata."""
|
| 27 |
+
|
| 28 |
+
@tool
|
| 29 |
+
def query_finemap_and_ld(rsid: str, ancestry: str) -> dict:
|
| 30 |
+
"""Credible set, PP, LD partners via OTG + LDlink."""
|
| 31 |
+
|
| 32 |
+
@tool
|
| 33 |
+
def annotate_variant(rsid: str) -> dict:
|
| 34 |
+
"""VEP consequence, gnomAD AF."""
|
| 35 |
+
|
| 36 |
+
@tool
|
| 37 |
+
def enrich_traits_with_efo(trait_labels: list[str]) -> list[dict]:
|
| 38 |
+
"""Map to EFO terms and parents for grouping."""
|
| 39 |
+
|
| 40 |
+
@tool
|
| 41 |
+
def collate_and_rank(records: list[dict]) -> dict:
|
| 42 |
+
"""Merge, score, aggregate, and return final payload with provenance."""
|
| 43 |
+
|
| 44 |
|
| 45 |
@tool
|
| 46 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 79 |
|
| 80 |
agent = CodeAgent(
|
| 81 |
model=model,
|
| 82 |
+
tools=[resolve_gene, resolve_variant, query_gwas_associations, query_finemap_and_ld, , annotate_variant, enrich_traits_with_efo, collate_and_rank, final_answer], ## add your tools here (don't remove final answer)
|
| 83 |
max_steps=6,
|
| 84 |
verbosity_level=1,
|
| 85 |
grammar=None,
|