Create atlas.py
Browse files- mcp/atlas.py +10 -0
mcp/atlas.py
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import httpx
|
| 2 |
+
from functools import lru_cache
|
| 3 |
+
|
| 4 |
+
_URL = "https://www.ebi.ac.uk/gxa/json/expressionSummary?geneQuery={}"
|
| 5 |
+
|
| 6 |
+
@lru_cache(maxsize=512)
|
| 7 |
+
async def fetch_expression(sym: str):
|
| 8 |
+
async with httpx.AsyncClient(timeout=10) as c:
|
| 9 |
+
r = await c.get(_URL.format(sym))
|
| 10 |
+
return r.json() if r.status_code == 200 else {}
|