Skip to content

Commit

Permalink
fixes spatially variable issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Geert van Geest committed Jun 11, 2024
1 parent f6706be commit 014d880
Show file tree
Hide file tree
Showing 3 changed files with 1,082 additions and 10 deletions.
43 changes: 38 additions & 5 deletions 3_integration_clustering.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ engine: knitr
library(Seurat)
library(ggplot2)
library(clustree)
library(patchwork)
```

```{r}
Expand Down Expand Up @@ -96,21 +97,53 @@ SpatialPlot(seu_int, group.by = res) +
scale_fill_viridis_d(option = "H")
```

```{r}
Idents(seu_int) <- "integrated_snn_res.0.4"
SpatialDimPlot(seu_int,
alpha = 0.6,
cells.highlight = CellsByIdentities(object = seu_int,
idents = 7)) +
plot_layout(guides='collect') &
theme(legend.position = "none")
SpatialDimPlot(seu_int,
alpha = 0.6,
cells.highlight = CellsByIdentities(object = seu_int,
idents = 0)) +
plot_layout(guides='collect') &
theme(legend.position = "none")
```

```{r}
seu_int <- PrepSCTFindMarkers(seu_int)
all_marks <- FindAllMarkers(seu_int, only.pos = TRUE, min.pct = 0.25, logfc.threshold = 0.25)
```

```{r}
SpatialPlot(seu_int, features = "Fth1")
# oligodendrocytes, myenilated neurons
```



```{r}
DefaultAssay(seu_list$Anterior) <- "SCT"
seu_list$Anterior <-
FindSpatiallyVariableFeatures(
seu_list$Anterior,
features = rownames(seu_int),
selection.method = "markvariogram"
selection.method = "moransi"
)
sf <- SpatiallyVariableFeatures(seu_list$Anterior)
spatialFeatures <-
SVFInfo(seu_int, method = "markvariogram", status = TRUE)
spatialFeatures <- na.omit(spatialFeatures)
SVFInfo(seu_list$Anterior, method = "moransi", status = TRUE)
spatialFeatures <-
spatialFeatures %>% filter(variable == TRUE) %>% arrange(rank)
spatialFeatures <- spatialFeatures[, c("r.metric.5"), drop = FALSE]
spatialFeatures |> arrange(rank)
SpatialPlot(seu_list$Anterior, features = rownames(spatialFeatures)[1:6], ncol = 3, alpha = c(0.1, 1))
```

Loading

0 comments on commit 014d880

Please sign in to comment.