spateo.tools.cluster.cluster_spagcn =================================== .. py:module:: spateo.tools.cluster.cluster_spagcn Functions --------- .. autoapisummary:: spateo.tools.cluster.cluster_spagcn.spagcn_vanilla Module Contents --------------- .. py:function:: spagcn_vanilla(adata: anndata.AnnData, spatial_key: str = 'spatial', key_added: Optional[str] = 'spagcn_pred', n_pca_components: Optional[int] = None, e_neigh: int = 10, resolution: float = 0.4, n_clusters: Optional[int] = None, refine_shape: Literal['hexagon', 'square'] = 'hexagon', p: float = 0.5, seed: int = 100, numIterMaxSpa: int = 2000, copy: bool = False) -> Optional[anndata.AnnData] Integrating gene expression and spatial location to identify spatial domains via SpaGCN. Original Code Repository: https://github.com/jianhuupenn/SpaGCN Reference: Jian Hu, Xiangjie Li, Kyle Coleman, Amelia Schroeder, Nan Ma, David J. Irwin, Edward B. Lee, Russell T. Shinohara & Mingyao Li. SpaGCN: Integrating gene expression, spatial location and histology to identify spatial domains and spatially variable genes by graph convolutional network. Nature Methods volume 18, pages1342–1351 (2021) :param adata: An Anndata object after normalization. :param spatial_key: the key in `.obsm` that corresponds to the spatial coordinate of each bucket. :param key_added: adata.obs key under which to add the cluster labels. The initial clustering results of SpaGCN are under `key_added`, and the refined clustering results are under `f'{key_added}_refined'`. :param n_pca_components: Number of principal components to compute. If `n_pca_components` == None, the value at the inflection point of the PCA curve is automatically calculated as n_comps. :param e_neigh: Number of nearest neighbor in gene expression space. Used in dyn.pp.neighbors(adata, n_neighbors=e_neigh). :param resolution: Resolution in the Louvain clustering method. Used when `n_clusters`==None. :param n_clusters: Number of spatial domains wanted. If `n_clusters` != None, the suitable resolution in the initial Louvain clustering method will be automatically searched based on n_clusters. :param refine_shape: Smooth the spatial domains with given spatial topology, "hexagon" for Visium data, "square" for ST data. Defaults to None. :param p: Percentage of total expression contributed by neighborhoods. :param seed: Global seed for `random`, `torch`, `numpy`. Defaults to 100. :param numIterMaxSpa: SpaGCN maximum number of training iterations. :param copy: Whether to copy `adata` or modify it inplace. :returns: Depending on the parameter `copy`, when True return an updates adata with the field ``adata.obs[key_added]`` and ``adata.obs[f'{key_added}_refined']``, containing the cluster result based on SpaGCN; else inplace update the adata object.