Download mcp/mygene.py from mgbam/MCP_Res: direct link, hf CLI and curl.
- Browser
- Download file 572 Bytes
-
https://huggingface.co/spaces/mgbam/MCP_Res/resolve/ac3658e48d66e4e649fd8b725066df24b3ddd881/mcp/mygene.py
- Command line
-
hf download hf://spaces/mgbam/MCP_Res@ac3658e48d66e4e649fd8b725066df24b3ddd881/mcp/mygene.py
-
curl -L -o mygene.py https://huggingface.co/spaces/mgbam/MCP_Res/resolve/ac3658e48d66e4e649fd8b725066df24b3ddd881/mcp/mygene.py
572 Bytes
| import os, httpx | |
| from functools import lru_cache | |
| _KEY = os.getenv("MYGENE_KEY") | |
| _URL = "https://mygene.info/v3/query" | |
| async def fetch_gene_info(sym: str) -> dict: | |
| if not sym: | |
| return {} | |
| params = { | |
| "q" : sym, | |
| "fields": "symbol,name,summary,alias,entrezgene,location", | |
| "size" : 1, | |
| } | |
| if _KEY: | |
| params["api_key"] = _KEY | |
| async with httpx.AsyncClient(timeout=8) as c: | |
| r = await c.get(_URL, params=params) | |
| r.raise_for_status() | |
| return r.json().get("hits", [{}])[0] | |