R and Python analysis code for a comparative retinal aging project integrating single-cell, single-nucleus, spatial transcriptomic, and cross-species aging datasets.
The repository is intended to share the analysis code and project structure used for retinal aging, cell-cell communication, spatial proximity, aging-clock, and region-aware cell-state analyses. Large raw and intermediate data objects are not included.
flowchart LR
A["Single-cell and single-nucleus retina data"] --> C["Cell annotation and aging-state analysis"]
B["Xenium spatial transcriptomics"] --> D["Spatial proximity and region-aware analysis"]
C --> E["Cross-species aging comparisons"]
D --> E
E --> F["Cell-cell communication and signaling programs"]
F --> G["Publication figures and candidate aging mechanisms"]
notebooks/
LRloop_analysis.Rmd # Cross-species ligand-receptor analysis notebook
Figure5_v1_20250521.Rmd # Figure 5-focused communication notebook
Spatial_analysis.Rmd # Xenium aging retina spatial proximity notebook
Spatial_osk_v3.Rmd # OSK/Xenium spatial and niche notebook
Proximity.Rmd # Cell-proximity notebook
scripts/
r/ # Smaller R scripts extracted by notebook section
python/ # Cleaned Python proximity-analysis utilities
tools/
extract_notebook_chunks.py # Rebuilds scripts/r/ from notebooks/
data/
README.md # Expected local data layout
Figures/
README.md # Notes for selected public figure previews
preview/ # Small GitHub-friendly preview images
- Cross-species retinal aging comparisons across mouse, human, and zebrafish.
- Ligand-receptor and LRLoop-based cell-cell communication analysis.
- RPE-focused and major-cell-type signaling analysis.
- Xenium spatial transcriptomics preprocessing and cell-type annotation.
- Spatial proximity, age-acceleration, and permutation-based neighborhood analysis.
- Region-specific expression and spatially localized aging-state analysis.
- OSK/Xenium niche analysis and aging-clock interpretation.
Selected low-resolution figure previews are included to make the repository easier to scan on GitHub. Full-resolution figures and generated plotting outputs remain excluded from version control.
| Preview | Analysis |
|---|---|
![]() |
Cross-species ligand-receptor signaling in retinal aging |
![]() |
Spatial transcriptomics and region-aware aging analysis |
![]() |
OSK/Xenium spatial analysis and aging-clock interpretation |
The original R Markdown notebooks are kept in notebooks/ to preserve the full
analysis narrative. For easier review and reuse, R code chunks from those
notebooks were split into smaller section-level scripts:
scripts/r/<notebook>/NN_section_name.R
A cleaned Python proximity-analysis module is available at
scripts/python/proximity_effect.py.
The extracted R scripts are generated with:
python3 tools/extract_notebook_chunks.pyEdit the notebooks first when changing the full analysis narrative, then rerun the extractor to refresh the smaller R scripts.
This is a code-first public repository. The analysis notebooks expect local Seurat, RData, h5ad, metadata, and intermediate result files generated in the original analysis environment. These large data objects are intentionally not committed to GitHub.
See data/README.md for the expected local data layout and file types.
The project uses both R and Python.
Core R packages include:
- Seurat
- tidyverse
- Matrix
- ggplot2
- reshape2
- readxl
- writexl
- pheatmap
- ggrepel
- ggforce
- ggvenn
- viridis
- RColorBrewer
- LRLoop
Python sections use tools such as:
- scanpy
- pandas
- numpy
- scipy
- spatial-aging-clock or related local proximity-analysis utilities
The notebooks were developed as analysis notebooks rather than turnkey package workflows. To rerun them:
- Place required raw and intermediate files according to
data/README.md. - Update local path variables near the top of each notebook or chunk.
- Install the R and Python dependencies listed above.
- Render notebooks from the repository root, run the smaller R scripts under
scripts/r/section by section, or reuse the Python utilities underscripts/python/.
Example:
rmarkdown::render("notebooks/LRloop_analysis.Rmd")
rmarkdown::render("notebooks/Spatial_analysis.Rmd")- This repository prioritizes transparent analysis code over raw-data hosting.
- Local and intermediate-data paths in the notebooks document the original analysis workflow and should be updated before reuse.
- Generated
.rds,.RData,.h5ad,.xlsx,.csv, and figure outputs are excluded by default unless a small public example is intentionally added.
Yang Jin, PhD
GitHub: https://github.com/jinyangye119


