AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Primekg

skill-k-dense-ai-drug-discovery-agent-skills-primekg · by K-Dense-AI

Query the Precision Medicine Knowledge Graph (PrimeKG) for multiscale biological relationships across genes and proteins, drugs, diseases, phenotypes, pathways, biological processes, exposures and anatomy. Use this skill to search entities by name, pull direct neighbours and their evidence types, summarise the local network around a disease, and find direct or two-hop drug-disease connections for…

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add skill-k-dense-ai-drug-discovery-agent-skills-primekg

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-k-dense-ai-drug-discovery-agent-skills-primekg)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
1mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Primekg? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

PrimeKG Knowledge Graph Skill

Overview

PrimeKG is a precision medicine knowledge graph that integrates 20 high-quality primary resources into a single edge list. It describes 17,080 diseases with 4,050,249 relationships across ten major biological scales — drug-target, disease-gene, phenotype-disease, pathway and anatomical associations among them — over roughly 129,000 nodes.

Its distinguishing feature is drug-disease coverage: PrimeKG carries indication, contraindication, and off-label use edges that most disease knowledge graphs lack, which is what makes repurposing questions answerable here rather than merely askable.

Cite: Chandak P, Huang K, Zitnik M. Building a knowledge graph to enable precision medicine. Sci Data 10, 67 (2023). PMID 36732524.

Key capabilities:

  • Search for nodes (genes, proteins, drugs, diseases, phenotypes)
  • Retrieve direct neighbors (associated entities and clinical evidence)
  • Analyze local disease context (related genes, drugs, phenotypes)
  • Identify drug-disease paths (potential repurposing opportunities)

Data access: scripts/query_primekg.py reads kg.csv from the path in the PRIMEKG_DATA environment variable (default data/PrimeKG/kg.csv). Download the CSV first — see [Data Path](#data-path). The script works as a CLI or as an importable module:

python skills/primekg/scripts/query_primekg.py search Alzheimer --node-type disease
python skills/primekg/scripts/query_primekg.py neighbors EFO_0000249 --relation disease_protein
python skills/primekg/scripts/query_primekg.py context "Alzheimer's disease"
python skills/primekg/scripts/query_primekg.py paths CHEMBL1 D001 --max-depth 2

Add --format json for machine-readable output, or --data /path/to/kg.csv to override PRIMEKG_DATA for one run. Every subcommand exits non-zero when the data file is missing.

When to Use This Skill

This skill should be used when:

  • Knowledge-based drug discovery: Identifying targets and mechanisms for diseases.
  • Drug repurposing: Finding existing drugs that might have evidence for new indications.
  • Phenotype analysis: Understanding how symptoms/phenotypes relate to diseases and genes.
  • Multiscale biology: Bridging the gap between molecular targets (genes) and clinical outcomes (diseases).
  • Network pharmacology: Investigating the broader network effects of drug-target interactions.

Core Workflow

1. Search for Entities

Find identifiers for genes, drugs, or diseases.

import sys
sys.path.insert(0, "skills/primekg/scripts")   # scripts/ is not a package
from query_primekg import search_nodes

# Search for Alzheimer's disease nodes
results = search_nodes("Alzheimer", node_type="disease")
# Returns: [{"id": "EFO_0000249", "type": "disease", "name": "Alzheimer's disease", ...}]

2. Get Neighbors (Direct Associations)

Retrieve all connected nodes and relationship types.

from query_primekg import get_neighbors

# Get all neighbors of a specific disease ID
neighbors = get_neighbors("EFO_0000249")
# Returns: List of neighbors like {"neighbor_name": "APOE", "relation": "disease_gene", ...}

3. Analyze Disease Context

A high-level function to summarize associations for a disease.

from query_primekg import get_disease_context

# Comprehensive summary for a disease
context = get_disease_context("Alzheimer's disease")
# Access: context['associated_genes'], context['associated_drugs'], context['phenotypes']

4. Connect Two Entities (Repurposing Hypotheses)

Find how a drug and a disease are linked, either directly or through one shared intermediate node. Edges are traversed as undirected.

from query_primekg import find_paths

# Direct edges first, then two-hop paths through a shared neighbour
paths = find_paths("CHEMBL1", "D001")            # max_depth=2 by default
paths = find_paths("CHEMBL1", "D001", max_depth=1)  # direct edges only

# Each path is a list of edge dicts, ordered start -> end:
# [{'relation': 'drug_protein', ...}, {'relation': 'disease_protein', ...}]
for hops in paths:
    print(" -> ".join(hop["display_relation"] for hop in hops))

Only depths 1 and 2 are supported; any other max_depth raises ValueError. Three or more hops through a 4-million-edge graph run through hub nodes and are rarely interpretable.

Relationship Types in PrimeKG

The graph contains several key relationship types including:

  • protein_protein: Physical PPIs
  • drug_protein: Drug target/mechanism associations
  • disease_gene: Genetic associations
  • drug_disease: Indications and contraindications
  • disease_phenotype: Clinical signs and symptoms
  • gwas: Genome-wide association studies evidence

Best Practices

  1. Use specific IDs: When using get_neighbors, ensure you have the correct ID from search_nodes.
  2. Context first: Use get_disease_context for a broad overview before diving into specific genes or drugs.
  3. Filter relationships: Use the relation_type filter in get_neighbors to focus on specific evidence (e.g., only drug_protein).
  4. Multiscale integration: see Composing below — PrimeKG asserts that a relationship exists,

not how strong the evidence is. Pair it with a scored source before acting.

Composing with the rest of the bundle

  • open-targets → alongside: PrimeKG tells you an edge exists; Open Targets scores how strong

the evidence is and names the datatype behind it. A PrimeKG disease_protein edge and an Open Targets association driven only by literature are the same claim at different resolutions.

  • ncats-arax → instead, when provenance matters: ARAX returns Biolink-typed relationships with

source attribution per edge. PrimeKG gives you the graph but not the citation for each edge.

  • target-safety → after: a disease_protein edge says nothing about whether inhibiting the

protein is tolerated. gnomAD constraint does.

  • depmap → after: whether the gene is actually required in cells, not merely associated.
  • chembl → after: what has been made against a protein this graph implicates.
  • clinicaltrials → after: PrimeKG's indication and off-label edges are a hypothesis generator;

the registry says whether anyone has tested it.

Two-hop paths are hypotheses, not evidence. Traversal through a hub node connects almost anything to almost anything — read the intermediate node before believing the path.

Resources

Scripts

  • scripts/query_primekg.py: search, neighbours, disease context and path finding, usable as a

CLI or as an importable module.

Data Path

  • Data: kg.csv, downloaded from the PrimeKG Harvard Dataverse.
  • Point the scripts at it with export PRIMEKG_DATA=/path/to/kg.csv (default: data/PrimeKG/kg.csv).
  • Total nodes: ~129,000
  • Total edges: ~4,000,000
  • Database: CSV-based, optimized for pandas querying.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.