# 04_QUEST_OPEN_TARGETS

Congratulations on reaching the final, open-ended quest! In the previous steps, we reproduced the core analysis from the SCimilarity paper and extended it to new datasets. Now, we're transitioning from pure data analysis to **Competitive Intelligence and Translational Strategy**.

In this quest, you will investigate the clinical viability of the biological markers identified in your earlier analysis. You will utilize advanced LLM concepts, such as Model Context Protocols (MCPs) or external APIs (like Open Targets or ClinicalTrials.gov), to generate a comprehensive clinical landscape report.

---

## 1. Background and Goals

**Objective:** Extract actionable competitive intelligence for key targets identified via SCimilarity (e.g., Fibrosis-Associated Macrophage markers) by querying external databases and structuring the results into a visual report.

**Deliverables:**
1. A Python script `src/generate_intelligence_report.py` that queries the Open Targets GraphQL API, performs data aggregation, and generates an interactive HTML dashboard.
2. A standalone interactive HTML dashboard `web/intelligence_report.html` featuring Plotly visualizations of the clinical landscape, target-disease associations, and drug development phases.

## 2. Tech Stack and Project Structure

**Tooling Approach:**
- **Direct API querying:** Using the `requests` library in Python to interact with the Open Targets GraphQL API.
- **Data Wrangling:** `pandas` for processing raw JSON responses and aggregating trial/drug data.
- **Visualization:** `plotly` for generating interactive charts embedded in the HTML report.

## 3. Inputs & Target Selection

**Targets Chosen:**
- **SPP1 (Osteopontin):** Highlighted in the SCimilarity paper as a key marker for pro-fibrotic macrophages across multiple organs (lung, kidney, heart).
- **MARCO:** A scavenger receptor often co-expressed in specific macrophage subpopulations and associated with environmental response and fibrosis.
- **CD163:** A well-known marker for M2-like macrophages, frequently used to identify tumor-associated or fibrosis-associated macrophage lineages.

**Research Questions:**
- What are the top indications (diseases) currently being targeted by drugs for SPP1, MARCO, and CD163?
- What is the distribution of clinical trial phases (Phase 1–4) for these targets?
- Are there any approved drugs for these specific targets in a fibrotic context?

## 4. Outputs

The resulting HTML dashboard will include:
*   **Clinical Landscape Overview:** A summary table showing known drugs, their mechanisms of action, and their highest clinical phase for each target.
*   **Indication Analysis:** A bar chart showing the most frequent disease areas associated with these targets.
*   **Development Phase Distribution:** A stacked bar plot showing the counts of clinical trials or drugs by phase (Phase 1, 2, 3, 4/Approved).
*   **Target Comparison:** A comparative visualization showing which of the three targets is "most crowded" in the clinical pipeline.

## 5. Implementation Strategy

### Connecting to APIs / MCPs
I will use the Open Targets GraphQL endpoint (`https://api.platform.opentargets.org/api/v4/graphql`) with targeted queries for `target` (by symbol) and its `knownDrugs` field to retrieve drug names, phases, and indications.

### Data Processing
I will parse the nested JSON responses into a flat pandas DataFrame. I'll group by `targetSymbol`, `phase`, and `diseaseLabel` to create frequency counts and filter for the most relevant indications.

### Visualizations & Report Generation
I will use Plotly Express to generate interactive charts (bar, sunburst, or treemap) and then use Plotly's `to_html` or a custom Jinja2 template to package everything into a single, cohesive `intelligence_report.html` file.

## 6. Open Exploration

If time permits, I will explore the "Whitespace" by identifying targets with high SCimilarity expression in disease-specific clusters that have *zero* active clinical trials in Open Targets, suggesting novel therapeutic opportunities.

copyright: © 2026 Sonia Timberlake & Ryan Bellmore
license: Proprietary - Authorized Workshop Participants Only
distribution_allowed: false
