-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtsne_and_pca_look.Rmd
81 lines (63 loc) · 2.16 KB
/
tsne_and_pca_look.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
title: "T-Sne and PCA Look"
author: "D. Ford Hannum Jr."
date: "7/30/2020"
output:
html_document:
toc: true
toc_depth: 3
number_sections: false
theme: united
highlight: tango
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
library(Seurat)
library(ggplot2)
library(data.table)
library(MAST)
```
```{r loading data}
wbm <- readRDS('./data/wbm_clustered_filtered_named.rds')
#DimPlot(wbm, reduction = 'umap', label = T, repel = T) + NoLegend()
```
```{r changing the levels of the data}
new_levels <- c('Granulocyte','Granulocyte','Granulocyte', 'B-cell','MEP',
'Granulocyte', 'Granulocyte','Monocyte','Macrophage','Erythroid','B-cell',
'T-cell/NK', 'MK')
names(new_levels) <- levels(wbm)
#new_levels
wbm <- RenameIdents(wbm, new_levels)
```
```{r tsne}
wbm <- RunTSNE(wbm, dims = 1:10)
```
```{r 3a pallette}
color_pal <- c("#0072B2", "#CC79A7", "#009E73", "#56B4E9","#D55E00",
"#E69F00","#999999", "black")
DimPlot(wbm, reduction = 'tsne',
cols = color_pal, ncol = 2, pt.size = .01) +
theme_bw() +
theme(text = element_text(size = 10, family = 'sans'))
```
Doesn't look any better than the UMAP plot, so sticking with the UMAP plot makes the most sense.
```{r pca dimension reduction}
DimPlot(wbm, reduction = 'pca',
cols = color_pal, ncol = 2, pt.size = .01) +
theme_bw() +
theme(text = element_text(size = 10, family = 'sans'))
DimPlot(wbm, reduction = 'pca', split.by = 'condition',
cols = color_pal, ncol = 2, pt.size = .01) +
theme_bw() +
theme(text = element_text(size = 10, family = 'sans'))
DimPlot(wbm, reduction = 'pca', split.by = 'state',
cols = color_pal, ncol = 2, pt.size = .01) +
theme_bw() +
theme(text = element_text(size = 10, family = 'sans'))
```
I find it interesting that PC2 seems to be separating the MEPs from all other cells.
```{r looking at PC2}
print(wbm[['pca']], dims = 2, nfeatures = 10)
VizDimLoadings(wbm, dims = 2, reduction = 'pca')
DimHeatmap(wbm, dims = 2, cells = 500, balanced = T)
```