R package for detecting 2D spatial patterns of allele-specific expression in spatial transcriptomics data while controlling for cell type. Provides functions for estimating, plotting, and testing for significant ASE patterns. This repository also contains the code to reproduce the results in the manuscript.
devtools::install_github("lulizou/spASE")
The main input to spASE includes:
Note that spASE currently modifies many functions from the spacexr
package, so it is always good to load them in order so that the spASE
version is used:
library(spacexr)
library(spASE)
Testing for…
bias_results <- scase(
matrix1 = maternal_counts_matrix,
matrix2 = paternal_counts_matrix,
min.cells = 100, # set to something reasonable
cores = 1, # can add more
verbose = T # to enable progress bar
)
Note that this can also be run on a subset of genes by specifying them
as a string vector using the genes = c(...)
argument.
overall_spatial_results <- spase(
matrix1 = maternal_counts_matrix,
matrix2 = paternal_counts_matrix,
covariates = coords,
min.pixels = 100, # set to something reasonable
cores = 1, # can add more
verbose = T # to enable progress bar
)
Note that coords
must have the first column as the pixel ID (matching
the column names of the count matrices) and the second two columns as
the spatial coordinates.
Once you have overall_spatial_results
, we can visualize using the
plotSpase
function as follows:
plotSpase(
matrix1 = maternal_counts_matrix,
matrix2 = paternal_counts_matrix,
covariates = coords,
spasefit = overall_spatial_results,
coords = NULL, # to downsample could set e.g coords = coords |> sample_n(1e4)
)
The data is available in the Broad single cell portal at SCP1692.
To reproduce the results in the manuscript, see the analysis folder. To see the knitted Quarto documents, see:
The (old) pre-print is here.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.