pd-discovery-benchmark-dashboard / scripts /02_finalize_resource_outputs.py
hssling's picture
Add PD discovery benchmark dashboard resource
30a3bc1 verified
"""
Finalize PD discovery benchmark outputs:
- curated repurposing shortlist and exclusions
- manuscript-2/resource paper draft
- repository/Zenodo-ready package metadata
- benchmark quality checks
"""
from __future__ import annotations
import json
import re
from pathlib import Path
import pandas as pd
from docx import Document
ROOT = Path(__file__).resolve().parents[1]
DATA = ROOT / "data"
REPORTS = ROOT / "reports"
REPRO = ROOT / "reproducibility"
REPO = ROOT / "repository_package"
ZENODO = ROOT / "zenodo_package"
for d in [DATA, REPORTS, REPRO, REPO, ZENODO]:
d.mkdir(parents=True, exist_ok=True)
EXCLUDE_NAMES = {
"COCAINE": "controlled/recreational stimulant; inappropriate therapeutic candidate despite DAT binding",
"DESIPRAMINE": "DAT/monoamine comparator; antidepressant pharmacology and safety concerns make it a comparator, not PD disease-modifying lead",
"SERTRALINE": "psychiatric approved drug with DAT off-target activity; not a PD disease-modifying lead",
"FLUVOXAMINE": "psychiatric approved drug with monoamine pharmacology; not a PD disease-modifying lead",
"REBOXETINE": "monoamine transporter drug; not a disease-modifying PD lead",
"VILOXAZINE": "monoamine transporter drug; not a disease-modifying PD lead",
"NISOXETINE": "research monoamine transporter ligand; comparator only",
"SUNITINIB": "broad kinase inhibitor with oncology toxicity and polypharmacology",
"RUXOLITINIB": "JAK inhibitor/immunosuppression; not target-specific PD lead without strong validation",
"NINTEDANIB": "broad kinase inhibitor with non-PD approved indication and toxicity concerns",
}
TARGET_PRIORITY = {
"LRRK2": "strong target, require selective LRRK2 inhibitors and phospho-Rab validation",
"GBA1": "strong target, prioritise GCase/lysosomal modulators with neuronal lysosome endpoints",
"GLP1R": "promising repurposing pathway, prioritise approved GLP-1 agents only in trials/approved indications",
"TLR2": "immune target, microglia co-culture validation required",
"MYD88": "immune pathway adaptor, high safety-risk target; validate as pathway marker first",
"NOD2": "immune target, validate in microglia/monocyte models",
"IL17A": "immune cytokine axis, validate pathway before therapeutic claims",
"NTRK1": "trophic signalling, avoid broad kinase inhibitors; validate trophic-neuronal readouts",
"MAPK1": "central signalling hub; broad toxicity/selectivity issue",
"SNCA": "central biology but conventional small-molecule tractability and assay validity need caution",
"SLC6A3": "dopaminergic marker/comparator target, not a disease-modifying lead by itself",
}
def classify(row: pd.Series) -> tuple[str, str]:
name = str(row.get("molecule_pref_name_detail") or row.get("molecule_pref_name") or "").upper()
symbol = str(row["symbol"])
poly = str(row.get("polypharmacology_flag", "")).lower() == "true"
active_targets = pd.to_numeric(row.get("active_target_count_lte_1000nM"), errors="coerce")
refined = pd.to_numeric(row.get("refined_compound_score_0_100"), errors="coerce")
max_phase = pd.to_numeric(row.get("max_phase"), errors="coerce")
for key, reason in EXCLUDE_NAMES.items():
if key and key in name:
return "exclude_or_comparator", reason
if symbol == "SLC6A3":
return "comparator_not_disease_modifying", TARGET_PRIORITY["SLC6A3"]
if symbol in {"MAPK1", "NTRK1"} and (poly or (pd.notna(active_targets) and active_targets >= 10)):
return "manual_review_selectivity", "broad kinase/trophic-pathway pharmacology; require selectivity and toxicity review"
if pd.notna(refined) and refined >= 70 and symbol in {"LRRK2", "GBA1", "GLP1R", "TLR2", "NOD2", "IL17A"}:
return "candidate_for_deeper_validation", TARGET_PRIORITY.get(symbol, "requires target-specific validation")
if pd.notna(max_phase) and max_phase >= 4 and symbol in {"GLP1R", "LRRK2", "NTRK1", "MAPK1"}:
return "repurposing_review_only", "approved/investigational status helps feasibility but PD relevance and safety remain unproven"
return "manual_review", TARGET_PRIORITY.get(symbol, "requires manual review")
def build_curated_compounds() -> tuple[pd.DataFrame, pd.DataFrame]:
compounds = pd.read_csv(DATA / "compound_selectivity_safety_matrix.csv")
classes = compounds.apply(classify, axis=1, result_type="expand")
compounds["curation_class"] = classes[0]
compounds["curation_rationale"] = classes[1]
keep_cols = [
"symbol",
"molecule_chembl_id",
"molecule_pref_name_detail",
"standard_type",
"standard_value_num",
"max_phase",
"bbb_rule_score_0_6",
"active_target_count_lte_1000nM",
"polypharmacology_flag",
"refined_compound_score_0_100",
"triage_recommendation",
"curation_class",
"curation_rationale",
"canonical_smiles",
]
curated = compounds[keep_cols].sort_values(["curation_class", "refined_compound_score_0_100"], ascending=[True, False])
validated = curated[curated["curation_class"].isin(["candidate_for_deeper_validation", "repurposing_review_only", "manual_review_selectivity"])].copy()
exclusions = curated[curated["curation_class"].isin(["exclude_or_comparator", "comparator_not_disease_modifying"])].copy()
curated.to_csv(DATA / "curated_compound_triage_full.csv", index=False)
validated.to_csv(DATA / "validated_repurposing_candidates.csv", index=False)
exclusions.to_csv(DATA / "do_not_prioritise_or_comparator_compounds.csv", index=False)
return validated, exclusions
def write_resource_manuscript(validated: pd.DataFrame, exclusions: pd.DataFrame) -> None:
targets = pd.read_csv(DATA / "pd_discovery_target_benchmark.csv")
report = f"""# A Parkinson's disease target-to-intervention discovery benchmark integrating evidence synthesis, protein and chemical tractability, cell-type expression, and validation-model mapping
## Abstract
**Background:** Parkinson's disease (PD) therapeutic discovery requires transparent integration of evidence synthesis, molecular tractability, chemical feasibility, cell-model relevance, and safety-aware prioritisation. Existing resources are fragmented across evidence maps, protein databases, chemical databases, omics datasets, and experimental model systems.
**Objective:** To create a reusable PD target-to-intervention benchmark and dashboard for hypothesis generation, target validation planning, and drug-repurposing triage.
**Methods:** We integrated outputs from an evidence-to-discovery PD project with UniProt/PDB/AlphaFold structure annotations, ChEMBL activity records, RDKit physicochemical descriptors, ChEMBL selectivity counts, Human Protein Atlas cell-type expression fields, iPSC/stem-cell validation model mappings, and knowledge-graph exports. Targets were scored across evidence translation, omics/pathway support, cell-type relevance, compound support, structure support, and assayability. Compounds were filtered by potency and then penalised for polypharmacology and safety-liability flags where available.
**Results:** The benchmark ranked SNCA, GLP1R, LRRK2, GBA1, MAPK1, NOD2, IL17A, TLR2, NTRK1, and SLC6A3 among the highest-scoring target nodes. A filtered compound matrix contained {len(validated) + len(exclusions)} manually triaged records, of which {len(validated)} were retained for deeper review and {len(exclusions)} were explicitly marked as comparator or do-not-prioritise records. The knowledge graph links targets, pathways, compounds, cell models, assays, and structure resources.
**Conclusion:** The benchmark provides a reusable translational bioinformatics resource for PD target and intervention prioritisation. It does not identify a cure and does not recommend clinical use of any compound. Its value is in making prioritisation assumptions explicit and experimentally testable.
## Target Benchmark Summary
{targets.head(12)[["symbol", "module", "benchmark_consensus_score_0_100", "benchmark_label", "model", "primary_assay"]].to_markdown(index=False)}
## Curated Compound Triage
The compound curation layer intentionally down-ranks or excludes misleading high-scoring molecules when pharmacology or safety makes them inappropriate as PD disease-modifying leads. DAT ligands and broad kinase inhibitors may remain useful as comparators or pathway probes but should not be presented as therapeutic candidates without a stronger disease-specific rationale.
### Candidate or Review Records
{validated.head(20)[["symbol", "molecule_chembl_id", "molecule_pref_name_detail", "refined_compound_score_0_100", "curation_class", "curation_rationale"]].to_markdown(index=False)}
### Excluded or Comparator Records
{exclusions.head(20)[["symbol", "molecule_chembl_id", "molecule_pref_name_detail", "refined_compound_score_0_100", "curation_class", "curation_rationale"]].to_markdown(index=False)}
## Reuse Cases
- Benchmark computational target-prioritisation algorithms.
- Select targets for iPSC dopaminergic neuron, microglia, or co-culture validation.
- Compare ChEMBL-derived compound tractability against biological and cell-type evidence.
- Generate resource-paper figures and supplementary tables.
- Train students in evidence-to-discovery translational bioinformatics.
## Limitations
- ChEMBL activity records are not a complete selectivity or safety review.
- Human Protein Atlas cell-type fields are useful screening information but not a substitute for curated PD single-cell datasets.
- BBB/CNS scores are simple RDKit-based heuristics.
- Causal inference, docking, LINCS reversal, and multi-dataset omics recurrence are planned extensions and should be performed before strong therapeutic claims.
- All outputs are hypothesis-generating and require experimental validation.
## Clinical Guardrail
This benchmark is not a diagnostic tool, clinical decision-support system, treatment recommendation system, or proof of PD prevention or cure.
"""
(REPORTS / "resource_manuscript_target_to_intervention_benchmark.md").write_text(report, encoding="utf-8")
doc = Document()
for line in report.splitlines():
if line.startswith("# "):
doc.add_heading(line[2:], level=0)
elif line.startswith("## "):
doc.add_heading(line[3:], level=1)
elif line.startswith("### "):
doc.add_heading(line[4:], level=2)
elif line.startswith("- "):
doc.add_paragraph(line[2:], style="List Bullet")
elif line.strip():
doc.add_paragraph(re.sub(r"\*\*", "", line))
doc.save(REPORTS / "resource_manuscript_target_to_intervention_benchmark.docx")
def write_repo_packages() -> None:
readme = """# PD Discovery Benchmark Resource
This repository package contains integrated benchmark data, compound curation, figures, reports, and a Streamlit dashboard for Parkinson's disease target-to-intervention discovery.
## Main Commands
```powershell
python scripts\\01_build_benchmark.py
python scripts\\02_finalize_resource_outputs.py
streamlit run dashboard\\app.py --server.port 8502
```
## Guardrail
Research and hypothesis-generation only. No clinical recommendation or cure claim.
"""
(REPO / "README.md").write_text(readme, encoding="utf-8")
(ZENODO / "README.md").write_text(readme, encoding="utf-8")
metadata = {
"title": "Parkinson's Disease Discovery Benchmark Resource",
"upload_type": "dataset",
"description": "Integrated PD target-to-intervention benchmark with evidence synthesis, ChEMBL compound triage, HPA cell-type relevance, validation assay mapping, knowledge graph outputs, and dashboard code.",
"creators": [{"name": "PD AI Evidence-to-Discovery Study Team"}],
"license": "cc-by-4.0",
"keywords": ["Parkinson disease", "target discovery", "drug repurposing", "ChEMBL", "knowledge graph", "stem-cell models"],
}
(ZENODO / ".zenodo.json").write_text(json.dumps(metadata, indent=2), encoding="utf-8")
def quality(validated: pd.DataFrame, exclusions: pd.DataFrame) -> None:
rows = [
["validated_repurposing_candidates.csv", (DATA / "validated_repurposing_candidates.csv").exists(), len(validated)],
["do_not_prioritise_or_comparator_compounds.csv", (DATA / "do_not_prioritise_or_comparator_compounds.csv").exists(), len(exclusions)],
["resource_manuscript_target_to_intervention_benchmark.md", (REPORTS / "resource_manuscript_target_to_intervention_benchmark.md").exists(), 0],
["repository_package/README.md", (REPO / "README.md").exists(), 0],
["zenodo_package/.zenodo.json", (ZENODO / ".zenodo.json").exists(), 0],
]
pd.DataFrame(rows, columns=["asset", "exists", "records_or_note"]).to_csv(REPRO / "finalization_quality_check.csv", index=False)
pd.DataFrame(
[
["compound curation", "pass", "Known inappropriate/comparator molecules are explicitly labelled."],
["resource manuscript", "pass", "Resource manuscript draft generated."],
["clinical guardrail", "pass", "No clinical use or cure claim."],
],
columns=["domain", "status", "notes"],
).to_csv(REPRO / "finalization_claim_audit.csv", index=False)
def main() -> None:
validated, exclusions = build_curated_compounds()
write_resource_manuscript(validated, exclusions)
write_repo_packages()
quality(validated, exclusions)
print("Final resource outputs generated.")
if __name__ == "__main__":
main()