-
Notifications
You must be signed in to change notification settings - Fork 2
/
10x-180831-supplementary_figures.Rmd
160 lines (129 loc) · 6.57 KB
/
10x-180831-supplementary_figures.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
---
title: "R Notebook"
output:
html_document:
df_print: paged
toc: true
toc_float:
smooth_scroll: true
---
```{r}
library(Seurat)
library(knitr)
library(ggplot2)
require(scales)
seurobj <- readRDS('output/seurat_objects/180831/10x-180831')
source('code/colors.R')
```
#BATLAS
Calculate averages for clusters from resolution 1.5:
```{r, fig.height = 4, fig.width = 5, fig.align = "center"}
p <- TSNEPlot(seurobj, group.by='res.1.5', do.label=T, pt.size=0.1)
p
```
```{r, fig.height = 12, fig.width = 12, fig.align = "center"}
v1 <- VlnPlot(seurobj, features.plot='percent.mito', point.size.use=-1, group.by='res.1.5')
v1
```
```{r, fig.height = 4, fig.width = 12, fig.align = "center"}
v2 <- VlnPlot(seurobj, features.plot='percent.mito', point.size.use=-1, group.by='res.1.5', y.max=0.2)
v2
```
```{r}
save_plot(p, file='figures/figures_paper/supplementary_figures/batlas/10x-180831_tsne_res.1.5.pdf', base_width=5, base_height=4)
save_plot(v1, file='figures/figures_paper/supplementary_figures/batlas/10x-180831_vlnplot_percent.mito_clustering.1.5.pdf', base_width=12, base_height=10)
save_plot(v2, file='figures/figures_paper/supplementary_figures/batlas/10x-180831_vlnplot_percent.mito_clustering.1.5_y-cutoff-0.2.pdf', base_width=12, base_height=4)
```
```{r}
#Average expression is calculated by: (mean(1expm(seurobj@data[gene, cluster])))
#average.expression <- AverageExpression(SetAllIdent(seurobj, id='res.1.5'))
```
BATLAS results.
```{r}
batlas <- read.table('tables/tables_paper/supplementary_tables/BATLAS/BATLAS.txt', header=T, sep='\t')
batlas$cluster <- as.character(batlas$cluster)
kable(batlas)
```
```{r, fig.height = 6, fig.width = 12, fig.align = "center"}
p <- ggplot(data=batlas, aes(x=cluster, y=brown)) +
geom_bar(stat="identity") +
ylab('Brown percentage estimate') +
coord_flip()
p
```
```{r}
save_plot('figures/figures_paper/supplementary_figures/batlas/BATLAS_results.pdf', p, base_height=6, base_width=12)
```
BATLAS results log normalized.
```{r}
batlas <- read.table('tables/tables_paper/supplementary_tables/BATLAS/BATLAS_log_normalized.txt', header=T, sep='\t')
batlas$cluster <- as.character(batlas$cluster)
kable(batlas)
```
```{r, fig.height = 6, fig.width = 12, fig.align = "center"}
p <- ggplot(data=batlas, aes(x=cluster, y=brown)) +
geom_bar(stat="identity") +
ylab('Brown percentage estimate') +
coord_flip()
p
```
```{r}
save_plot('figures/figures_paper/supplementary_figures/batlas/BATLAS_results_log-normalized.pdf', p, base_height=6, base_width=12)
```
#PC analysis
```{r, fig.height = 18, fig.width = 12, fig.align = "center"}
p1 <- FeaturePlot(seurobj, features.plot=c('PC1'), cols.use=c('gray', 'blue'), no.legend=F, do.return=T)[['PC1']]
p2 <- FeaturePlot(seurobj, features.plot=c('Pseudotime'), cols.use=c('gray', 'blue'), no.legend=F, do.return=T)[['Pseudotime']]
p3 <- FeaturePlot(seurobj, features.plot=c('Pseudotime'), cols.use=c('gray', 'blue'), no.legend=F, min.cutoff=30, do.return=T)[['Pseudotime']]
p4 <- FeaturePlot(seurobj, features.plot=c('PC2'), cols.use=c('gray', 'blue'), no.legend=F, do.return=T)[['PC2']]
p5 <- TSNEPlot(seurobj, group.by='pc2.groups', pt.size=0.5)
p6 <- DimPlot(SetAllIdent(seurobj, id='State.names'), reduction.use = 'pca', dim.1=5, dim.2=2, cols.use=colors.states.names)
p7 <- DimPlot(SetAllIdent(seurobj, id='State.names'), reduction.use = 'pca', dim.1=1, dim.2=2, cols.use=colors.states.names)
plot_grid(
p1, p2, p3, p4, p5, p6, p7, ncol=2
)
```
```{r}
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/PC1_featureplot.pdf', p1, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/Pseudotime_featureplot.pdf', p2, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/Pseudotime_featureplot_min.cutoff30.pdf', p1, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/PC2_featureplot.pdf', p4, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/tSNE_top10percentPC2.pdf', p5, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/PC5_PC2.pdf', p6, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/pc_analysis/PC1_PC2.pdf', p7, base_width=6, base_height=4.5)
```
#WGCNA
```{r, fig.height = 11, fig.width = 12, fig.align = "center"}
plots <- FeaturePlot(seurobj, features.plot=c('SeuratProject__blue', 'SeuratProject__lightgreen', 'SeuratProject__mediumpurple', 'SeuratProject__sandybrown', 'SeuratProject__springgreen'), cols.use=c('gray', 'blue'), no.legend=F, do.return=T)
plot_grid(
plots$SeuratProject__blue,
plots$SeuratProject__lightgreen,
plots$SeuratProject__mediumpurple,
plots$SeuratProject__sandybrown,
plots$SeuratProject__springgreen,
ncol=2
)
```
```{r}
save_plot('figures/figures_paper/supplementary_figures/wgcna/blue.pdf', plots$SeuratProject__blue, base_width=6, base_height=4)
save_plot('figures/figures_paper/supplementary_figures/wgcna/lightgreen.pdf', plots$SeuratProject__lightgreen, base_width=6, base_height=4)
save_plot('figures/figures_paper/supplementary_figures/wgcna/mediumpurple.pdf', plots$SeuratProject__mediumpurple, base_width=6, base_height=4)
save_plot('figures/figures_paper/supplementary_figures/wgcna/sandybrown.pdf', plots$SeuratProject__sandybrown, base_width=6, base_height=4)
save_plot('figures/figures_paper/supplementary_figures/wgcna/springgreen.pdf', plots$SeuratProject__springgreen, base_width=6, base_height=4)
```
#FTO analysis
```{r, fig.height = 9, fig.width = 12, fig.align = "center"}
plots <- FeaturePlot(seurobj, features.plot=c('FTO', 'percent.mito', 'IRX3', 'IRX5'), cols.use=c('gray', 'blue'), no.legend=F, do.return=T)
```
```{r}
save_plot('figures/figures_paper/supplementary_figures/fto_analysis/FTO_featureplot.pdf', plots$FTO, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/fto_analysis/percent.mito_featureplot.pdf', plots$percent.mito, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/fto_analysis/IRX3_featureplot.pdf', plots$IRX3, base_width=6, base_height=4.5)
save_plot('figures/figures_paper/supplementary_figures/fto_analysis/IRX5_featureplot.pdf', plots$IRX5, base_width=6, base_height=4.5)
```
```{r}
pm <- FeaturePlot(seurobj, features.plot=c('percent.mito'), cols.use=c('gray', 'blue'), no.legend=F, do.return=T, max.cutoff = 0.2)[['percent.mito']]
```
```{r}
save_plot('figures/figures_paper/supplementary_figures/fto_analysis/percent.mito_featureplot_max.cutoff0.2.pdf', plots$percent.mito, base_width=6, base_height=4.5)
```