> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mantlebio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Visualizing results from Visium spatial transcriptomics with Scanpy on Mantle

The [10x `spaceranger count` pipeline](/workflows/visium_spatial_transcriptomics_processing) produces feature-barcode matrices as well as performing dimensionality reduction, clustering, and differential gene expression analysis. The results directory of the pipeline can be stored in your Mantle Database using the `spaceranger-count-outputs` data type.

In this notebook, we use Scanpy to take a closer look at some of the results. The Visium data were originally from:

* Sudmeier, et al. (2022) “Distinct phenotypic states and spatial distribution of CD8+ T cell clonotypes in human brain metastases.” Cell Reports Medicine, 3(5), 100620

Using Scanpy, we read the Visium data into AnnData format and annotate it with the UMAP and graph-based clustering results. Then, we filter and normalize.

We then use Scanpy to visualize gene counts in spatial coordinates and visualize clustering in UMAP and spatial coordianates.

<Frame>
  <img src="https://mintcdn.com/mantlebio/mJz8BnqgDQJVjlq8/workflows/assets/scanpy_spatial_gene_distribution.png?fit=max&auto=format&n=mJz8BnqgDQJVjlq8&q=85&s=379067c9ce92e671d4e14e4c6048ef88" width="2378" height="1017" data-path="workflows/assets/scanpy_spatial_gene_distribution.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/mantlebio/mJz8BnqgDQJVjlq8/workflows/assets/scanpy_visium_umap.png?fit=max&auto=format&n=mJz8BnqgDQJVjlq8&q=85&s=11a34601d1e39461850741e7eb2c61bb" width="1149" height="1079" data-path="workflows/assets/scanpy_visium_umap.png" />
</Frame>

<Frame>
  <img src="https://mintcdn.com/mantlebio/mJz8BnqgDQJVjlq8/workflows/assets/scanpy_visium_spatial_clustering.png?fit=max&auto=format&n=mJz8BnqgDQJVjlq8&q=85&s=73759ac3a74909e31784f64dfe1c688f" width="1286" height="713" data-path="workflows/assets/scanpy_visium_spatial_clustering.png" />
</Frame>

Spaceranger Count also performs gene expression. We annotate our Visium results with the top genes and then use Scanpy to plot the spatial distribution of top genes for one of the clusters.

<Frame>
  <img src="https://mintcdn.com/mantlebio/mJz8BnqgDQJVjlq8/workflows/assets/scanpy_visium_top_genes_by_cluster.png?fit=max&auto=format&n=mJz8BnqgDQJVjlq8&q=85&s=a91a11bde59f23b0a53dc9b0ef3b5c0a" width="4630" height="2148" data-path="workflows/assets/scanpy_visium_top_genes_by_cluster.png" />
</Frame>

Additionally, we use Scanpy to rank the genes for each cluster and plot a heatmap.

<Frame>
  <img src="https://mintcdn.com/mantlebio/mJz8BnqgDQJVjlq8/workflows/assets/scanpy_visium_heatmap.png?fit=max&auto=format&n=mJz8BnqgDQJVjlq8&q=85&s=c82b8299d59311ae655a1922512bf2a9" width="2908" height="966" data-path="workflows/assets/scanpy_visium_heatmap.png" />
</Frame>

Finally, we also use Squidpy to perform spatial statistics.

<Frame>
  <img src="https://mintcdn.com/mantlebio/mJz8BnqgDQJVjlq8/workflows/assets/squidpy_neighborhood.png?fit=max&auto=format&n=mJz8BnqgDQJVjlq8&q=85&s=adba0a86d32791b3b22580a02699092b" width="849" height="690" data-path="workflows/assets/squidpy_neighborhood.png" />
</Frame>
