Load data

samples.df <- readRDS(file.path(dir.objects, "metadata.rds"))
samples.df
so.astro <- readRDS(file.path(dir.objects, "so.astro.rds"))

#[email protected]$ident <- as.factor([email protected]$integrated_snn_res.0.2)

Idents(so.astro) <- "integrated_snn_res.0.2"

# Prepare a vector of colors for the clusters
clusters <- levels(Idents(so.astro)) %>% as.numeric()
cluster.cols <- muscat:::.cluster_colors[seq_along(clusters)]
names(cluster.cols) <- clusters

clusters
 [1] 0 1 2 3 4 5 6 7 8 9
astro.markers <- readRDS(file.path(dir.objects, "astro.markers.v1.rds")) %>% 
  remove_rownames() %>% 
  mutate(gene.name = word(gene, 2, sep = "\\."))
head(astro.markers)

Fig. 2b. Astrocytes saline vs LPS by sex

DimPlot(
  so.astro,
  reduction = "tsne",
  group.by = "integrated_snn_res.0.2",
  split.by = "group_id"
) +
  scale_color_manual(values = cluster.cols)