-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathconos.Rmd
141 lines (124 loc) · 3.81 KB
/
conos.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
---
title: "Integration of datasets using Conos"
date: 'Compiled: `r format(Sys.Date(), "%B %d, %Y")`'
output:
github_document:
html_preview: true
toc: true
toc_depth: 3
fig_width: 16
html_document:
df_print: kable
theme: united
fig_height: 5
fig_width: 16
out_height: 4
---
This vignette demonstrates the use of the Conos package in Seurat. Commands and parameters are based off of the [Conos tutorial](https://github.com/hms-dbmi/conos/blob/master/vignettes/walkthrough.md). If you use Conos in your work, please cite:
> *Joint analysis of heterogeneous single-cell RNA-seq dataset collections*
>
> Nikolas Barkas, Viktor Petukhov, Daria Nikolaeva, Yaroslav Lozinsky, Samuel Demharter, Konstantin Khodosevich, Peter V. Kharchenko
>
> Nature Methods, 2019.
>
> doi: [10.1038/s41592-019-0466-z](https://doi.org/10.1038/s41592-019-0466-z)
>
> GitHub: https://github.com/hms-dbmi/conos
```{r setup, include=FALSE}
knitr::opts_chunk$set(
tidy = TRUE,
tidy.opts = list(width.cutoff = 95),
message = FALSE,
warning = FALSE
)
```
Prerequisites to install:
* [Seurat](https://satijalab.org/seurat/install)
* [Conos](https://github.com/hms-dbmi/conos)
* [SeuratWrappers](https://github.com/satijalab/seurat-wrappers)
* [SeuratData](https://github.com/satijalab/seurat-data)
```{r packages}
library(conos)
library(Seurat)
library(SeuratData)
library(SeuratWrappers)
```
## {.tabset .tabset-pills}
### Systematic comparative analysis of human PBMC
To learn more about this dataset, type `?pbmcsca`
```{r pbmcsca, results='hide', cache=TRUE}
InstallData("pbmcsca")
data("pbmcsca")
pbmcsca.panel <- SplitObject(pbmcsca, split.by = 'Method')
for (i in 1:length(pbmcsca.panel)) {
pbmcsca.panel[[i]] <- NormalizeData(pbmcsca.panel[[i]]) %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA(verbose = FALSE)
}
pbmcsca.con <- Conos$new(pbmcsca.panel)
pbmcsca.con$buildGraph(
k = 15,
k.self = 5,
space = 'PCA',
ncomps = 30,
n.odgenes = 2000,
matching.method = 'mNN',
metric = 'angular',
score.component.variance = TRUE,
verbose = TRUE
)
pbmcsca.con$findCommunities()
pbmcsca.con$embedGraph()
pbmcsca <- as.Seurat(pbmcsca.con)
DimPlot(pbmcsca, reduction = "largeVis", group.by = c("Method", "ident", 'CellType'), ncol = 3)
```
### Interferon-stimulated and control PBMC
To learn more about this dataset, type `?ifnb`
```{r ifnb, results='hide', cache=TRUE}
InstallData("ifnb")
data("ifnb")
ifnb.panel <- SplitObject(ifnb, split.by = 'stim')
for (i in 1:length(ifnb.panel)) {
ifnb.panel[[i]] <- NormalizeData(ifnb.panel[[i]]) %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA(verbose = FALSE)
}
ifnb.con <- Conos$new(ifnb.panel)
ifnb.con$buildGraph(
k = 15,
k.self = 5,
space = 'PCA',
ncomps = 30,
n.odgenes = 2000,
matching.method = 'mNN',
metric = 'angular',
score.component.variance = TRUE,
verbose = TRUE
)
ifnb.con$findCommunities()
ifnb.con$embedGraph()
ifnb <- as.Seurat(ifnb.con)
DimPlot(ifnb, reduction = "largeVis", group.by = c("stim", "ident", 'seurat_annotations'), ncol = 3)
```
### Eight human pancreatic islet datasets
To learn more about this dataset, type `?panc8`
```{r pancreas, results='hide', cache=TRUE}
InstallData("panc8")
data("panc8")
panc8.panel <- SplitObject(panc8, split.by = 'replicate')
for (i in 1:length(panc8.panel)) {
panc8.panel[[i]] <- NormalizeData(panc8.panel[[i]]) %>% FindVariableFeatures() %>% ScaleData() %>% RunPCA(verbose = FALSE)
}
panc8.con <- Conos$new(panc8.panel)
panc8.con$buildGraph(
k = 15,
k.self = 5,
space = 'PCA',
ncomps = 30,
n.odgenes = 2000,
matching.method = 'mNN',
metric = 'angular',
score.component.variance = TRUE,
verbose = TRUE
)
panc8.con$findCommunities()
panc8.con$embedGraph()
panc8 <- as.Seurat(panc8.con)
DimPlot(panc8, reduction = "largeVis", group.by = c("replicate", "ident", 'celltype'), ncol = 3)
```