knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

Cell type-specific inference of differential expression for spatial transcriptomics

Here, we will explain how the analysis occurred for our paper 'Cell type-specific inference of differential expression in spatial transcriptomics', which introduces and validates the Cell type-Specific Inference of Differential Expression (C-SIDE) method for detecting cell type-specific differential expression in spatial transcriptomics. You may access C-SIDE within our open-source R package here.

Obtaining Data

The data generated and/or used in this study may be accessed at the Broad Institute's Single Cell Portal. This repository contains both the Slide-seq datasets used in this study, and the single-cell RNA-sequencing references.

DE Simulation

Using the helper functions in de_simulation_helper.R, code and results of C-SIDE on simulated data is shown in Figure 2 below.

Cerebellum Slide-seq

The script cer_reps.R pre-processes the cerebellum Slide-seq data including cropping ROIs and creating SpatialRNA objects. This script also runs RCTD on our three cerebellum replicates.

The scripts run_de_cer_08.R, run_de_cer_09.R, and run_de_cer_11.R run C-SIDE on the three Slide-seq replicates. Merging multiple replicates uses functions from merge_de_helper.R. The script hcr.R quantitatively processes the HCR data. Results are shown in Figure 3 below.

Testes Slide-seq

The script run_RCTD_testes.R loads in the testes data and runs RCTD. Next, C-SIDE is run using the script run_de_testes.R. For downstream testes analysis (results in Figure 4 - Testes below), helper functions are used from testes_helper.R.

J20 Hippocampus Slide-seq

The file preprocess_j20.R preprocesses the Slide-seq data including cropping ROI. Next, RCTD is run using the scripts run_RCTD_j20_21.R, run_RCTD_j20_22.R, run_RCTD_j20_23.R, and run_RCTD_j20_24.R.

In the following analysis, helper functions from alzheimers_helper.R are used.

In order to create the C-SIDE predictive variable, we must next align the amyloid plaque antibody stains to the Slide-seq data. To do this, align_plaque_density.R aligns the images (manually) using the DAPI channel to the Slide-seq data. Next, the script created_pd.R creates and saves smoothed versions of the plaque images. Finally, pd_to_exvar.R calculates the plaque density predictive variable at each Slide-seq pixel.

After generating the predictive variable, we run C-SIDE on the four samples using the scripts run_CSIDE_j20_21.R, run_CSIDE_j20_22.R, run_CSIDE_j20_23.R, and run_CSIDE_j20_24.R. Overall results are shown in Figure 4 - J20 below, which uses helper functinos from merge_de_helper.R.

MERFISH Hypothalamus Slide-seq

The script run_de_merfish.R runs C-SIDE (including RCTD) on the MERFISH hypothalamus data for both linear and quadratic models. Results and other analysis are shown in Figure 4 - MERFISH below.

KP Tumor Slide-seq

The script overlay.R generates a plot of the KP tumor H&E annotations.

The script run_de_tumor.R runs C-SIDE (including RCTD) on the Slide-seq KP tumor data for the parametric case (DE as a function of immune cell density). Results and other analysis are shown in Figure 5 - parametric below.

The script run_de_nonparametric.R runs C-SIDE nonparametrically on the tumor data. Results and other analysis are shown in Figure 5 - nonparametric below.

Running C-SIDE

For each dataset, RCTD and C-SIDE were run according to the instructions for the spacexr package.

Generating Main Figures

We provide R Markdown files that were used to create the main figures:

Supplementary Figures

R Markdown code for generating supplemental figures can be found at:

C-SIDE Results

A list of significant genes found by C-SIDE on all datasets (for each cell type) can be found at C-SIDE results



dmcable/RCTD documentation built on Feb. 24, 2024, 11:03 p.m.