agent medical skill risk: medium
PrimeKG Knowledge Graph Query Skill
The prompt provides instructions and code examples for using PrimeKG functions such as search_nodes, get_neighbors, and get_disease_context to retrieve nodes, neighbors, and diseas…
- Policy sensitive
- Human review
SKILL 2 files · 1 folder
SKILL.md
---
name: primekg
description: "Query the Precision Medicine Knowledge Graph (PrimeKG) for multiscale biological data including genes, drugs, diseases, phenotypes, and more."
---
# PrimeKG Knowledge Graph Skill
## Overview
PrimeKG is a precision medicine knowledge graph that integrates over 20 primary databases and high-quality scientific literature into a single resource. It contains over 100,000 nodes and 4 million edges across 29 relationship types, including drug-target, disease-gene, and phenotype-disease associations.
**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:** Programmatic access via `query_primekg.py`. Data is stored at `C:\Users\eamon\Documents\Data\PrimeKG\kg.csv`.
## 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.
```python
from scripts.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.
```python
from scripts.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.
```python
from scripts.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']
```
## 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:** Combine with `OpenTargets` for deeper genetic evidence or `Semantic Scholar` for the latest literature context.
## Resources
### Scripts
- `scripts/query_primekg.py`: Core functions for searching and querying the knowledge graph.
### Data Path
- Data: `/mnt/c/Users/eamon/Documents/Data/PrimeKG/kg.csv`
- Total nodes: ~129,000
- Total edges: ~4,000,000
- Database: CSV-based, optimized for pandas querying.
REQUIRED CONTEXT
- node names or IDs
- relation types
OPTIONAL CONTEXT
- node_type filter
- relation_type filter
ROLES & RULES
- Use specific IDs when using get_neighbors.
- Use get_disease_context for a broad overview before diving into specific genes or drugs.
- Filter relationships using the relation_type filter in get_neighbors.
- Combine with OpenTargets for deeper genetic evidence or Semantic Scholar for latest literature context.
EXPECTED OUTPUT
- Format
- markdown
- Constraints
- include code examples
- list relationship types
- specify data paths and function signatures
EXAMPLES
Includes three Python code examples for search_nodes, get_neighbors, and get_disease_context.
CAVEATS
- Dependencies
- Requires scripts/query_primekg.py
- Requires PrimeKG data file at specified path
QUALITY
- OVERALL
- 0.81
- CLARITY
- 0.90
- SPECIFICITY
- 0.85
- REUSABILITY
- 0.70
- COMPLETENESS
- 0.80
IMPROVEMENT SUGGESTIONS
- Make the two data paths consistent (C: vs /mnt/c)
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR AGENT
- PyHealth Clinical Pipeline Builderagentmedical
- DepMap Cancer Dependency Data Analyzeragentmedical
- FDA MedTech Compliance Auditoragentmedical
- FDA MedTech Compliance Auditoragentmedical
- FDA MedTech Compliance Auditoragentmedical
- Pydicom DICOM Medical Imaging Guideagentmedical
- PathML Computational Pathology Toolkitagentmedical
- Nurse Skill Description Generatoragentmedical
- Health Assistant Medical Guidance Skillagentmedical
- Claude Ally Health Assistantagentmedical
- Health Medical Analysis Assistant Skillagentmedical
- Comprehensive Codebase Bug Analysis and Fixeragentanalysis
- Xcode MCP Usage Guidelines for Agentsagenttool_use
- Xcode MCP Usage Guidelinesagenttool_use
- Rapid App MVP Prototyperagentcoding
- Local Documentation Online Sync Automatoragentoperations
- HashiCorp Packer Golden Image Expertagentoperations
- Xquik X/Twitter API Integration Skillagenttool_use
- MoltPass Client for AI Agent Identitiesagentsecurity
- AI-First Design Handoff Specs Generatoragentcoding
- Consciousness Council Multi-Perspective Deliberationagentplanning
- Creative Thinking Frameworks for CS Researchagentresearch
- Filesystem Agent Context Engineeringagenttool_use
- Academic Paper Figure Generatoragentresearch
- Multi-Agent Architecture Patterns Guideagentplanning