Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help demo test lint ci clean bench-leakage bench-baseline bench-hidden-active generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-predict pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad
.PHONY: help demo test lint ci clean bench-leakage bench-baseline bench-hidden-active generate phase3 pilot validate-scoring validate-scoring-phase3 validate-scoring-strict external-predict pilot-confident presynth-qc gold-standard diversity synthesis-order novelty-broad external-consensus questionnaire gate-check ip-report benchmark-card

PYTHON := $(shell [ -f .venv/bin/python ] && echo .venv/bin/python || echo python3)
PYTEST := $(shell [ -f .venv/bin/pytest ] && echo .venv/bin/pytest || echo pytest)
Expand All @@ -17,8 +17,13 @@ help:
@echo " make diversity Within-panel diversity report"
@echo " make synthesis-order Vendor-ready synthesis order CSV + checklist"
@echo " make novelty-broad Compare pilot panel against 72-AMP curated reference set"
@echo " make external-consensus Aggregate external predictor results into consensus verdicts"
@echo " make questionnaire Generate pre-populated reviewer questionnaires"
@echo " make gate-check Run all pipeline decision gates (gates 1-7)"
@echo " make ip-report Generate IP and novelty claim strength report"
@echo " make benchmark-card Generate/update benchmark summary card"
@echo ""
@echo " make validate-scoring AUROC on 43 AMP + 44 background (pipeline config)"
@echo " make validate-scoring AUROC on 95 AMP + 96 decoy (pipeline config)"
@echo " make validate-scoring-phase3 AUROC with phase3.yaml config"
@echo " make validate-scoring-strict AUROC with scrambled-decoy strict benchmark"
@echo " make bench-leakage Check for near-duplicates between candidates and refs"
Expand Down Expand Up @@ -135,6 +140,33 @@ external-predict: pilot
--out-fasta outputs/pilot_panel.fasta \
--out-checklist outputs/external_predict_checklist.md

# ── Sprint 3-6 targets ─────────────────────────────────────────────────

external-consensus:
PYTHONPATH=src $(PYTHON) -m openamp_foundry.cli external-consensus \
--pilot-csv outputs/pilot_panel.csv \
--results-csv $$(or $$(RESULTS),outputs/external_predict_results.csv) \
--out outputs/external_consensus_report.md

questionnaire:
PYTHONPATH=src $(PYTHON) -m openamp_foundry.cli reviewer-questionnaire \
--panel-csv outputs/confident_panel.csv \
--out outputs/questionnaire

gate-check:
PYTHONPATH=src $(PYTHON) -m openamp_foundry.cli gate-check \
--validation-json outputs/validate_scoring_report.json

ip-report:
PYTHONPATH=src $(PYTHON) -m openamp_foundry.cli ip-report \
--panel-csv outputs/confident_panel.csv \
--novelty-csv outputs/novelty_audit_full.csv \
--out outputs/ip_report.md

benchmark-card: validate-scoring
@echo "Benchmark card is a static document at docs/BENCHMARK_CARD.md"
@echo "Run 'make validate-scoring' to update outputs/validate_scoring_report.json"

pilot-confident:
@if [ -z "$(KEEP)" ]; then \
echo "Usage: make pilot-confident KEEP=ID1,ID2,..."; \
Expand Down
70 changes: 70 additions & 0 deletions docs/BENCHMARK_CARD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Benchmark Card — OpenAMP Foundry v0.5.x

