
PrimeKG Knowledge Graph
FreeAccess a vast resource of biological data for precision medicine.
Free · Opens the source repo
What PrimeKG Knowledge Graph does
PrimeKG is a comprehensive precision medicine knowledge graph that consolidates data from over 20 primary databases and high-quality scientific literature. With more than 100,000 nodes and 4 million edges, it encompasses a wide range of biological data, including genes, drugs, diseases, and phenotypes. This skill provides developers and researchers with the ability to query this extensive dataset programmatically, enabling them to extract valuable insights for various applications in drug discovery and disease analysis.
The core functionality of PrimeKG includes searching for specific biological entities, retrieving direct associations among them, and analyzing the context of diseases. Users can easily find nodes related to genes, proteins, drugs, and diseases, and explore their interconnections. For instance, the ability to identify drug-disease paths opens up opportunities for discovering potential drug repurposing avenues, while analyzing local disease contexts helps in understanding the relationships between clinical symptoms and genetic factors.
This skill is particularly useful in fields such as knowledge-based drug discovery and network pharmacology, where understanding the complex interactions between drugs and biological systems is crucial. By leveraging the data within PrimeKG, users can bridge the gap between molecular targets and clinical outcomes, making it an invaluable tool for researchers and developers focused on precision medicine and multiscale biology.
To utilize this skill, users can access the query_primekg.py script, which provides functions for searching nodes, retrieving neighbors, and analyzing disease contexts. The data is stored in a CSV format, optimized for use with pandas, ensuring that users can efficiently query and manipulate the information they need.
When to use it
Use this skill when you need to explore relationships among genes, drugs, and diseases, particularly in the context of precision medicine.
When not to use it
This skill may not be suitable for general-purpose data analysis outside the scope of biological and medical research.
What you can build with it
Drug Discovery Research
Utilize PrimeKG to identify potential drug targets and mechanisms for various diseases, enhancing the drug discovery process.
Phenotype-Disease Analysis
Leverage the knowledge graph to understand how specific phenotypes relate to diseases and genetic factors, aiding in clinical research.
Drug Repurposing Opportunities
Explore existing drugs that may have new indications by analyzing drug-disease paths within the PrimeKG framework.
How to install PrimeKG Knowledge Graph
View source1. Install with the skills CLI
npx skills add k-dense-ai/scientific-agent-skills/primekg --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by k-dense-aiPrimeKG 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.
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.
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.
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 PPIsdrug_protein: Drug target/mechanism associationsdisease_gene: Genetic associationsdrug_disease: Indications and contraindicationsdisease_phenotype: Clinical signs and symptomsgwas: Genome-wide association studies evidence
Best Practices
- Use specific IDs: When using
get_neighbors, ensure you have the correct ID fromsearch_nodes. - Context first: Use
get_disease_contextfor a broad overview before diving into specific genes or drugs. - Filter relationships: Use the
relation_typefilter inget_neighborsto focus on specific evidence (e.g., onlydrug_protein). - Multiscale integration: Combine with
OpenTargetsfor deeper genetic evidence orSemantic Scholarfor the latest literature context.
Resources
Scripts
scripts/query_primekg.py: Core functions for searching and querying the knowledge graph.
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.
Frequently asked questions about PrimeKG Knowledge Graph
Similar skills
Scientific Problem Selection
Streamline your research problem selection process.
Nextflow Development
Run nf-core bioinformatics pipelines with ease.
Nature Reviewer Assessment
Simulate peer review for scientific manuscripts.
Research Writing Pipeline
Streamline your scientific writing with structured proposal-first methodologies.
Nature Literature Downloader
Efficiently download academic literature from various sources.
Auto Research
Streamline your NeMo-RL experiments with automated workflows.
