goatpy.graphpca_mod
gpca_mod_spatial.py
GraphPCA replacement with spatial smoothing using cKDTree.
Functions
|
Build a KNN graph (sparse adjacency) using spatial coordinates. |
|
PCA with optional spatial smoothing. |
|
Perform KMeans clustering on GraphPCA scores stored in adata.obsm. |
Module Contents
- goatpy.graphpca_mod.kneighbors_graph_spatial(coords: numpy.ndarray, n_neighbors: int = 10, include_self: bool = False, mode: str = 'connectivity') scipy.sparse.csr_matrix[source]
Build a KNN graph (sparse adjacency) using spatial coordinates.
- goatpy.graphpca_mod.graphpca_spatialdata(sd, tables: str = 'maldi_adata', library_id: str | None = 'spatial', n_components: int = 50, n_neighbors: int = 10, alpha: float = 0.0, center: bool = True, kneighbors_mode: str = 'connectivity') Tuple[numpy.ndarray, numpy.ndarray | None, scipy.sparse.csr_matrix | None][source]
PCA with optional spatial smoothing.
- Parameters:
- Returns:
components ((n_components, n_features))
scores ((n_samples, n_components))
adjacency (CSR adjacency used for smoothing)