Python reference

Pipeline

Build niches, fit, test; spide() chains the three.

build_niches Build niche covariate matrices (R buildNiches).
merge_niches Merge niche cell-type columns into groups by summing them (R mergeNiches).
fit_spide Fit spiDE’s per-patient niche models (R fitSpiDE).
test_spide Test niche-dependent differential expression (R testSpiDE).
spide Run spiDE end to end (R spiDE).

Results and per-patient estimates

results Extract spiDE’s test results (R results); see SpiDEResults.results.
patient_slopes Each patient’s niche slopes in long form (R patientSlopes).
patient_intercepts Each patient’s intercept per gene and index type, in long form (R patientIntercepts).
SpiDEFit The fitted per-patient niche models of spiDE, returned by spidepy.fit_spide.
SpiDEResults The results of spiDE’s niche tests, returned by spidepy.test_spide and

Plotting

matplotlib figures; each returns a Figure.

pl.plot_niche_map The niche covariate in tissue (R plotNicheMap).
pl.plot_niche_response Expression against niche density: the cells behind a slope (R plotNicheResponse).
pl.plot_patient_slopes Each patient’s niche slope for a triplet (R plotPatientSlopes).
pl.plot_patient_effects What the patient intercepts, or slopes, capture (R plotPatientEffects).
pl.plot_call_map Where the calls are (R plotCallMap).
pl.plot_top_triplets The strongest triplets, or those of chosen genes (R plotTopTriplets).
pl.plot_spillover Are the calls the niche type’s own markers? (R plotSpillover).
pl.plot_triplet_heatmap Niche-response profiles of genes or gene sets (R plotTripletHeatmap).
pl.plot_p_values p-values by test and expression band (R plotPValues).
pl.spide_colours The spiDE colours (R spiDEColours).
pl.style A matplotlib style context approximating theme_spiDE (R theme_spiDE).

Data

The shipped example and synthetic data generators.

datasets.toy_spide A small synthetic spatial data set for spiDE examples (R toySpiDE).
datasets.simulate_toy Small synthetic spatial data set with a planted neighbourhood-dependent effect.
datasets.simulate_niche Synthetic spatial data set with a condition-free neighbourhood effect.
datasets.simulate_clustered Synthetic null with patient-level clustering.