> **Purpose:** Single-page summary of benchmark methodology, data, and metrics.
> **Last updated:** 2026-06-29 (PR #110 expanded benchmark)

---

## Identity

| Field | Value |
|-------|-------|
| Pipeline version | v0.5.x |
| Benchmark type | Retrospective AUROC (composition-matched decoys) |
| Date | 2026-06-29 |
| Config | `configs/pipeline.yaml` (primary), `configs/phase3.yaml` (synthesis gate) |
| Commit | See `docs/METRICS_CURRENT.md` |

## Data

| Set | Count | Description |
|-----|:-----:|-------------|
| Positives | **95** | Public-domain AMPs from 12 taxonomic classes |
| Negatives (standard) | **96** | Length-matched random decoys (Swiss-Prot residue frequencies) |
| Negatives (strict) | **95** | Per-sequence composition-matched shuffles |
| Total (standard) | **191** | Expanded from original 87 (PR #110) |
| Reference library | **120** | Unified AMP library (deduplicated curated_72 + expanded_95) |

## Metrics

| Metric | Standard (pipeline) | Phase3 gate | Strict |
|--------|:-------------------:|:-----------:|:------:|
| **AUROC** | **0.7832** | **0.7448** | 0.4335 |
| **CI₉₅** | 0.72–0.84 | 0.68–0.81 | — |
| **AUPRC** | 0.8164 | 0.7933 | — |
| Baseline AUPRC | 0.4974 | 0.4974 | — |
| Recall@10 | 0.1053 | 0.1053 | — |
| Recall@20 | 0.2105 | 0.2105 | — |
| Recall@43 | 0.4211 | 0.4000 | — |
| Bootstrap | 2000 resamples | 2000 resamples | — |
| **Interpretation** | **STRONG** | **STRONG** | Below random (expected) |

## Method

AUROC computed via Wilcoxon-Mann-Whitney statistic (concordant-pair enumeration).
AUPRC via trapezoidal integration of precision-recall curve (pessimistic tie-breaking).
Confidence intervals: percentile bootstrap (2000 resamples, seed=0).

## Known Biases

| Bias | Impact | Mitigation |
|------|--------|------------|
| Helical-centric scorer | β-sheet AMPs (defensins) score below panel | Noted in METRICS_CURRENT.md |
| Melittin safety blind spot | Safety=1.0 despite strong hemolysis | Hemolysis assay mandatory for all |
| Composition-matched scrambled AUROC < 0.5 | Model relies on composition > order | Expected for physicochemical scorer |
| Near-seed generation only | Novel sequence space not explored | Acknowledged limitation in all docs |

## Historical Baseline

| Point | Set | Pipeline AUROC | Phase3 AUROC |
|-------|:---:|:--------------:|:------------:|
| Current (PR #110) | 95+96 (n=191) | **0.7832** | 0.7448 |
| Pre-expansion (PR #72) | 43+44 (n=87) | 0.8420 | 0.8266 |
| Pre-face-bonus (PR #70) | 43+44 | 0.8348 | 0.8126 |
| Pre-windowed-mu_h (PR #66) | 43+44 | 0.8047 | 0.7846 |

## Change Log

| Date | Change | Author |
|------|--------|--------|
| 2026-06-29 | Initial card — expanded benchmark (PR #110) | OpenAMP CI |
90 changes: 90 additions & 0 deletions docs/DECISION_RULES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Pipeline Decision Rules

> **Purpose:** Pre-registered pass/fail gates for each stage of the OpenAMP Foundry
> pipeline. Thresholds are hardcoded (see `src/openamp_foundry/gates/gate_checker.py`)
> to prevent cherry-picking after inspecting results.
>
> **Locked:** 2026-06-29 (Sprint 5)

---

## Gate 1 — AUROC Benchmark

| Field | Value |
|-------|-------|
| Threshold | AUROC ≥ **0.70** |
| Measure | Pipeline AUROC on expanded 95+96 benchmark |
| Config | `configs/pipeline.yaml` |
| Action | If FAIL: Do not proceed to synthesis |

## Gate 2 — Leakage Guard

| Field | Value |
|-------|-------|
| Threshold | Recall@43 < **0.60** |
| Measure | Fraction of positives recovered in top 43 ranked |
| Rationale | Recall@43 > 0.60 suggests near-duplicate memorisation |
| Action | If FAIL: Investigate reference-set contamination |

## Gate 3 — Model Disagreement

| Field | Value |
|-------|-------|
| Threshold | Top-3 candidate |activity − boman_activity| < **0.45** |
| Measure | Absolute difference between two independent scorers |
| Config | `configs/pipeline.yaml`, `configs/phase3.yaml` |
| Action | If FAIL: Review scorer weights or threshold |

## Gate 4 — Top-10 Recall

| Field | Value |
|-------|-------|
| Threshold | Recall@10 > **0.0** |
| Measure | At least 1 positive in top 10 ranked candidates |
| Action | If FAIL: Scoring model likely broken |

## Gate 5 — Interpretation

| Field | Value |
|-------|-------|
| Threshold | Benchmark interpretation must be **STRONG** |
| Measure | String match of `interpretation` field |
| Action | If FAIL: Do not proceed |

## Gate 6 — External Predictor Consensus

| Field | Value |
|-------|-------|
| Threshold | ≥3/5 external tools positive |
| Measure | Manual web submission results |
| Status | PENDING (see `outputs/external_predict_checklist.md`) |
| Action | If FAIL: Expert reviewer override required |

## Gate 7 — Human Expert Review

| Field | Value |
|-------|-------|
| Threshold | Expert reviewer APPROVE or CONDITIONAL |
| Measure | Completed reviewer questionnaire |
| Status | PENDING (see `outputs/questionnaire/`) |
| Action | If REJECT: Exclude from synthesis |

---

## CLI Usage

```bash
# Check all gates:
openamp-foundry gate-check \
--validation-json outputs/validate_scoring_report.json

# Check specific gate:
openamp-foundry gate-check --gate 1 \
--validation-json outputs/validate_scoring_report.json
```

## Hardcoding Rule

All gate thresholds in `gates/gate_checker.py` are **hardcoded** (not configurable
via YAML). To change a threshold: modify source code, commit, and create a new release.
This prevents silent threshold drift that could mask performance regression.
49 changes: 49 additions & 0 deletions docs/EXTERNAL_PREDICTOR_CONSENSUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# External Predictor Consensus

## Purpose

Aggregate predictions from 5 independent AMP prediction tools into a single
consensus verdict per candidate. A candidate with ≥3/5 tool agreement is
classified as **CONFIDENT** and recommended for synthesis.

## Tool Summary

| Tool | Method | Positive label | URL |
|------|--------|---------------|-----|
| CAMPR4 | SVM + RF + ANN + DT ensemble | AMP | camp3.bicnirrh.res.in |
| AMPScanner v2 | LSTM | Antimicrobial | dveltri.com/ascan/v2 |
| dbAMP 2.0 | Random Forest | AMP | awi.cuhk.edu.cn/dbAMP |
| AntiCP 2.0 | SVM | ACP (not AMP) | webs.iiitd.edu.in/raghava/anticp2 |
| Macrel | Random Forest | AMP | big-data-biology.org/software/macrel |

## Consensus Rules

| Agreement | Verdict | Action |
|:---------:|---------|--------|
| ≥3/5 | CONFIDENT | Proceed to synthesis |
| 2/5 | UNCERTAIN | Expert review required |
| ≤1/5 | WEAK | Do not synthesise |

## Current Status

**PENDING** — Results not yet obtained. All 5 tools require manual web submission.
See `outputs/external_predict_checklist.md` for the submission guide.

## CLI Usage

```bash
# After filling in results CSV:
make external-consensus RESULTS=outputs/external_predict_results.csv

# Or manually:
openamp-foundry external-consensus \
--pilot-csv outputs/pilot_panel.csv \
--results-csv outputs/external_predict_results.csv \
--out outputs/external_consensus_report.md
```

## See Also

- `outputs/external_predict_checklist.md` — Manual submission guide
- `src/openamp_foundry/reports/external_consensus.py` — Implementation
- `docs/ASSAY_PREREGISTRATION.md` — Pre-registered assay protocol
79 changes: 79 additions & 0 deletions docs/IP_PLAN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# IP and Disclosure Plan

> **Purpose:** Strategic guidance for intellectual property decisions before public
> sequence disclosure. Not a legal opinion — consult a patent attorney before filing.
>
> **Last updated:** 2026-06-29 (Sprint 6)

---

## Patent Strategy

### Claimable Candidates

| Seed | Classification | Claim strategy |
|------|---------------|----------------|
| SEED-006 (4 candidates) | HIGH_CONFIDENCE_NOVEL | Primary patent claims — novel wasp-venom scaffold |
| SEED-007 (1 candidate) | HIGH_CONFIDENCE_NOVEL | Primary patent claims — novel bumblebee-venom scaffold |
| SEED-008 (3 candidates) | HIGH_CONFIDENCE_NOVEL | Primary patent claims — novel Trp-rich plant scaffold |
| SEED-009 (2 candidates) | HIGH_CONFIDENCE_NOVEL | Primary patent claims — novel proline-rich scaffold |
| SEED-007 (3 candidates) | NOVEL | Moderate claims — verify mechanism distinct from bombolitin literature |
| SEED-008 (1 candidate) | NOVEL | Moderate claims — verify mechanism distinct from indolicidin |
| SEED-005 (1 candidate) | CLOSE_RELATIVE | Not individually patentable — SAR control |
| SEED-001 (1 candidate) | KNOWN_VARIANT | Not patentable — positive control |
| SEED-003 (2 candidates) | KNOWN_VARIANT | Not patentable — tachyplesin-like SAR |

### Provisional Patent

Before any public sequence disclosure, file provisional patent application covering:
1. SEED-006 scaffold and all pilot variants
2. SEED-007 scaffold and all pilot variants
3. SEED-008 scaffold and all pilot variants
4. SEED-009 scaffold and all pilot variants
5. Composition claims for any MIC ≤ 8 µg/mL candidate
6. Methods of use (antimicrobial treatment, wound healing)

### Sequence Deposit

Deposit sequences in patent filing as SEQ ID NOs. Use the WIPO ST.26 standard
(valid from July 2022) for sequence listing.

## Disclosure Plan

| Tier | Candidates | Disclosure | Timing |
|:----:|------------|------------|--------|
| 1 | SEED-006, 007, 008, 009 (14 candidates) | **Redacted** from public repo | After provisional filing |
| 2 | SEED-001, 003, 005 (6 candidates) | Public (known scaffolds) | Anytime |
| 3 | Pipeline code | Public (MIT license) | Already public |

## Freedom to Operate

**Required searches before publication:**
- [ ] APD3 BLASTp — no hit > 80% identity
- [ ] DRAMP patent section — no overlapping claims
- [ ] Google Patents / Lens.org — scaffold-level search
- [ ] Competitor sequence database (AMP-Designer, AMPGAN v3, etc.)

## Publication Strategy

1. **First publication:** Pipeline methodology + benchmark results only
(no candidate sequences disclosed)
2. **Second publication:** Candidate nominations + novelty audit
(after provisional patent filing)
3. **Third publication:** Wet-lab results
(after independent replication)

## Material Transfer

Before sharing candidate peptides with external labs, execute an MTA covering:
- Sequence confidentiality
- Publication rights
- IP ownership (background vs foreground)
- Data sharing obligations

## Contributor IP

All contributors to this repository have assigned code contributions under
the MIT license. No separate contributor agreement is in place for computational
contributions. If wet-lab collaborators join, a formal collaboration agreement
should define IP ownership before any experimental work begins.
Loading
Loading