Gene List Prioritization
Score thousands of candidate genes against the literature in minutes.
When to use
You have a ranked list of candidate genes — from a screen, GWAS, DEG analysis, or co-expression module — and need to know which ones have existing literature support for a specific biological role.
Example: scoring differentiation drivers
The following pipeline scored ~1,500 candidate genes per pancreatic cell type for their potential as overexpression targets in directed differentiation. Genes come from an in-silico CRISPR KO screen; KO correlation measures how much each gene's loss disrupts the cell type's transcriptional identity.
Each gene receives a Differentiation Perturbation Score (DPS) from 1–10:
| Score | Meaning |
|---|---|
| 9-10 | Direct published evidence of overexpression driving differentiation |
| 7-8 | Required for identity (KO causes loss/transdifferentiation), known co-regulator |
| 5-6 | Cell-type-specific expression, functional pathway association |
| 3-4 | General tissue expression, indirect association |
| 1-2 | No relevant evidence found |
Prompt template
PROMPT = """You are a biomedical research agent scoring candidate genes as overexpression
targets for driving iPSC differentiation toward human pancreatic **beta cell** identity.
**Genes to analyze (10):** {item}
For each gene, search GLKB and PubMed for:
1. Direct role in beta cell differentiation, specification, or identity
2. Membership in the core beta TF network: PDX1, NKX6.1, NKX2.2, NEUROD1, NGN3, MAFA
3. Gene-disease associations: T1D, T2D, MODY, congenital hyperinsulinism
4. Role in insulin secretion or beta cell maturation
5. Expression specificity in human islet beta cells
Benchmark: PDX1=10, NKX6.1=9
**Output format - one block per gene:**
### [GENE_SYMBOL] - DPS: [X]/10
- **Evidence:** [1-2 sentences of strongest finding]
- **PMIDs:** [up to 3 PMIDs, or "none found"]
- **Rationale:** [what drove the score up or down]"""
10 genes are packed per {item} to amortize the GLKB + PubMed overhead across a mini-batch.
Code
import csv, json, re, requests
BASE_URL = "https://api.glkb.dev" # <!-- DEV: replace with production base URL -->
def pack_batches(genes, batch_size=10):
return [", ".join(genes[i:i + batch_size])
for i in range(0, len(genes), batch_size)]
def parse_dps_response(text, gene_to_corr):
records = []
for block in re.split(r"\n(?=###\s)", text.strip()):
m = re.match(r"###\s+(\S+)\s+[—\-]+\s+DPS:\s*(\d+(?:\.\d+)?)/10", block)
if not m:
continue
gene, score = m.group(1), float(m.group(2))
ev = re.search(r"\*\*Evidence:\*\*\s*(.+?)(?=\n-|\Z)", block, re.S)
pm = re.search(r"\*\*PMIDs:\*\*\s*(.+?)(?=\n-|\Z)", block, re.S)
ra = re.search(r"\*\*Rationale:\*\*\s*(.+?)(?=\n-|\Z)", block, re.S)
records.append({
"gene": gene,
"dps_score": score,
"ko_correlation": gene_to_corr.get(gene, ""),
"evidence": ev.group(1).strip() if ev else "",
"pmids": pm.group(1).strip() if pm else "",
"rationale": ra.group(1).strip() if ra else "",
})
return records
genes = ["PDX1", "NKX6-1", "RYR2", ...] # up to 1,500 genes
gene_to_corr = {} # optional: map gene -> KO correlation score
batches = pack_batches(genes)
with open("scores.csv", "w", newline="") as f:
writer = csv.DictWriter(
f, fieldnames=["gene", "dps_score", "ko_correlation",
"evidence", "pmids", "rationale"]
)
writer.writeheader()
with requests.post(
f"{BASE_URL}/apps/glkb/users/me/batch", # <!-- DEV: confirm URL -->
headers={
"Authorization": f"Bearer {os.environ['GLKB_API_KEY']}",
"Content-Type": "application/json",
},
json={"items": batches, "prompt_template": PROMPT, "concurrency": 5},
stream=True,
timeout=7200,
) as r:
r.raise_for_status()
for line in r.iter_lines():
if line and line.startswith(b"data:"):
event = json.loads(line[5:])
if event.get("status") == "done":
writer.writerows(
parse_dps_response(event["response"], gene_to_corr)
)
f.flush()
Sample output
gene, dps_score, ko_correlation, evidence, pmids, rationale
PDX1, 10.0, 0.521, Overexpression drives beta cell differentiation, 34567890, Benchmark anchor.
RYR2, 6.0, 0.614, RyR2 loss impairs GSIS in an insulinoma model, 28765432, Ca2+ handling in beta cells.
RSPH1, 1.0, 0.831, Cilia structural biology - no pancreatic evidence, none found, No islet linkage.
At concurrency=5, 1,500 genes complete in approximately 30 minutes. The output CSV feeds directly into downstream ranking, GSEA, or differential filtering.

