Code for every figure, table and reported value in
NICHESv2: edge-level ligand-receptor communication analysis with deterministic scoring and flexible neighborhood aggregation. Genome Biology (Software), submitted. (citation and DOI to be added)
The NICHESv2 package itself is at https://github.com/RaredonLab/NICHESv2 (version 1.0.0, archived at https://doi.org/10.5281/zenodo.24727934). This repository holds only the analysis scripts. Everything the paper shows is regenerated from one public input, the PPLR Seurat object deposited with the PPLR study (https://doi.org/10.64898/2026.11.25.768918).
Every block was rerun on 20–21 November 2026 and checked against the files the submitted figures were made from. Panels were byte-identical except where a block's README says otherwise, and every reported value was unchanged.
| Input | Where | Used by |
|---|---|---|
PPLR atlas: xenium.PPLR.20260728.Robj (Seurat object; 330,317 cells, 24 rat lung sections, Xenium) |
deposited with the PPLR study, Obata et al. 2026, bioRxiv: https://doi.org/10.64898/2026.11.25.768918 | everything except the Scriabin comparison |
| Human pancreatic islets, Fluidigm C1 subset (638 cells) of Lawlor et al. 2017 (GEO GSE86469) | R package panc8.SeuratData (v3.0.2) |
Fig. 4D, E |
- Install R (≥ 4.3) and NICHESv2 1.0.0, plus the R and Python packages listed in
environment/README.md. - Download the PPLR Seurat object,
xenium.PPLR.20260728.Robj(see Data). The scripts call it the GEO object. - Tell the scripts where the object is and where to write outputs (about 31 GB, almost all
of it the four NICHESv2 objects in
shared/). Either set the environment variablesNICHESV2_PAPER_GEOandNICHESV2_PAPER_DATA, or createconfig/paths_local.Rwith:GEO_OBJECT <- "/path/to/xenium.PPLR.20260728.Robj" DATA_DIR <- "/path/to/output/folder"
- Run every script from the repository root, for example
Rscript shared/01_cell_metadata.Rorpython fig4_tool_comparison/03_run_commot.py. Python scripts read the same settings throughconfig/paths.py.
Memory: steps 4 and 5 of shared/ need about 50 GB of RAM (the times below are from a
64 GB Apple-silicon Mac). Step 5 (04_export_tissueplex.R) also needs R's vector memory limit
raised above the macOS default, for example with R_MAX_VSIZE=100Gb in ~/.Renviron. A value
already set in ~/.Renviron overrides one set on the command line.
Run shared/ first. After that, each figure folder can be run on its own, in any order.
Figure folders read only from shared/ and from themselves.
config/ paths (the only place to set them)
shared/ inputs used by more than one figure
fig2_efficiency/ Fig. 2 NICHESv2 vs NICHESv1 speed and memory (HPC)
fig3_scoring/ Fig. 3 scoring settings + Figs. S1, S2
fig4_tool_comparison/ Fig. 4 CytoSignal, COMMOT, Scriabin + Fig. S3
fig5_aggregation/ Fig. 5 neighborhood aggregation + Figs. S4, S5, Table S1
fig6_niche/ Fig. 6 neighborhood composition
environment/ R and Python package versions, install notes
Run times on the Mac above: shared/ about 2 hours (the four NICHESv2 runs take 85 min),
fig3_scoring/ 25 min, fig4_tool_comparison/ 55 min (COMMOT 46), fig5_aggregation/
47 min (CellChat 36), fig6_niche/ under a minute, fig2_efficiency/ seconds (plotting
only). Each folder's README lists its scripts in order.
Each figure folder ends with figN_statistics.R, which prints every value the manuscript
reports for that figure and its supplementary materials, labeled with where it appears.
| Step | Script | Writes (in <DATA_DIR>/shared/) |
Time |
|---|---|---|---|
| 1 | 01_cell_metadata.R |
cell_meta.parquet |
1 min |
| 2 | 02_cell_outlines.R |
pplr.plotting.Robj (cell outlines for the maps) |
2 min |
| 3 | 06_palette_files.R |
celltype_colors.csv, TissuePlex_palette_celltype_Type6.csv |
seconds |
| 4 | 03_run_nichesv2.R all |
NICHESv2_PPLR_rad25_{raw,norm}_{product,minimum}.rds |
85 min (about 20 min per setting) |
| 5 | 04_export_tissueplex.R all |
edges_{raw,norm}_{product,minimum}.parquet |
25 min (about 6 min per setting) |
| 6 | 05_aggregation_cache.R |
agg_edge.parquet, nbr_composition.parquet, lrm_meta.parquet |
4 min |
palette_celltype.R holds the single cell-type palette that every figure uses.
The manuscript's supporting materials are made by scripts in the supplementary/ folder of
the main figure they support. Script and output names start with the manuscript label.
| Label | Content | Script |
|---|---|---|
| Fig. S1 | Regions emphasized by raw and normalized scoring differ in transcripts per cell | fig3_scoring/supplementary/FigS1_regions_transcript_count.R |
| Fig. S2 | Transcript count and edge score under each scoring setting | fig3_scoring/supplementary/FigS2_step1, _step2, _step3 (in that order) |
| Fig. S3 | Single-cell agreement among the three spatial tools | fig4_tool_comparison/supplementary/FigS3_concordance_all_pairs.py |
| Fig. S4 | NICHESv2 and CellChat for five further LRMs | fig5_aggregation/supplementary/FigS4_cellchat_more_LRMs.R |
| Fig. S5 | Most cells only send or only receive a given LRM | fig5_aggregation/supplementary/FigS5_send_receive.R |
| Label | Content | Script |
|---|---|---|
| Table S1 | Family assignment of the 558 LRMs | fig5_aggregation/supplementary/TableS1_lrm_families.R, from the hand-curated supplementary/inputs/TableS1_lrm_families.csv |
Some panels were made interactively and cannot be scripted. Their exact settings are recorded next to the related figure:
- TissuePlex renders: Fig. 3A and 3C, Fig. 6C, Fig. S1A (from
shared/edges_*.parquet). The Fig. 3 and S1A settings are infig3_scoring/tissueplex_views.md, and the Fig. 6C settings are infig6_niche/tissueplex_views.md. - The score table in Fig. 3B, the diagram in Fig. 1, and the assembly of all figures in Illustrator.
- Figs. 3–6 and Figs. S1–S5: NICHESv2 1.0.0.
- Fig. 2: NICHESv2 0.0.9000 and NICHES 1.2.4, run on the Yale McCleary HPC (R 4.4.1). The benchmark needed up to 707 GB of memory, so its results table is included and only the plotting step runs locally.
This repository does not carry a license. For reuse of the code, contact the corresponding author, Micha Sam Brickman Raredon.