packages <- c(
    "mesenchymalSubsetAnalysis", 
    "printr",
    "ggthemes",
    "tidyverse",
    "mclust",
    "viridis"
)
purrr::walk(packages, library, character.only = TRUE)
rm(packages)
tsne <- my.tsne.2d.full.top2000.log
counts <- counts.nodups
counts.norm <- countsNorm(counts)
counts.log <- log2(counts.norm)

groups.mesenchymal <- groups.mesenchymal.n
groups.fetal <- groupNames(groups.fetal)

mes.tsne <- tsne[groups.fetal == "Mesenchymal", ]

Plot all cell types

data.frame(tsne, class = groups.fetal) %>%
  as_tibble() %>%
  ggplot() +
  geom_point(aes(X1, X2, colour = class)) +
  theme_few() +
  scale_colour_ptol()

Plot the mesenchymal cell subtypes

Subtypes classified via Mclust.

mes.tsne %>%
  as.data.frame() %>%
  rownames_to_column("sample") %>%
  inner_join(sampleClasses, by = "sample") %>%
  as_tibble() %>%
  filter(class != "UndefinedMesenchymal") %>%
  ggplot() +
  geom_point(aes(V1, V2, colour = class)) +
  theme_few() +
  scale_colour_ptol() +
  labs(x = "t-SNE dim 1", y = "t-SNE dim 2") +
  guides(colour = guide_legend(title = "Cell subtype"))

Select genes that identify each mesenchymal subset.

Genes specific expression for each cell type (including mesenchymal subclasses) was then analyzed. This is done in two steps. First, a pre-selection examines the pairwise fold change between all cell types and the 200 genes with the highest absolute fold change per cell type comparison are choosen. Second, we use the Kolmogorov-Smirnov test to compare each pairwise cell type and subclass for each gene. Genes that are identified as significantly (alpha = 0.05) different in all pairwise tests for a specific cellType/subclass are annotated as being specific for that class. A heatmap showing the detected genes is shown below.

classHeatmap(geneList, counts.log, filter(sampleClasses, class != "UndefinedMesenchymal"))


jasonserviss/mesenchymalSubsetAnalysis documentation built on May 17, 2019, 7:28 p.m.