Skip to content

Commit

Permalink
change titles to vizgen tutorial (#133)
Browse files Browse the repository at this point in the history
* update

* update

* change title

* change titles in vizgen mouse tutorial

* update
  • Loading branch information
giovp authored Sep 2, 2024
1 parent d929f0a commit 45e3585
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 38 deletions.
13 changes: 4 additions & 9 deletions tutorials/tutorial_napari.ipynb
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Interactive visualization with Napari\n",
"\n",
"```{warning} \n",
"\n",
"🚨🚨🚨\n",
Expand All @@ -18,15 +21,7 @@
"\n",
"🚨🚨🚨\n",
"\n",
"```"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# Interactive visualization with Napari\n",
"```\n",
"\n",
"This tutorial shows how to visualize the `squidpy.im.ImageContainer` and AnnData in Napari.\n",
"\n",
Expand Down
58 changes: 29 additions & 29 deletions tutorials/tutorial_vizgen_mouse_liver.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"id": "qUr2MzGIJRo6"
},
"source": [
"# Single-Cell Clustering of Vizgen MERFISH Mouse Liver Data\n",
"## Obtain Data from Vizgen \n",
"## Single-Cell Clustering of Vizgen MERFISH Mouse Liver Data\n",
"### Obtain Data from Vizgen \n",
"We will use the Liver1Slice1 dataset from Vizgen's MERFISH Mouse Liver Map: https://info.vizgen.com/mouse-liver-access. In order to run this tutorial we will download the `cell_by_gene.csv` and `meta_cell.csv`. Please follow the instructions to obtain access to the showcase data and download the data - here we save the data to a directory called `tutorial_data/` in the same directory as this notebook."
]
},
Expand All @@ -73,7 +73,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Load MERFISH Data into AnnData Object\n",
"### Load MERFISH Data into AnnData Object\n",
"First, we load the cell-by-gene and cell-metadata CSVs and construct an AnnData object `adata`."
]
},
Expand Down Expand Up @@ -159,7 +159,7 @@
"id": "bZgVMF1jJVJ6"
},
"source": [
"## Data Pre-processing\n",
"### Data Pre-processing\n",
"Here we use Scanpy total-count normalize, logarithmize, and scale gene expression to unit variance (clipping values that exceed 10 standard deviations)."
]
},
Expand Down Expand Up @@ -201,7 +201,7 @@
"id": "ULJY43scJYM-"
},
"source": [
"## Dimensionality Reduction, Neighbor Calculation, and Clustering\n",
"### Dimensionality Reduction, Neighbor Calculation, and Clustering\n",
"\n",
"Here we use Scanpy to: reduce the dimensionality of our data by running principal component analysis (PCA), calculate the neighborhood graph of cells in PCA space, display cells in a two-dimensional UMAP embedding, and finally identify clusters of cells using Leiden clustering."
]
Expand Down Expand Up @@ -248,7 +248,7 @@
"id": "0jmKBdE1Jbcx"
},
"source": [
"## UMAP with Leiden Clustering Labels\n",
"### UMAP with Leiden Clustering Labels\n",
"Here we visualize the distributions of the Leiden clusters in the UMAP plot. We see Leiden clusters tend to segregate into distinct regions within the UMAP plot."
]
},
Expand Down Expand Up @@ -292,7 +292,7 @@
"id": "sXVS4xpdJ95_"
},
"source": [
"## Spatial Distributions of Cells\n",
"### Spatial Distributions of Cells\n",
"Here we visualize the spatial locations of cells in the mouse liver colored by Leiden cluster. We observe distinct spatial localizations of Leiden clusters throughout the tissue. We see some clusters line blood vessels and while others form concentric patterns reflecting hepatic zonation ([Cunningham et. al. 2021](https://www.frontiersin.org/articles/10.3389/fphys.2021.732929/full)). Our next step is to assign tentative cell type to our Leiden clusters and assess their spatial localizations in the liver."
]
},
Expand Down Expand Up @@ -334,8 +334,8 @@
"id": "zEKpQM5cMLAL"
},
"source": [
"# Assign Cell Types\n",
"## Reference Cell Type Marker Gene Sets\n",
"## Assign Cell Types\n",
"### Reference Cell Type Marker Gene Sets\n",
"\n",
"In order to tentatively assign liver cell types we utilize a gene-level cell type marker reference from the publication [Spatial transcriptome profiling by MERFISH reveals fetal liver hematopoietic stem cell niche architecture](https://www.nature.com/articles/s41421-021-00266-1). These marker genes will be used to assess cell type composition of the Leiden clusters. See MERFISH gene panel metadata: https://www.nature.com/articles/s41421-021-00266-1."
]
Expand Down Expand Up @@ -409,7 +409,7 @@
"id": "kUA-OtoyZyWY"
},
"source": [
"## Calculate Leiden Cluster Average Expression Signatures\n",
"### Calculate Leiden Cluster Average Expression Signatures\n",
"Here we calculate the average gene expression signatures of the Leiden clusters, which will be used to assign cell type composition."
]
},
Expand Down Expand Up @@ -452,7 +452,7 @@
"id": "Ks07tULYZ0h_"
},
"source": [
"## Assign Cell Type Based on Top Expressed Marker Genes\n",
"### Assign Cell Type Based on Top Expressed Marker Genes\n",
"Here we assign cell type composition to the Leiden clusters by counting the frequency of cell type marker genes in the top 30 most up-regulated genes for each cluster such that cell type is assigned based on the most frequently occuring marker genes. If there is a tie in the number of marker genes, we assign the cluster to more than one cell type. Using this approach eleven Leiden clusters are assigned to be Hepatocyte containing clusters."
]
},
Expand Down Expand Up @@ -559,10 +559,10 @@
"id": "54IRIGvcYHL-"
},
"source": [
"# Hepatocyte Zonation\n",
"## Hepatocyte Zonation\n",
"Hepatocytes are the most abundant cell in the liver and have multiple roles in metabolism, endocrine production, protein synthesis, and detoxification. Hepatocytes form complex, radial structures called lobules that contain a central vein (with low blood oxygen level) surrounded by peripheral portal veins (with high blood oxygen level). Hepatocytes can also be broadly classified as peri-central or peri-portal based on their proximity to central and portal veins, respectively. \n",
"\n",
"## Central and Portal Blood Vessels\n",
"### Central and Portal Blood Vessels\n",
"We can use the gene Vwf to identify endothelial cells ([Horvath et. al. 2004](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2716260/)) that line liver blood vessels. Plotting Vwf expression level in single cells (below) shows clear enrichment at blood vessel borders. Note that Vwf expression can also be used to distinguish artifactual holes/tears in the liver from blood vessels.\n",
"\n",
"Next, we use the expression of Axin2 to mark peri-central regions ([Sun et. al. 2020](https://pubmed.ncbi.nlm.nih.gov/31866224/)). Plotting Axin2 expression level in single cells shows Axin2 lining a subset of all Vwf positive blood vessels, which allows us to distinguish peri-portal (Axin2 negative) and peri-central (Axin2 positive) blood vessels. Similarly, we can use Axin2 expression to identify peri-central hepatocyte Leiden clusters (see next section)."
Expand Down Expand Up @@ -610,7 +610,7 @@
"id": "SWTiZVflbLT1"
},
"source": [
"## Distinguishing Peri-Portal and Peri-Central Hepatocytes\n",
"### Distinguishing Peri-Portal and Peri-Central Hepatocytes\n",
"As described above, we use the expression of Axin2 as a marker for peri-central hepatocytes ([see Sun et. al.](https://pubmed.ncbi.nlm.nih.gov/31866224/)). "
]
},
Expand Down Expand Up @@ -641,7 +641,7 @@
"id": "Y5JgDCESy7pF"
},
"source": [
"## Peri-Central Hepatocytes\n",
"### Peri-Central Hepatocytes\n",
"Plotting peri-central and peri-portal hepatocytes separately displays their distinct interlocking morphologies with respect to blood vessels."
]
},
Expand Down Expand Up @@ -687,7 +687,7 @@
"id": "lT_wgj83zDW1"
},
"source": [
"## Peri-Portal Hepatocytes"
"### Peri-Portal Hepatocytes"
]
},
{
Expand Down Expand Up @@ -731,7 +731,7 @@
"id": "9N2yAn2QPOWM"
},
"source": [
"# Neighborhood Enrichment\n",
"## Neighborhood Enrichment\n",
"In this section we will use Squidpy to identify clusters that are spatially enriched for one another using a neighborhood enrichment test {func}`squidpy.gr.nhood_enrichment`. This test determines if cells belonging to two different clusters are close to each other more often than expected. \n",
"\n",
"In order to run this test we first have to calculate a connectivity graph using the {func}`squidpy.gr.spatial_neighbors` method. This graph consists of cells (nodes) and cell-cell interactions (edges). \n",
Expand Down Expand Up @@ -824,7 +824,7 @@
"id": "rRjY6OF8b4Cq"
},
"source": [
"## Neighborhood Enrichment Clusters\n",
"### Neighborhood Enrichment Clusters\n",
"Here we visualize clusters from our neighborhood enrichment data obtained by hierarchically clustering the Z-scored neighborhood enrichment scores. We observe a cluster containing three peri-portal hepatocyte leiden clusters (`Hepatocyte_Leiden-0`, `Hepatocyte_Leiden-4`, and `Hepatocyte_Leiden-6`\n",
") and a large cluster containing several peri-central hepatocytes (`Hepatocyte_Leiden-1`, `Hepatocyte_Leiden-2`, `Hepatocyte_Leiden-25`). This demonstrates that we can recapitulate known spatial enrichment of peri-portal and peri-central hepatocytes using neighborhood enrichment."
]
Expand Down Expand Up @@ -940,7 +940,7 @@
"id": "ClA5iBsJ5lch"
},
"source": [
"# Network Centrality Scores\n",
"## Network Centrality Scores\n",
"In addition to neighborhood enrichment we can also calculate network-based centrality scores for the Leiden clusters. These include \n",
"\n",
"* closeness centrality: how close a group is to other nodes\n",
Expand Down Expand Up @@ -989,7 +989,7 @@
"id": "13-K7qrS8fa8"
},
"source": [
"## High Closeness Score\n",
"### High Closeness Score\n",
"Groups/clusters with high closeness are close to other groups and will tend to display a dispersed distribution throughout the tissue. Three of the top five clusters based on the closeness score are epithelial cells (SEC: sinusoidal epithelial cells, AEC: arterial epithelial cells) and one cluster consists of macrophages. We see that these groups are indeed evenly distributed across the tissue which results in them being relatively close to many other groups."
]
},
Expand Down Expand Up @@ -1043,7 +1043,7 @@
"id": "XmpHM5Vw-sSG"
},
"source": [
"## Low Closeness Score\n",
"### Low Closeness Score\n",
"Groups with low closeness are not close to other groups and tend to display an uneven and isolated distribution throughout the tissue. We see that clusters with low closeness scores tend to be located near blood vessels and consist of megakaryocyte, neutrophil, and erythroid cells. Their distinct localization and proximity to blood vessel (e.g., only neighboring cells on one side while the other side faces the blood vessel) contributes to their low level of interactions with other clusters."
]
},
Expand Down Expand Up @@ -1097,7 +1097,7 @@
"id": "rfLQy729Ao0w"
},
"source": [
"## High Degree Centrality\n",
"### High Degree Centrality\n",
"Similarly to the results from the closeness scores we observed above, we see that the SEC and Macrophage clusters (`Leiden-3`, `Leiden-5`, and `Leiden-8`) have high degree centrality scores indicating that they have a high fraction of non-group member connections. We also note that these clusters tend to be more evenly distributed throughout the tissue."
]
},
Expand Down Expand Up @@ -1151,7 +1151,7 @@
"id": "-xhZlODFAq3f"
},
"source": [
"## Low Degree Centrality\n",
"### Low Degree Centrality\n",
"These cluster have particularly low non-group member connections and similarly to the results from the closeness score we see that these clusters tend to be near blood vessels. We also note that more of the clusters tend to be lower abundance clusters (Leiden cluster numbers are ranked by abundance).\n"
]
},
Expand Down Expand Up @@ -1205,7 +1205,7 @@
"id": "jMT5t7g4AyWt"
},
"source": [
"## High Clustering Coefficient\n",
"### High Clustering Coefficient\n",
"The clustering coefficient indicates the degree to which nodes cluster together. We see that the top scoring clusters tend to be located near blood vessels. This distribution is somewhat counter-intuitive since one might expect that well segregated cells would form dense blobs rather than thin lines. However, their position along the edge of of blood vessels likely reduces the total number of neighbors each cell has since they are positioned at the border of a hole in the tissue."
]
},
Expand Down Expand Up @@ -1259,7 +1259,7 @@
"id": "Jmx0tNjsA2GO"
},
"source": [
"## Low Clustering Coefficient\n",
"### Low Clustering Coefficient\n",
"Again, we see that non-isolated groups tend to be more evenly distributed throughout the tissue. Interestingly, these clusters mostly consist of hepatocytes. "
]
},
Expand Down Expand Up @@ -1313,7 +1313,7 @@
"id": "EO5exVC6eAFh"
},
"source": [
"# Autocorrelation: Moran's I Score \n",
"## Autocorrelation: Moran's I Score \n",
"Our previous focus has been mainly on the distribution of cell clusters throughout the tissue. However we can also use Squidpy to investigate the spatial distributions of genes expressed in the tissue. \n",
"\n",
"Here we use Squidpy to calculate the Moran's I global spatial auto-correlation statistic, which can be used to identify genes that are non-randomly distributed in the tissue. We will visualize the top and bottom 20 scoring genes to highlight specific examples of genes with high and low auto-correlation. "
Expand Down Expand Up @@ -1349,7 +1349,7 @@
"id": "mkKAGYsUeFvO"
},
"source": [
"## Genes with high spatial autocorrelation\n",
"### Genes with high spatial autocorrelation\n",
"We note that many of the top scoring genes show expression patterns following the spatial pattern of hepatocyte Leiden clusters (e.g. Aldh1b1, Aldh3a20) and blood vessels (e.g. Dpt, Sfrp1). We can also check which cell types are most associated with these highly auto-correlated genes by ranking cell clusters based on their expression of these genes (e.g. mean expression). Below we see that three of the top five cell clusters are hepatocytes, which agrees with the gene's localization patterns. These results indicate the primary spatial patterns in gene expression auto-correlation are being driven by their expression in hepatocytes and blood vessel associated cell types."
]
},
Expand Down Expand Up @@ -1429,7 +1429,7 @@
"id": "ujI1I4T7eIYQ"
},
"source": [
"## Genes with low autocorrelation\n",
"### Genes with low autocorrelation\n",
"Genes with low auto-correlation show more evenly distributed expression patterns that do not follow hepatic zonation."
]
},
Expand Down Expand Up @@ -1509,7 +1509,7 @@
"id": "ysaw2PLEFpQ9"
},
"source": [
"# Conclusion\n",
"## Conclusion\n",
"This tutorial shows how we can use Squidpy and Scanpy to explore the spatial distribution of single-cells and gene expression in mouse liver tissue from Vizgen's MERFISH Mouse Liver Map. One of the main highlights is the intricate hepatic zonation patterns and their relationship to portal/central veins in the mouse liver."
]
},
Expand Down

0 comments on commit 45e3585

Please sign in to comment.