Skip to content

Commit

Permalink
fix dependency and update vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
stemangiola committed May 20, 2024
1 parent 879e671 commit ea6d690
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 27 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ Imports:
tidySummarizedExperiment (>= 1.15.0),
tidyverse,
SPOTlight,
Seurat
Seurat,
ggcorrplot
Suggests:
knitr,
markdown,
Expand Down
54 changes: 28 additions & 26 deletions vignettes/Session_1_sequencing_assays.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ We will use `ggpavis` package to visualise the data.
imgData(spatial_data)
# Simple visualization of spatial data
ggspavis::plotSpots(spatial_data)
ggspavis::plotSpots(spatial_data) +
facet_wrap(~sample_id)
```

Expand All @@ -205,7 +206,8 @@ Layers = L1-6, white matter = WM
ggspavis::plotSpots(
spatial_data,
annotate = "spatialLIBD"
)
) +
facet_wrap(~sample_id)
```

Explore additional visualisation features offered by the Visium platform.
Expand Down Expand Up @@ -280,10 +282,10 @@ After applying the QC metrics, it’s crucial to visually assess their impact. T
colData(spatial_data)$qc_mitochondrial_transcription <- qc_mitochondrial_transcription
## Check for putative spatial pattern of removed spots
plotQC(
plotSpotQC(
spatial_data,
type = "spots",
discard = "qc_mitochondrial_transcription",
plot_type = "spot",
annotate = "qc_mitochondrial_transcription",
) +
facet_wrap(~sample_id)
Expand Down Expand Up @@ -323,10 +325,10 @@ 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
plotQC(
plotSpotQC(
spatial_data,
type = "spots",
discard = "qc_total_counts",
plot_type = "spot",
annotate = "qc_total_counts",
) +
facet_wrap(~sample_id)
Expand Down Expand Up @@ -365,10 +367,10 @@ 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
plotQC(
plotSpotQC(
spatial_data,
type = "spots",
discard = "qc_detected_genes",
plot_type = "spot",
annotate = "qc_detected_genes",
) +
facet_wrap(~sample_id)
Expand Down Expand Up @@ -398,10 +400,10 @@ 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
plotQC(
plotSpotQC(
spatial_data,
type = "spots",
discard = "discard",
plot_type = "spot",
annotate = "discard",
) +
facet_wrap(~sample_id)
Expand Down Expand Up @@ -532,7 +534,8 @@ As for comparison, we show the manually annotated regions. We can see that while
```{r, fig.width=7, fig.height=8}
## Plot ground truth in tissue map
ggspavis::plotSpots(spatial_data, annotate = "spatialLIBD") +
scale_color_manual(values = libd_layer_colors |> str_remove("ayer")) +
facet_wrap(~sample_id) +
scale_color_manual(values = gsub("ayer", "", libd_layer_colors))
```

Expand Down Expand Up @@ -700,7 +703,8 @@ plot_bank_smooth <- lapply(spatial_data_list, function(x) {
plot_grid(plotlist = plot_bank_smooth, ncol = 3, byrow = TRUE)
ggspavis::plotSpots(spatial_data, annotate = "spatialLIBD") +
scale_color_manual(values = libd_layer_colors |> str_remove("ayer")) +
facet_wrap(~sample_id) +
scale_color_manual(values = gsub("ayer", "", libd_layer_colors)) +
theme(legend.position = "none") +
labs(title = "spatialLIBD regions")
```
Expand All @@ -712,15 +716,16 @@ 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 `plotQC` that we have used above.
- visualise them using `plotSpotQC` that we have used above.
:::

```{r, fig.width=7, fig.height=8}
spe_joint <- do.call(cbind, spatial_data_list)
ggspavis::plotSpots(spe_joint, annotate = sprintf("%s", "clust_M0_lam0.2_k50_res0.7"), size = 0.8, pal = pal) +
ggspavis::plotSpots(spe_joint, annotate = sprintf("%s", "clust_M0_lam0.2_k50_res0.7"), pal = pal) +
facet_wrap(~sample_id) +
theme(legend.position = "none") +
labs(title = "BANKSY clusters")
Expand All @@ -730,15 +735,12 @@ spe_joint <- do.call(cbind, spatial_data_list)
spe_joint$has_changed = !spe_joint$clust_M0_lam0.2_k50_res0.7 == spe_joint$clust_M0_lam0.2_k50_res0.7_smooth
plotQC(
plotSpotQC(
spe_joint,
type = "spots",
discard = "has_changed"
) +
plot_type = "spot",
annotate = "has_changed",
) +
facet_wrap(~sample_id)
```

### 8. Deconvolution of pixel-based spatial data
Expand Down Expand Up @@ -777,7 +779,7 @@ brain_reference =
dplyr::filter(tissue_harmonised=="brain", disease == "normal", organism == "Mus musculus") |>
# Collect pseudobulk as SummarizedExperiment
get_pseudobulk(cache_directory = "/vast/projects/cellxgene_curated") |>
get_pseudobulk() |>
# Normalise for Spotlight
scuttle::logNormCounts() |>
Expand Down

0 comments on commit ea6d690

Please sign in to comment.