MorphoGAM: Apply a GAM to the morphologically relevant coordinates
MorphoGAM.RdThe morphologically relevant coordinates can be estimated using `CurveFinder()` or `CurveFinderInteractive()`. This function applies a flexible count-based model to identify genes with spatially variable expression with respect to the morphologically relevant coordinates.
Estimate the distance between condition means in gene expression space.
DESCRIPTION
Usage
MorphoGAM(
Y,
curve.fit,
design,
shrinkage = FALSE,
min.count.per.gene = 10,
return.fx = TRUE,
offset = NULL,
knots.t = NULL,
knots.r = NULL
)Arguments
- Y
A numeric matrix where rows represent genes and columns represent samples (e.g., cells).
- curve.fit
An object produced by `CurveFinder`, containing the fitted curve parameters (`t` and `r`) for each sample.
- design
A formula specifying the GAM design, typically including smooth terms for `t` and `r` (e.g., `y ~ s(t) + s(r)`).
- shrinkage
A logical value indicating whether to apply shrinkage to smooth term coefficients using `ashr`. Default is `TRUE`.
- min.count.per.gene
An integer specifying the minimum total count required for a gene to be included in the analysis. Default is 10.
- return.fx
A logical value indicating whether to return the fitted smooth terms for `t` and `r` for each gene. Default is `TRUE`.
- offset
A numeric vector providing offset values for the GAM model. If `NULL` (default), offsets are computed as the logarithm of the column sums of `Y`.
- knots.t
Optional numeric vector specifying knot locations for the smooth term in `t`.
- knots.r
Optional numeric vector specifying knot locations for the smooth term in `r`.
Value
A list containing:
- results
A data frame with rows corresponding to genes and the following columns:
- peak.t
Maximum absolute smooth term for `t`.
- range.t
Range of predicted expression values along `t`.
- pv.t
p-value for the smooth term `t`.
- peak.r
Maximum absolute smooth term for `r`.
- range.r
Range of predicted expression values along `r`.
- pv.r
p-value for the smooth term `r`.
- intercept
Intercept of the fitted model.
If `return.fx = TRUE`, the list also includes:
- fxs.t
A matrix of fitted smooth terms for `t` (genes x samples).
- fxs.r
A matrix of fitted smooth terms for `r` (genes x samples).