An agentic AI system for computing component scores for drug-disease pairs to evaluate repurposing suitability across multiple dimensions.
This system uses large language models (LLMs) to score drug-disease pairs on various dimensions relevant to drug repurposing, including:
- Biological Plausibility: Evaluates biological mechanisms and pathways
- Economic Feasibility: Assesses affordability and commercial viability
- Clinical Risk Profile: Evaluates safety and adverse event profiles
- Regulatory Challenge: Assesses regulatory approval pathway difficulty
- Unmet Medical Need: Evaluates disease burden and treatment gaps
Scores are computed for drug-disease pairs specified by:
- Drug: National Drug Code (NDC)
- Disease: MONDO ontology identifier
- Clone the repository:
git clone <repository-url>
cd repurposing-prioritization- Install dependencies:
pip install -r requirements.txt- Configure environment variables:
cp .env.example .env
# Edit .env with your API keys and preferencesThe system supports three LLM providers:
DEFAULT_LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=your_api_key_here
DEFAULT_MODEL=claude-3-5-sonnet-20241022DEFAULT_LLM_PROVIDER=openai
OPENAI_API_KEY=your_api_key_here
DEFAULT_MODEL=gpt-4-turbo-previewDEFAULT_LLM_PROVIDER=ollama
DEFAULT_MODEL=llama3.2
OLLAMA_BASE_URL=http://localhost:11434To use Ollama:
- Install Ollama from https://ollama.ai
- Pull a model:
ollama pull llama3.2 - Ensure Ollama is running:
ollama serve
repurposing-score score --ndc 0378-6159-93 --mondo MONDO:0005148With optional drug and disease names:
repurposing-score score \
--ndc 0378-6159-93 \
--drug-name "Metformin" \
--mondo MONDO:0005148 \
--disease-name "Type 2 Diabetes"Specify which scorers to run:
repurposing-score score \
--ndc 0378-6159-93 \
--mondo MONDO:0005148 \
--scorers "Biological Plausibility,Clinical Risk Profile"Output to file:
repurposing-score score \
--ndc 0378-6159-93 \
--mondo MONDO:0005148 \
--output results.jsonCreate a JSON file with multiple pairs:
[
{
"ndc_code": "0378-6159-93",
"mondo_id": "MONDO:0005148",
"drug_name": "Metformin",
"disease_name": "Type 2 Diabetes"
},
{
"ndc_code": "0002-3227-30",
"mondo_id": "MONDO:0007254"
}
]Run batch scoring:
repurposing-score batch pairs.json --output results.jsonrepurposing-score list-scorersfrom repurposing_prioritization.core import DrugDiseasePair
from repurposing_prioritization.main import ScoringPipeline
# Create a drug-disease pair
pair = DrugDiseasePair(
ndc_code="0378-6159-93",
mondo_id="MONDO:0005148",
drug_name="Metformin",
disease_name="Type 2 Diabetes"
)
# Run scoring
pipeline = ScoringPipeline()
results = pipeline.score_pair(pair)
# Process results
for response in results:
if response.is_success:
print(f"{response.scorer_name}: {response.result.score}/10")
print(f"Reasoning: {response.result.reasoning}")
else:
print(f"{response.scorer_name} failed: {response.error}")- Create a new scorer class in
repurposing_prioritization/scorers/:
from typing import ClassVar
from repurposing_prioritization.core import BaseScorer, DrugDiseasePair, ScoreResult
from repurposing_prioritization.agents import LLMAgent
class MyCustomScorer(BaseScorer):
name: ClassVar[str] = "My Custom Scorer"
description: ClassVar[str] = "Description of what this scorer evaluates"
version: ClassVar[str] = "1.0.0"
def __init__(self, agent: LLMAgent | None = None):
self.agent = agent or LLMAgent()
def compute_score(self, pair: DrugDiseasePair) -> ScoreResult:
# Your scoring logic here
prompt = f"Analyze {pair.ndc_code} for {pair.mondo_id}..."
# Use the agent for AI-powered analysis
response = self.agent.query(prompt)
return ScoreResult(
score=8.5,
confidence=0.9,
reasoning="...",
metadata={}
)- Register the scorer in
repurposing_prioritization/config/scorer_registry.py:
from repurposing_prioritization.scorers.my_custom_scorer import MyCustomScorer
register_scorer(MyCustomScorer)- Core Framework: Base classes and data models (
core/) - Scorers: Modular scoring implementations (
scorers/) - Agents: AI agent abstractions for LLM interaction (
agents/) - Config: Scorer registration and configuration (
config/) - CLI: Command-line interface (
cli.py) - Main: Pipeline orchestration (
main.py)
pytestblack .
ruff check .mypy repurposing_prioritization[Add your license here]
[Add contribution guidelines here]