{ "cells": [ { "cell_type": "markdown", "id": "95a3e266-b2ed-4d93-8fd7-ac45643eb267", "metadata": {}, "source": [ "# Identifying Pseudo-Spatial Map\n", "\n", "SpaceFlow is Python package for identifying spatiotemporal patterns and spatial domains from Spatial Transcriptomic (ST) Data. Based on deep graph network, SpaceFlow provides the following functions: \n", "1. Encodes the ST data into **low-dimensional embeddings** that reflecting both expression similarity and the spatial proximity of cells in ST data.\n", "2. Incorporates **spatiotemporal** relationships of cells or spots in ST data through a **pseudo-Spatiotemporal Map (pSM)** derived from the embeddings.\n", "3. Identifies **spatial domains** with spatially-coherent expression patterns.\n", "\n", "Check out [(Ren et al., Nature Communications, 2022)](https://www.nature.com/articles/s41467-022-31739-w) for the detailed methods and applications.\n", "\n", "\n", "\n" ] }, { "cell_type": "code", "execution_count": 1, "id": "f9777588-1a89-48be-b2c1-3817f48b6a42", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", " ____ _ _ __ \n", " / __ \\____ ___ (_)___| | / /__ _____________ \n", " / / / / __ `__ \\/ / ___/ | / / _ \\/ ___/ ___/ _ \\ \n", "/ /_/ / / / / / / / /__ | |/ / __/ / (__ ) __/ \n", "\\____/_/ /_/ /_/_/\\___/ |___/\\___/_/ /____/\\___/ \n", "\n", "Version: 1.6.0, Tutorials: https://omicverse.readthedocs.io/\n" ] } ], "source": [ "import omicverse as ov\n", "#print(f\"omicverse version: {ov.__version__}\")\n", "import scanpy as sc\n", "#print(f\"scanpy version: {sc.__version__}\")\n", "ov.utils.ov_plot_set()" ] }, { "cell_type": "markdown", "id": "7f3aaaf4-7fb0-4210-9e8a-b6467def776b", "metadata": {}, "source": [ "## Preprocess data\n", "\n", "Here we present our re-analysis of 151676 sample of the dorsolateral prefrontal cortex (DLPFC) dataset. Maynard et al. has manually annotated DLPFC layers and white matter (WM) based on the morphological features and gene markers.\n", "\n", "This tutorial demonstrates how to identify spatial domains on 10x Visium data using STAGATE. The processed data are available at https://github.com/LieberInstitute/spatialLIBD. We downloaded the manual annotation from the spatialLIBD package and provided at https://drive.google.com/drive/folders/10lhz5VY7YfvHrtV40MwaqLmWz56U9eBP?usp=sharing." ] }, { "cell_type": "code", "execution_count": 2, "id": "52abfa88-3324-44e5-811c-37e2c87a50cf", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "reading data/151676_filtered_feature_bc_matrix.h5\n", " (0:00:00)\n" ] } ], "source": [ "adata = sc.read_visium(path='data', count_file='151676_filtered_feature_bc_matrix.h5')\n", "adata.var_names_make_unique()" ] }, { "cell_type": "markdown", "id": "b8409fb3-980a-4376-b92c-743c158d2462", "metadata": {}, "source": [ "
Note
\n", "\n", " We introduced the spatial special svg calculation module prost in omicverse versions greater than `1.6.0` to replace scanpy's HVGs, if you want to use scanpy's HVGs you can set mode=`scanpy` in `ov.space.svg` or use the following code.\n", "
\n", "