Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions vignettes/Session_1_sequencing_assays.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Spatial transcriptomics data requires specialized visualization approaches to un
imgData(spatial_data)

# Simple visualization of spatial data
ggspavis::plotSpots(spatial_data) +
ggspavis::plotCoords(spatial_data) +
facet_wrap(~sample_id)

```
Expand All @@ -286,7 +286,7 @@ We can enhance our understanding by adding layer annotations. In this dataset, l

```{r, fig.width=6, fig.height=6}
# Plot spots with anatomical annotations
ggspavis::plotSpots(
ggspavis::plotCoords(
spatial_data,
annotate = "spatialLIBD"
) +
Expand Down Expand Up @@ -370,7 +370,7 @@ After applying the QC metrics, it's crucial to visually assess their impact. Thi
colData(spatial_data)$qc_mitochondrial_transcription <- qc_mitochondrial_transcription

## Visualize spatial pattern of filtered spots
plotSpotQC(
plotObsQC(
spatial_data,
plot_type = "spot",
annotate = "qc_mitochondrial_transcription"
Expand Down Expand Up @@ -412,7 +412,7 @@ Incorporating Library Size Threshold in Dataset: This step involves adding the l
colData(spatial_data)$qc_total_counts <- qc_total_counts

## Check for putative spatial pattern of removed spots
plotSpotQC(
plotObsQC(
spatial_data,
plot_type = "spot",
annotate = "qc_total_counts",
Expand Down Expand Up @@ -455,7 +455,7 @@ Incorporating Gene Expression Threshold in Dataset: After setting the gene expre
colData(spatial_data)$qc_detected_genes <- qc_detected_genes

## Check for putative spatial pattern of removed spots
plotSpotQC(
plotObsQC(
spatial_data,
plot_type = "spot",
annotate = "qc_detected_genes",
Expand Down Expand Up @@ -488,7 +488,7 @@ After applying all QC filters, this block combines them and stores the results i
colData(spatial_data)$discard <- qc_total_counts | qc_detected_genes | qc_mitochondrial_transcription

## Check the spatial pattern of combined set of discarded spots
plotSpotQC(
plotObsQC(
spatial_data,
plot_type = "spot",
annotate = "discard",
Expand Down Expand Up @@ -628,7 +628,7 @@ Those two clusters group the white matter from the rest of the layers.

```{r, fig.width=6, fig.height=6}
## Plot in tissue map
ggspavis::plotSpots(spatial_data, annotate = "label") +
ggspavis::plotCoords(spatial_data, annotate = "label") +
facet_wrap(~sample_id) +
scale_color_brewer(palette = "Paired")
```
Expand All @@ -637,7 +637,7 @@ As for comparison, we show the manually annotated regions. We can see that while

```{r, fig.width=6, fig.height=6}
## Plot ground truth in tissue map
ggspavis::plotSpots(spatial_data, annotate = "spatialLIBD") +
ggspavis::plotCoords(spatial_data, annotate = "spatialLIBD") +
facet_wrap(~sample_id) +
scale_color_manual(values = libd_layer_colors)

Expand Down Expand Up @@ -811,7 +811,7 @@ pal <- c(
"#f39c12", "#d35400", "#7f8c8d", "#2ecc71", "#e67e22"
)

ggspavis::plotSpots(
ggspavis::plotCoords(
do.call(cbind, spatial_data_list),
annotate = sprintf("%s_smooth", "clust_M0_lam0.2_k50_res0.7"),
pal = pal
Expand All @@ -820,7 +820,7 @@ pal <- c(
theme(legend.position = "none") +
labs(title = "BANKSY clusters")

ggspavis::plotSpots(
ggspavis::plotCoords(
do.call(cbind, spatial_data_list),
annotate = sprintf("%s", "clust_M0_lam0.2_k50_res0.7"),
pal = pal
Expand All @@ -829,7 +829,7 @@ pal <- c(
theme(legend.position = "none") +
labs(title = "BANKSY clusters")

ggspavis::plotSpots(spatial_data, annotate = "spatialLIBD") +
ggspavis::plotCoords(spatial_data, annotate = "spatialLIBD") +
facet_wrap(~sample_id) +
scale_color_manual(values = libd_layer_colors) +
theme(legend.position = "none") +
Expand All @@ -843,7 +843,7 @@ We have applied cluster smoothing using `smoothLabels`. How much do you think th

- Plot the non smoothed cluster
- identify the pixel that have been smoothed, and
- visualise them using `plotSpotQC` that we have used above.
- visualise them using `plotObsQC` that we have used above.
:::

### 8. Deconvolution of pixel-based spatial data
Expand Down Expand Up @@ -1097,7 +1097,7 @@ brain_reference =
get_metadata() |>

# Filter your data of interest
dplyr::filter(tissue_groups=="cerebral lobes and cortical areas", disease == "Normal") |>
dplyr::filter(tissue_groups=="cerebral lobes and cortical areas", disease == "normal") |>

# Collect pseudobulk as SummarizedExperiment
get_pseudobulk() |>
Expand Down
9 changes: 2 additions & 7 deletions vignettes/Session_2_Tidy_spatial_analyses.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,9 @@ spatial_data |> select(.cell, .gated)

```{r, eval=FALSE}
tidygate_env$gates |> saveRDS("<PATH>")
```

```{r}
spatial_data_gated = tidygate_env$gates
```



You can reload a pre-made gate for reproducibility

```{r}
Expand Down Expand Up @@ -759,7 +754,7 @@ Let's visualise the regions that spatialLIBD labelled across three Visium 10X sa

```{r, fig.width=7, fig.height=8}
spatial_data_filtered |>
ggspavis::plotSpots(annotate = "spatialLIBD") +
ggspavis::plotCoords(annotate = "spatialLIBD") +
facet_wrap(~sample_id) +
scale_color_manual(values = libd_layer_colors |> str_remove("ayer")) +
theme(legend.position = "none") +
Expand Down Expand Up @@ -877,7 +872,7 @@ Although amyloid plaques themselves are extracellular, the presence and formatio

- join_features()
- mutate()
- ggspavis::plotSpots()
- ggspavis::plotCoords()
:::

```{r}
Expand Down
4 changes: 2 additions & 2 deletions vignettes/Session_3_imaging_assays.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -591,12 +591,12 @@ Plot ground truth in tissue map.
```{r, fig.width=7, fig.height=8}

tx_spe_sample_1 |>
ggspavis::plotSpots(annotate = "clusters") +
ggspavis::plotCoords(annotate = "clusters") +
guides(color = "none")

# For comparison the annotated regions
tx_spe_sample_1 |>
ggspavis::plotSpots(annotate = "region") +
ggspavis::plotCoords(annotate = "region") +
scale_color_manual(values = colorRampPalette( brewer.pal(9,"Set1") )(150) ) +
guides(color = "none")

Expand Down