omicverse.space.GASTON¶
- omicverse.space.GASTON(adata) None[source]¶
GASTON spatial depth estimation and clustering.
GASTON (Geometry And Spatial Transcriptomics-based OrganizatioN) is a method for analyzing spatial transcriptomics data by learning continuous spatial depth functions that capture tissue organization. It uses neural networks to model spatial patterns and identify distinct domains.
The method combines gene expression data with spatial information to: 1. Learn continuous spatial depth functions 2. Identify tissue domains and boundaries 3. Model gene expression patterns along spatial gradients 4. Characterize tissue organization and architecture
- Parameters:
adata (AnnData) – Spatial AnnData containing expression matrix and coordinates in
adata.obsm['spatial'].Attributes –
- adata: AnnData
Input annotated data matrix containing: - Spatial coordinates in adata.obsm[‘spatial’] - Gene expression data in adata.X - Optional histology image in adata.uns[‘spatial’]
- model: GASTON model
Trained neural network model after calling train()
- gaston_isodepth: array
Computed isodepth values after calling cal_iso_depth()
- gaston_labels: array
Domain labels after calling cal_iso_depth()
Examples –
>>> import scanpy as sc >>> import omicverse as ov >>> # Load spatial data >>> adata = sc.read_visium(...) >>> # Initialize GASTON >>> gaston = ov.space.GASTON(adata) >>> # Prepare input data >>> counts, coords, genes = gaston.get_gaston_input() >>> # Get features >>> features = gaston.get_top_pearson_residuals(num_dims=10) >>> # Train model >>> gaston.load_rescale(features) >>> gaston.train(num_epochs=5000) >>> # Get best model >>> model, features, coords = gaston.get_best_model() >>> # Calculate domains >>> isodepth, labels = gaston.cal_iso_depth(num_domains=5)