spase | R Documentation |
This function fits a spatial beta-binomial model, estimates a 2D smoothed probability function, and stores information for plotting results. Uses a likelihood ratio test to test for a significant spatial fit over optional baseline covariates such as cell type.
spase(
matrix1,
matrix2,
covariates,
method = "betabinomial",
df = 5,
genes = NULL,
min.pixels = 100,
min.pixels.per.factor = 15,
min.umi = 500,
cores = 1,
verbose = F
)
matrix1 |
matrix or sparseMatrix of allele counts for allele to be modeled. Row names should be genes and column names should be pixel IDs. |
matrix2 |
matrix or sparseMatrix of allele counts for second allele. |
covariates |
data frame that matches pixel IDs to spatial coordinates and other covariates. First column assumed to be pixel IDs, next two columns assumed to be x,y coordinates. Any additional columns assumed to be covariates that will be included in the baseline model. |
method |
string specifying which method to use. Default is 'betabinomial'. Other options are 'quasibinomial' and 'apeglm'. |
df |
integer, sets the number of degrees of freedom to use for the smoothing spline. Default is 5. Usually want to increase this or test multiple. |
genes |
optional vector of genes to run on. Good for testing things out. |
min.pixels |
integer specifying the minimum number of pixels a gene should be present on to fit. Default is 100. |
min.pixels.per.factor |
integer specifying the minimum number of pixels a gene should be present on if there are factor covariates e.g. cell type. For example, the default of 15 requires that at least 15 pixels are that cell type, otherwise that cell type will not be included in the model for that gene. |
min.umi |
integer specifying the minimum number of UMI a gene should have to fit. Default is 500. |
cores |
number of cores to use for parallelization. Default is 1. |
verbose |
whether or not to print a lot of status messages. Default is FALSE. |
Fits a beta-binomial thin plate regression spline for each gene.
If method is betabinomial or quasibinomial, a list containing the following output:
results
a data frame containing a summary of
the results including p-values and q-values for goodness of spatial fit over
baseline covariates provided
fits
a list of beta-binomial model fit objects for each gene
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.