rapids_singlecell.gr.sepal#
- rapids_singlecell.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, *, table_key=None, dtype=<class 'numpy.float32'>)[source]#
Identify spatially variable genes with Sepal.
Sepal simulates a diffusion process to quantify spatial structure in tissue [AL21]. This is a GPU port of
squidpy.gr.sepal()that simulates all genes in parallel.- Parameters:
- adata
AnnData|SpatialData Annotated data matrix or a SpatialData object containing the selected table.
- 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
str|Sequence[str] |None(default:None) List of gene names, as stored in
var_names, used to compute sepal score.If
None, it’s computedvar['highly_variable'], if present. Otherwise, it’s computed for all genes.- n_iter
int|None(default:30000) Maximum number of iterations for the diffusion simulation. If
n_iteriterations are reached, the simulation will terminate even though convergence has not been achieved.- dt
float(default:0.001) Time step in diffusion simulation.
- thresh
float(default:1e-08) Entropy threshold for convergence of diffusion simulation.
- connectivity_key
str(default:'spatial_connectivities') Key in
obspwhere the spatial connectivities are stored.- spatial_key
str(default:'spatial') Key in
obsmwhere the spatial coordinates are stored.- layer
str|None(default:None) - use_raw
bool(default:False) Whether to access
raw.- copy
bool(default:False) If
True, return the result, otherwise save it to theadataobject.- table_key
str|None(default:None) Key in
SpatialData.tables; required for SpatialData input. All reads and writes use this table; ignored for AnnData input.- dtype
dtype|type(default:<class 'numpy.float32'>) Precision of the diffusion.
np.float32(default) carries each value as a compensated pair of floats and is fastest on GPUs with low double-precision throughput;np.float64diffuses in double precision, like squidpy. Both accumulate the entropy changes in a cancellation-free float form; on all data we tested, both reproduce squidpy’s scores exactly.
- adata
- Return type:
- Returns:
If
copy = True, returns apandas.DataFramewith the sepal scores.Otherwise, modifies the
adatawith the following key:anndata.AnnData.uns['sepal_score']- the sepal scores.
Notes
If some genes in
anndata.AnnData.uns['sepal_score']areNaN, consider re-running the function with increasedn_iter.