squidpy.gr.sepal
- squidpy.gr.sepal(adata, max_neighs, genes=None, n_iter=30000, dt=0.001, thresh=1e-08, connectivity_key='spatial_connectivities', spatial_key='spatial', layer=None, use_raw=False, copy=False, n_jobs=None, backend='loky', show_progress_bar=True)[source]
Identify spatially variable genes with Sepal.
Sepal is a method that simulates a diffusion process to quantify spatial structure in tissue. See [Anderson and Lundeberg, 2021] for reference.
- Parameters
adata (
AnnData
|SpatialData
) – Annotated data object.max_neighs (
Literal
[4
,6
]) –Maximum number of neighbors of a node in the graph. Valid options are:
4 - for a square-grid (ST, Dbit-seq).
6 - for a hexagonal-grid (Visium).
genes (
Union
[str
,Sequence
[str
],None
]) –List of gene names, as stored in
anndata.AnnData.var_names
, used to compute sepal score.If None, it’s computed
anndata.AnnData.var
['highly_variable']
, if present. Otherwise, it’s computed for all genes.n_iter (
Optional
[int
]) – Maximum number of iterations for the diffusion simulation. Ifn_iter
iterations are reached, the simulation will terminate even though convergence has not been achieved.dt (
float
) – Time step in diffusion simulation.thresh (
float
) – Entropy threshold for convergence of diffusion simulation.connectivity_key (
str
) – Key inanndata.AnnData.obsp
where spatial connectivities are stored. Default is:anndata.AnnData.obsp
['spatial_connectivities']
.spatial_key (
str
) – Key inanndata.AnnData.obsm
where spatial coordinates are stored.layer (
Optional
[str
]) – Layer inanndata.AnnData.layers
to use. If None, useanndata.AnnData.X
.use_raw (
bool
) – Whether to accessanndata.AnnData.raw
.copy (
bool
) – IfTrue
, return the result, otherwise save it to theadata
object.backend (
str
) – Parallelization backend to use. Seejoblib.Parallel
for available options.show_progress_bar (
bool
) – Whether to show the progress bar or not.
- Return type
- Returns
: If
copy = True
, returns apandas.DataFrame
with the sepal scores.Otherwise, modifies the
adata
with the following key:anndata.AnnData.uns
['sepal_score']
- the sepal scores.
Notes
If some genes in
anndata.AnnData.uns
['sepal_score']
are NaN, consider re-running the function with increasedn_iter
.