Skip to content

Reproducing the paper

The folder code_paper of the repository contains the analysis code of the paper:

Zhang, Q., Jiang, S., Schroeder, A., Hu, J., Li, K., Zhang, B., Dai, D., Lee, E. B., Xiao, R. and Li, M. Leveraging spatial transcriptomics data to recover cell locations in single-cell RNA-seq with CeLEry. Nature Communications 14, 4050 (2023). https://doi.org/10.1038/s41467-023-39895-3

Each row gives the Results subsection of the paper that a folder belongs to, with its title as published, and the figures that the folder supports. The figure numbers refer to the published article and its Supplementary Information. The README in each folder describes the steps and the output of each script.

Folder Results subsection Figures Data and access Scripts in run order
1_LIBD Benchmark evaluation for cortical layer recovery in the human dorsolateral prefrontal cortex Fig. 3. LIBDacc.R draws Fig. 3d. LIBDVisual.R draws Fig. 3e LIBD human DLPFC 10x Visium data, sections 151507 and 151673 to 151676, from spatialLIBD preprocess.py, then CeLEry_train_Scenario1and2.py or CeLEry_train_Scenario3and4.py, then prediction.py (Scenarios 1 and 2), then LIBDacc.R and LIBDVisual.R
2_Alzheimer Application to recover cortical layers for snRNA-seq data in AD brains Fig. 4. test.py writes the layer probabilities of each nucleus. No script here draws the panels Training data: LIBD sections 151673 to 151676 from spatialLIBD. Query: AD snRNA-seq data from the Box folder that the paper names, which returned HTTP 404 on 2026-10-29 preprocess.py, then CeLEry_train.py, then test.py
3_Mouse_10x_Visium Benchmark evaluation for 2D location recovery in mouse brain with 10x Visium data as spatial reference Fig. 5a to 5c, Supplementary Fig. 4a, Supplementary Fig. 5 10x Visium mouse posterior brain, section V1_Mouse_Brain_Sagittal_Posterior, enhanced with TESLA. The TESLA output is not in the repository Create the hold-out indices (see the folder README), then run Mouse_CeLEry.ipynb, Mouse_Tangram.ipynb, Mouse_novosparc.ipynb and Mouse_spotOTsc.ipynb in any order
4_Mouse_brain_MERFISH Benchmark evaluation for 2D location recovery in mouse brain with MERSCOPE data as spatial reference Fig. 6, Supplementary Fig. 7, Supplementary Fig. 8. Tangram, spaOTsc and novoSpaRc are run for Scenario 1 only Vizgen MERSCOPE mouse brain data, slice 1, replicates 1 to 3, from Vizgen or the Box folder of the folder README Scenario 1: CeLEry_brain.ipynb, Tangram_brain.ipynb, SpaOTsc_brain.ipynb and novoSpaRc_brain.ipynb, then brain_result.ipynb. Scenarios 2 and 3: CeLEry_figure 6_scenario 2.ipynb and CeLEry_figure 6_scenario 3.ipynb
5_liver_MERFISH Benchmark evaluation for 2D location recovery in liver cancer with MERSCOPE data as spatial reference Fig. 9, Supplementary Fig. 10 Vizgen MERSCOPE human liver cancer data (HumanLiverCancerPatient2), from the Vizgen bucket on Google Cloud or the Box folder of the folder README CeLEry_liver.ipynb, which writes the data/liver_merfish.h5ad that the others read, then Tangram_liver.ipynb, SpaOTsc_liver.ipynb and novoSpaRc_liver.ipynb, then liver_result.ipynb
6_breast_cancer_10x_Xenium Benchmark evaluation for 2D location recovery in breast cancer with 10x Xenium data as spatial reference, and the cell type recovery reported in the Discussion Supplementary Fig. 14 (Domain_prediction). The notebooks in 2D_locationRecovery hold out 10% of the cells of Replicate 1. Fig. 10 and Supplementary Figs. 11 to 13 test on Replicate 2 instead 10x Xenium FFPE human breast cancer data, Replicate 1, from 10x Genomics In each subfolder, the CeLEry notebook, which writes the training and test cells, then the Tangram, novoSpaRc and spaOTsc notebooks in any order
7_data_augmentation Data augmentation generates realistic replicates of ST data Fig. 2, Supplementary Fig. 1, Supplementary Fig. 2 The TESLA output and the hold-out indices of 3_Mouse_10x_Visium CeLEry-data-agumentation.ipynb
8_mouse_single_cell_prediction Application to recover 2D locations for scRNA-seq data in mouse brain None. Fig. 8 uses MERSCOPE and MERFISH references. These scripts use the TESLA output of 3_Mouse_10x_Visium instead Query: Allen Brain Map mouse whole cortex and hippocampus 10x data. Reference: the data of 3_Mouse_10x_Visium preprocessing.py, then Mouse_sc_analysis.py or analysis-results.py, then Mouse_sc_analysis_spaOTsc_novosparc.ipynb

Two Results subsections have no folder. "Overview of CeLEry" presents the workflow of Fig. 1. The code for "Benchmark evaluation for 2D location recovery in mouse brain with MERFISH data as spatial reference" (Fig. 7 and Supplementary Fig. 9) is not in the repository. Despite their names, 4_Mouse_brain_MERFISH and 5_liver_MERFISH hold Vizgen MERSCOPE data.

The tutorial Data augmentation runs the data augmentation of the paper on data that are in the repository.

Running the code

  • The scripts and notebooks were written for the software environment of 2022 to 2023. The notebooks that record a Python version name 3.8 or 3.9. Several files call functions that the current package does not provide: cel.SpaCluster in 1_LIBD, 2_Alzheimer and 8_mouse_single_cell_prediction, cel.DNNordinal_v1 in 2_Alzheimer and cel.DataAugmentation2 in 7_data_augmentation. The notebooks of 3_Mouse_10x_Visium call cel.get_SSIM, which raises a ValueError with current scikit-image releases. RENOVATION_LOG.md describes the known breaks of the package.
  • The paths inside the code are hard-coded and must be edited before a run. They point to the authors' computing cluster, to folders relative to the authors' working directory (such as ../data, ../output, data and output), or to empty strings (os.chdir("") in 6_breast_cancer_10x_Xenium).
  • The code in these folders is not part of the package tests. The tests do not run it, so a change to the package is not checked against it.