Goal
Build a reusable Jupyter notebook template for analyzing Allen Institute datasets with SciDEX integration. Provides a standardized framework for agents to generate analysis notebooks with proper structure, visualizations, provenance tracking, and SciDEX KG export.
Acceptance Criteria
☑ notebooks/allen_analysis_template.ipynb created with all required sections
☑ Utility functions: fetch_allen_data, differential_expression, plot_heatmap, pathway_enrichment, export_to_scidex_kg
☑ notebook_cells table created via migration
☑ /api/notebooks/by-analysis/{analysis_id} endpoint added
☑ Analysis detail page already links to notebooks (verified existing)
☑ Test: template verified (JSON valid, DB table created)
Dependencies
- AllenSDK, scanpy, gseapy (to be installed/verified in notebook cell 1)
- Existing
notebooks table (already exists)
Work Log
2026-04-13 — Started
- Verified task still necessary:
notebooks/allen_analysis_template.ipynb does not exist (only allen_brain_template.ipynb)
- Missing: DESeq2/Scanpy, UMAP/tSNE, gseapy, export_to_scidex_kg, notebook_cells table, /api/notebooks/{analysis_id} endpoint
- Analysis detail page already links to notebooks (lines 31200-31229 of api.py) ✓
2026-04-13 — Completed
- Created
notebooks/allen_analysis_template.ipynb (33 cells, valid JSON):
- Sections: metadata, env setup, utility functions, data loading, EDA, DE, UMAP/tSNE, enrichment, SciDEX integration, export
- Utility functions: fetch_allen_data, differential_expression, plot_heatmap, pathway_enrichment (gseapy), export_to_scidex_kg
- Supports AllenSDK + demo data fallback
- Created
migrations/043_create_notebook_cells_table.py (notebook_cells table with notebook_id FK, cell_index, cell_type, code, output)
- Added
/api/notebooks/by-analysis/{analysis_id} endpoint to api.py (line 11381)
- Rebased with origin/main, committed and pushed to task-605ce1e1-fix