Skip to content

RomanoLab/repurposing-prioritization

Repository files navigation

Drug Repurposing Prioritization System

An agentic AI system for computing component scores for drug-disease pairs to evaluate repurposing suitability across multiple dimensions.

Overview

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

Installation

  1. Clone the repository:
git clone <repository-url>
cd repurposing-prioritization
  1. Install dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env
# Edit .env with your API keys and preferences

Configuration

LLM Providers

The system supports three LLM providers:

1. Anthropic (Cloud)

DEFAULT_LLM_PROVIDER=anthropic
ANTHROPIC_API_KEY=your_api_key_here
DEFAULT_MODEL=claude-3-5-sonnet-20241022

2. OpenAI (Cloud)

DEFAULT_LLM_PROVIDER=openai
OPENAI_API_KEY=your_api_key_here
DEFAULT_MODEL=gpt-4-turbo-preview

3. Ollama (Local)

DEFAULT_LLM_PROVIDER=ollama
DEFAULT_MODEL=llama3.2
OLLAMA_BASE_URL=http://localhost:11434

To use Ollama:

  1. Install Ollama from https://ollama.ai
  2. Pull a model: ollama pull llama3.2
  3. Ensure Ollama is running: ollama serve

Usage

Command Line Interface

Score a Single Drug-Disease Pair

repurposing-score score --ndc 0378-6159-93 --mondo MONDO:0005148

With 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.json

Batch Processing

Create 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.json

List Available Scorers

repurposing-score list-scorers

Python API

from 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}")

Extending the System

Adding New Scorers

  1. 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={}
        )
  1. Register the scorer in repurposing_prioritization/config/scorer_registry.py:
from repurposing_prioritization.scorers.my_custom_scorer import MyCustomScorer

register_scorer(MyCustomScorer)

Architecture

  • 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)

Development

Running Tests

pytest

Code Formatting

black .
ruff check .

Type Checking

mypy repurposing_prioritization

License

[Add your license here]

Contributing

[Add contribution guidelines here]

About

An AI-driven framework for computing drug repurposing prioritization scores

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages