pl.covariate_values

pl.covariate_values(adata, covariate='biology', genes=None, name='spanorm')

log2 fitted mean of one covariate, spots x genes (R normaliseMeanBio/LS/Batch at scale 1).

covariate is "biology", "ls" (library-size effect at the median library size) or "batch". genes is a list of var_names (default all).

Examples

Note

The code below runs when the site is built, on a small pre-fitted subset of HumanDLPFC (301 genes x 4015 spots; spanorm(sample_p=0.05, df_tps=2), spanorm_svg() and spanorm_pca() already applied) that is fitted once per build and loaded as adata. The outputs are those of the code shown.

import spanormpy as sn
# adata: the HumanDLPFC AnnData (raw counts in X, coordinates in obsm["spatial"]),
# already fitted with sn.spanorm(adata, sample_p=0.05, df_tps=2)
vals = sn.pl.covariate_values(adata, covariate="biology", genes=["MOBP", "ACTB"])
vals.shape  # spots x genes
(4015, 2)