Test niche-dependent differential expression (R testSpiDE).
Always runs the pooled test: for every (gene, index cell type, niche cell type), whether the gene’s expression in the index type changes with the density of the niche type, within patients, consistently across patients. If a condition is given (here, or recorded by fit_spide), it also runs the condition-specific test: whether that slope differs between the two conditions, a between-patient contrast of within-patient slopes.
The condition test is carried out within a family of triplets chosen without looking at the condition, so the choice is exact under any relabelling of patients:
"pooled_or_heterogeneity" (the slopes engine’s default): the triplets that pass either filter below.
"heterogeneity": the triplets whose slopes vary between patients more than their sampling variances allow (Cochran’s Q; Benjamini-Hochberg over every triplet at fdr).
"filtered" (the sandwich engine’s default): the triplets whose pooled test passes at fdr.
"all": every triplet.
The heterogeneity filters need each patient’s slopes, so they are the slopes engine’s only.
Parameters
Name
Type
Description
Default
fit
SpiDEFit
A fit from fit_spide.
required
condition
str
Default: the condition recorded by the fit, if any. Otherwise a two-level, patient-level column of fit.patients. With the sandwich engine it must be the condition the model was fitted with. The contrast is second level minus first.