4.0 KiB
Executable File
PPI STRING Image and Fold2 Links Implementation Plan
For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (
- [ ]) syntax for tracking.
Goal: Make PPI results reliably expose a current STRING network image and a clearly labeled AlphaFold DB/Fold2 single-protein link table.
Architecture: Keep the PPI execution model unchanged. Extend backend post-processing after STRING PPI completes: retry STRING static image downloads with PNG/SVG fallbacks, then derive an AlphaFold DB link TSV from existing STRING ID resolution output.
Tech Stack: Python 3.11, pytest, existing apps/web/pipeline_backend.py, existing PPI final artifacts.
Global Constraints
- Do not add AlphaFold3 complex prediction.
- Do not call external AlphaFold prediction services.
- Label links as AlphaFold DB/Fold2 single-protein structure links, not interaction structures.
- Preserve existing PPI network TSV, STRING URL, and species behavior.
- Use TDD for backend behavior changes.
Task 1: STRING Static Image Fallbacks
Files:
- Modify:
apps/web/pipeline_backend.py - Test:
tests/unit/test_pipeline_backend_execution_env.py
Interfaces:
-
Consumes:
download_string_network_image(string_url: str, output_file: Path) -
Produces:
download_string_network_image(...) -> Optional[Path], returning either a.pngor.svgpath. -
Step 1: Write failing tests
Add tests that monkeypatch requests.post so high-resolution PNG fails and normal PNG succeeds, and another test where PNG fails and SVG succeeds.
- Step 2: Verify red
Run: pytest tests/unit/test_pipeline_backend_execution_env.py -k "string_network_image" -q
Expected: tests fail because the current function only tries highres_image.
- Step 3: Implement minimal fallback
Update download_string_network_image to try:
https://string-db.org/api/highres_image/networkto.pnghttps://string-db.org/api/image/networkto.pnghttps://string-db.org/api/svg/networkto.svg
- Step 4: Verify green
Run: pytest tests/unit/test_pipeline_backend_execution_env.py -k "string_network_image" -q
Expected: tests pass.
Task 2: AlphaFold DB/Fold2 Link Artifact
Files:
- Modify:
apps/web/pipeline_backend.py - Test:
tests/unit/test_pipeline_backend_execution_env.py
Interfaces:
-
Consumes:
final/{prefix}.ppi_id_resolution.tsv -
Produces:
final/{prefix}.ppi_alphafold2_links.tsv -
Step 1: Write failing test
Add a test that creates a minimal PPI ID resolution TSV with a STRING identifier and verifies the generated AlphaFold DB link TSV exists, has explicit structure_type=AlphaFold DB/Fold2 single protein, and does not claim complex/interactor prediction.
- Step 2: Verify red
Run: pytest tests/unit/test_pipeline_backend_execution_env.py -k "alphafold2_links" -q
Expected: test fails because the helper does not exist.
- Step 3: Implement minimal link generation
Add a helper that reads the ID resolution TSV and writes a link table. Use a conservative AlphaFold DB search URL when a direct UniProt accession is not available.
- Step 4: Register artifact
When the link TSV exists, include it in the PPI manifest/status artifacts using a clear key such as alphafold2_links.
Task 3: Real Job Verification
Files:
- No planned source edits beyond Tasks 1-2.
Verification:
- Run Python syntax check for touched Python.
- Run focused pytest tests.
- Rerun PPI on
workspace/job_1783408660053_d1349eor call the existing backend path using its current curated rice input. - Confirm:
final/Os.CRR.ppi_network.string.pngor.svgexists and is non-empty.final/Os.CRR.ppi_alphafold2_links.tsvexists and is non-empty.- Manifest/status artifacts include the image if downloaded and the Fold2 link TSV.
- STRING URL remains
species=39947for rice and input genes remain the curated 20-member set.