Skip to content

Commit 4a5e66a

Browse files
committed
Add cortical layer figures from paper
1 parent 44aa92b commit 4a5e66a

6 files changed

Lines changed: 1056 additions & 1018 deletions

File tree

docs/img/paper_cortical_layers.png

919 KB
Loading
1.3 MB
Loading

docs/lessons/13_machine_learning.html

Lines changed: 1010 additions & 1004 deletions
Large diffs are not rendered by default.

img/paper_cortical_layers.png

919 KB
Loading

img/paper_cortical_markers.png

1.3 MB
Loading

lessons/13_machine_learning.qmd

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,32 @@ When doing XYZ...
5050

5151
## Cortical layer dataset
5252

53-
As an example of a real-world application of machine learning, we will be using a dataset that comes from spatial locations associated with different cortical layers in the human brain. These layers are broken into 6 cortical layers (L1, L2, L3, L4, L5, L6) and 2 white matter layers (WM1 and WM2). Each of these layers has a unique spatial location in the cortex and a unique gene expression profile.
53+
::: columns
5454

55-
Here, we have created an example dataset that is based on the [paper](https://www.biorxiv.org/content/10.64898/2026.01.12.698703v1.full), which used spatial transcriptomics (Visium HD) to profile expression in cortical layers in the human brain across different age groups.
55+
::: {.column width="25%"}
56+
As an example of a real-world application of machine learning, we will be using a dataset that comes from spatial locations associated with different cortical layers in the human brain. These layers are broken into 6 cortical layers (L1, L2, L3, L4, L5, L6) and a white matter layer. Each of these layers has a unique spatial location.
57+
:::
58+
59+
::: column
60+
::: {#fig-cortical_layers_paper .figure}
61+
![](../img/paper_cortical_layers.png){height=50}
62+
63+
Spatial locations of the cortical layers in the human brain. <br>
64+
_Image source: [Rai et al. (2026)](https://www.biorxiv.org/content/10.64898/2026.01.12.698703v1.full)_
65+
:::
66+
:::
67+
:::
5668

69+
Based upon [this dataset](https://www.biorxiv.org/content/10.64898/2026.01.12.698703v1.full), we have generated a synthetic dataset that contains the x and y coordinates of cells in the cortex with cortical layer labels. Additionally, we have included the log-normalized expression values of known marker genes for each cortical layer.
70+
71+
::: {#fig-cortical_marker_genes .figure}
72+
![](../img/paper_cortical_markers.png){width=550}
73+
74+
Example of the spatial expression of known marker genes for each cortical layer. <br>
75+
_Image source: [Rai et al. (2026)](https://www.biorxiv.org/content/10.64898/2026.01.12.698703v1.full)_
76+
:::
77+
78+
**We will be using this synthetic dataset to train a random forest classifier to predict the cortical layer labels based on the spatial location and gene expression of each cell.**
5779

5880
The dataset contains spatial coordinates of cells in the cortex, as well as the cortical layer that each cell belongs to.
5981

@@ -105,20 +127,30 @@ In the dataframe, you have have noted that we also have columns: `AQP4`, `HPCAL1
105127
```{python}
106128
#| label: fig-cortical_marker_genes
107129
#| fig-cap: Spatial plot of the gene expression of known marker genes for each cortical layer.
108-
# Marker genes for each cortical layer
109-
genes = ["AQP4", "HPCAL1", "FREM3",
130+
# List of marker genes to plot
131+
genes = ["AQP4", "HPCAL1", "FREM3",
110132
"TRABD2A", "KRT17", "MOBP"]
111133
112-
# Plot the expression of each marker gene across the cortex
113-
for gene in genes:
114-
plt.figure(figsize=(6, 4))
115-
sns.scatterplot(data=df_cortical,
116-
x="x", y="y",
117-
hue=gene,
118-
palette="viridis",
119-
edgecolor=None)
120-
plt.title(f"Expression of {gene} across the cortex")
121-
plt.show()
134+
# Initialize a plot with rows and columns for each gene
135+
fig, axes = plt.subplots(2, 3, figsize=(15, 8))
136+
137+
# Make axes a flat list so we can index easily
138+
axes = axes.flatten()
139+
140+
for i, gene in enumerate(genes):
141+
ax = axes[i]
142+
sns.scatterplot(
143+
data=df_cortical,
144+
x="x", y="y",
145+
hue=gene,
146+
palette="viridis",
147+
edgecolor=None,
148+
ax=ax
149+
)
150+
ax.set_title(f"Expression of {gene} across the cortex")
151+
152+
plt.tight_layout()
153+
plt.show()
122154
```
123155

124156
## Random forest classifiers

0 commit comments

Comments
 (0)