Skip to content

Commit 1623100

Browse files
committed
upload
1 parent b441a3a commit 1623100

File tree

9 files changed

+542
-81
lines changed

9 files changed

+542
-81
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ Imports:
3030
pheatmap,
3131
corrplot,
3232
circlize,
33-
ggalluvial,
3433
ggraph,
3534
ggrepel,
3635
igraph

R/demo.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ demo_pathways <- function() {
130130
dest <- c("CDK2", "CDK4", "TP53", "Atf2")
131131
pathway <- c("p53 signaling pathway", "p53 signaling pathway", "p53 signaling pathway",
132132
"PI3K-Akt signaling pathway")
133-
sourcename <- c("Process(activation)", "Process(activation)", "Process(binding)",
133+
type <- c("Process(activation)", "Process(activation)", "Process(binding)",
134134
"Process(association)")
135-
type <- rep("KEGG", 4)
135+
sourcename <- rep("KEGG", 4)
136136
src_tf <- c("NO", "NO", "NO", "NO")
137137
dest_tf <- c("NO", "NO", "YES", "YES")
138138
species <- c("Human", "Human", "Human", "Mouse")

R/plot.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,6 @@ plot_st_celltype_all <- function(object, size = 1, color = NULL) {
338338
#' @param color_low Color for the lowest value.
339339
#' @param color_mid Color for the middle value for using \code{scale_color_gradient2}. Default is \code{NULL}.
340340
#' @param color_high Color for the highest value.
341-
#' @param if_use_newmeta Whether to use newmeta o plot the spatial distribution of gene after \code{\link{dec_celltype}} for spot-based data. Default is \code{FALSE}.
342341
#' @param scale Character indicating if the values should be centered and scaled in either the row direction or the column direction, or none. Corresponding values are 'row', 'column' and 'none'.
343342
#' @param if_show_top Whether to plot a symbol to the highest value across rows or columns. Default is \code{TRUE}.
344343
#' @param top_direction Direction to identify the highest value, select \code{'row'} or \code{'column'}.

inst/CITATION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ citEntry(
1717
as.person("Xiao Xu"),
1818
as.person("Xiaohui Fan")
1919
),
20+
journal = "Under submission",
2021
year = "2022",
2122
textVersion = paste("Shao et al. Knowledge-graph-based cell-cell communication inference for spatially resolved transcriptomic data with SpaTalk. 2022."
2223
)

man/plot_st_cor_heatmap.Rd

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/sc_tutorial.Rmd

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
title: "SpaTalk tutorial (spot-based ST data)"
2+
title: "SpaTalk tutorial (single-cell ST data)"
33
author: "Xin Shao"
44
date: "`r Sys.Date()`"
55
output:
66
prettydoc::html_pretty:
77
theme: cayman
88
highlight: github
99
vignette: >
10-
%\VignetteIndexEntry{SpaTalk tutorial (spot-based ST data)}
10+
%\VignetteIndexEntry{SpaTalk tutorial (single-cell ST data)}
1111
%\VignetteEngine{knitr::rmarkdown}
1212
%\VignetteEncoding{UTF-8}
1313
---
@@ -46,23 +46,23 @@ obj <- dec_celltype(object = obj,
4646

4747
### Use `plot_st_celltype_percent()` to view cell-type percent
4848

49-
```{r plot_st_celltype_percent, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
49+
```{r plot_st_celltype_percent, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
5050
# plot cell-type percent across spatial cells
51-
plot_st_celltype_percent(object = obj, celltype = 'eL2_3',size = 3)
51+
plot_st_celltype_percent(object = obj, celltype = 'Oligo',size = 2)
5252
5353
```
5454

5555
### Use `plot_st_gene()` to view gene expression
5656

57-
```{r plot_st_gene, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
57+
```{r plot_st_gene, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
5858
# plot marker gene expression across spatial cells
59-
plot_st_gene(object = obj, gene = 'Lamp5',size = 3, if_use_newmeta = F)
59+
plot_st_gene(object = obj, gene = 'Plp1',size = 2, if_use_newmeta = F)
6060
6161
```
6262

6363
### Use `plot_st_cor_heatmap()` to view correlation heatmap
6464

65-
```{r plot_st_cor_heatmap, fig.width=7, fig.height=6, fig.align='center', echo=TRUE}
65+
```{r plot_st_cor_heatmap, fig.width=4, fig.height=3, fig.align='center', echo=TRUE}
6666
# correlation between marker gene expression and cell type percent across spatial cells
6767
plot_st_cor_heatmap(object = obj,
6868
marker_genes = c("Plp1","Vip","Sst","Lamp5","Pcp4","Mfge8","Pvalb"),
@@ -76,42 +76,42 @@ plot_st_cor_heatmap(object = obj,
7676
## **ST at single-cell resolution**
7777
### Use `plot_st_celltype()` to view cell type in space
7878

79-
```{r plot_st_celltype, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
79+
```{r plot_st_celltype, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
8080
# plot cell type in reconstructed ST atlas
81-
plot_st_celltype(object = obj, celltype = 'eL2_3')
81+
plot_st_celltype(object = obj, celltype = 'Oligo', size = 2)
8282
8383
```
8484

8585
### Use `plot_st_gene()` to view gene expression in space
8686

87-
```{r plot_st_gene2, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
87+
```{r plot_st_gene2, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
8888
# plot marker gene expression in single-cell ST data
89-
plot_st_gene(object = obj,gene = 'Lamp5', if_use_newmeta = T)
89+
plot_st_gene(object = obj,gene = 'Plp1', if_use_newmeta = T, size = 2)
9090
9191
```
9292

9393
### Use `plot_st_celltype_density()` to view cell-type density in space
9494

95-
```{r plot_st_celltype_density, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
95+
```{r plot_st_celltype_density, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
9696
# plot cell-type density in single-cell ST data
9797
plot_st_celltype_density(object = obj,
98-
celltype = 'eL2_3',
98+
celltype = 'Oligo',
9999
type = 'raster',
100100
color_low = 'purple',
101101
color_high = 'yellow')
102102
103103
plot_st_celltype_density(object = obj,
104-
celltype = 'eL2_3',
104+
celltype = 'Oligo',
105105
type = 'contour',
106106
color_low = 'purple',
107107
color_high = 'yellow')
108108
```
109109

110110
### Use `plot_st_celltype_all()` to view all cell types in space
111111

112-
```{r plot_st_celltype_all, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
112+
```{r plot_st_celltype_all, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
113113
# plot all cell types in single-cell ST data
114-
plot_st_celltype_all(object = obj,size = 2)
114+
plot_st_celltype_all(object = obj, size = 2)
115115
116116
```
117117

@@ -143,7 +143,11 @@ obj_lr_path$path_pvalue
143143

144144
```{r plot_ccdist, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
145145
# Point plot with spatial distribution of celltype_sender and celltype_receiver
146-
plot_ccdist(object = obj, celltype_sender = 'eL5', celltype_receiver = 'Astro')
146+
plot_ccdist(object = obj,
147+
celltype_sender = 'eL5',
148+
celltype_receiver = 'Astro',
149+
size = 2,
150+
arrow_length = 0.1)
147151
148152
```
149153

@@ -157,14 +161,16 @@ plot_cci_lrpairs(object = obj, celltype_sender = 'eL5', celltype_receiver = 'Ast
157161

158162
### Use `plot_lrpair()` to view the specific LRI
159163

160-
```{r plot_lrpair, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
164+
```{r plot_lrpair, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
161165
# Point plot with LR pair from celltype_sender to celltype_receiver
162166
plot_lrpair(object = obj,
163167
celltype_sender = 'eL5',
164168
ligand = 'Cort',
165169
celltype_receiver = 'Astro',
166170
receptor = 'Sstr2',
167-
if_plot_density = F)
171+
if_plot_density = F,
172+
size = 2,
173+
arrow_length = 0.1)
168174
169175
```
170176

@@ -196,7 +202,6 @@ plot_lr_path(object = obj,
196202

197203
```{r plot_path2gene, fig.width=8, fig.height=6, fig.align='center', echo=TRUE}
198204
# River plot of significantly activated pathways and related downstream genes of receptors
199-
library(ggalluvial)
200205
plot_path2gene(object = obj,
201206
celltype_sender = 'eL5',
202207
ligand = 'Cort',
@@ -210,7 +215,7 @@ plot_path2gene(object = obj,
210215
To infer all paired cell-cell communications, use `dec_cci_all()` instead of `dec_cci()`
211216

212217
```{r dec_cci_all, echo=TRUE}
213-
# Infer cell-cell communications from SST to PVALB neurons
218+
# Infer all cell-cell communications
214219
# obj <- dec_cci_all(object = obj)
215220
```
216221

vignettes/sc_tutorial.html

Lines changed: 35 additions & 32 deletions
Large diffs are not rendered by default.

vignettes/spot_tutorial.Rmd

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ obj <- createSpaTalk(st_data = as.matrix(st_data),
4646

4747
### Use `plot_st_pie_generate()` to view the cell-type composition
4848

49-
```{r plot_st_pie_generate, echo=TRUE}
49+
```{r plot_st_pie_generate, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
5050
plot_st_pie_generate(st_meta = st_meta, pie_scale = 1.3, xy_ratio = 1.8)
5151
5252
```
@@ -65,31 +65,31 @@ obj <- dec_celltype(object = obj,
6565

6666
### Use `plot_st_pie()` to view predicted cell-type composition
6767

68-
```{r plot_st_pie, echo=TRUE}
68+
```{r plot_st_pie, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
6969
# Scatter pie plot for each spot
7070
plot_st_pie(object = obj, pie_scale = 1.3, xy_ratio = 1.8)
7171
7272
```
7373

7474
### Use `plot_st_celltype_percent()` to view cell-type percent
7575

76-
```{r plot_st_celltype_percent, echo=TRUE}
76+
```{r plot_st_celltype_percent, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
7777
# plot cell-type percent across spatial spots
78-
plot_st_celltype_percent(object = obj, celltype = 'Oligo',size = 3)
78+
plot_st_celltype_percent(object = obj, celltype = 'Oligo',size = 4)
7979
8080
```
8181

8282
### Use `plot_st_gene()` to view gene expression
8383

84-
```{r plot_st_gene, echo=TRUE}
84+
```{r plot_st_gene, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
8585
# plot marker gene expression across spatial spots
86-
plot_st_gene(object = obj, gene = 'Plp1',size = 3, if_use_newmeta = F)
86+
plot_st_gene(object = obj, gene = 'Plp1',size = 4, if_use_newmeta = F)
8787
8888
```
8989

9090
### Use `plot_st_cor_heatmap()` to view correlation heatmap
9191

92-
```{r plot_st_cor_heatmap, echo=TRUE}
92+
```{r plot_st_cor_heatmap, fig.width=4, fig.height=3, fig.align='center', echo=TRUE}
9393
# correlation between marker gene expression and cell type percent across spatial spots
9494
plot_st_cor_heatmap(object = obj,
9595
marker_genes = c("Plp1","Vip","Sst","Lamp5","Pcp4","Mfge8","Pvalb"),
@@ -103,23 +103,23 @@ plot_st_cor_heatmap(object = obj,
103103
## **ST at single-cell resolution**
104104
### Use `plot_st_celltype()` to view cell type in space
105105

106-
```{r plot_st_celltype, echo=TRUE}
106+
```{r plot_st_celltype, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
107107
# plot cell type in reconstructed ST atlas
108-
plot_st_celltype(object = obj, celltype = 'Oligo')
108+
plot_st_celltype(object = obj, celltype = 'Oligo', size = 2)
109109
110110
```
111111

112112
### Use `plot_st_gene()` to view gene expression in space
113113

114-
```{r plot_st_gene2, echo=TRUE}
114+
```{r plot_st_gene2, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
115115
# plot marker gene expression in reconstructed ST atlas
116-
plot_st_gene(object = obj,gene = 'Plp1', if_use_newmeta = T)
116+
plot_st_gene(object = obj,gene = 'Plp1', if_use_newmeta = T, size = 2)
117117
118118
```
119119

120120
### Use `plot_st_celltype_density()` to view cell-type density in space
121121

122-
```{r plot_st_celltype_density, echo=TRUE}
122+
```{r plot_st_celltype_density, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
123123
# plot cell-type density in reconstructed ST atlas
124124
plot_st_celltype_density(object = obj,
125125
celltype = 'Oligo',
@@ -136,9 +136,9 @@ plot_st_celltype_density(object = obj,
136136

137137
### Use `plot_st_celltype_all()` to view all cell types in space
138138

139-
```{r plot_st_celltype_all, echo=TRUE}
139+
```{r plot_st_celltype_all, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
140140
# plot all cell types in reconstructed ST atlas
141-
plot_st_celltype_all(object = obj)
141+
plot_st_celltype_all(object = obj, size = 2)
142142
143143
```
144144

@@ -167,9 +167,13 @@ obj_lr_path$path_pvalue
167167

168168
### Use `plot_ccdist()` to view distribution of senders and receivers
169169

170-
```{r plot_ccdist, echo=TRUE}
170+
```{r plot_ccdist, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
171171
# Point plot with spatial distribution of celltype_sender and celltype_receiver
172-
plot_ccdist(object = obj, celltype_sender = 'SST', celltype_receiver = 'PVALB')
172+
plot_ccdist(object = obj,
173+
celltype_sender = 'SST',
174+
celltype_receiver = 'PVALB',
175+
size = 2,
176+
arrow_length = 0.1)
173177
174178
```
175179

@@ -185,20 +189,22 @@ Given the limited LR pairs, we do not show the result here
185189

186190
### Use `plot_lrpair()` to view the specific LRI
187191

188-
```{r plot_lrpair, echo=TRUE}
192+
```{r plot_lrpair, fig.width=5, fig.height=6, fig.align='center', echo=TRUE}
189193
# Point plot with LR pair from celltype_sender to celltype_receiver
190194
plot_lrpair(object = obj,
191195
celltype_sender = 'SST',
192196
ligand = 'Sst',
193197
celltype_receiver = 'PVALB',
194198
receptor = 'Sstr2',
195-
if_plot_density = F)
199+
if_plot_density = F,
200+
size = 2,
201+
arrow_length = 0.1)
196202
197203
```
198204

199205
### Use `plot_lrpair_vln()` to view violin plot with spatial distance of LRI
200206

201-
```{r plot_lrpair_vln, echo=TRUE}
207+
```{r plot_lrpair_vln, fig.width=8, fig.height=6, fig.align='center', echo=TRUE}
202208
# Violin plot with spatial distance of LR pair between senders and receivers and between all cell-cell pairs
203209
plot_lrpair_vln(object = obj,
204210
celltype_sender = 'SST',
@@ -210,7 +216,7 @@ plot_lrpair_vln(object = obj,
210216

211217
### Use `plot_lr_path()` to view network with LR and downstream pathways
212218

213-
```{r plot_lr_path, echo=TRUE}
219+
```{r plot_lr_path, fig.width=6, fig.height=6, fig.align='center', echo=TRUE}
214220
# Plot network with LR and downstream pathways
215221
plot_lr_path(object = obj,
216222
celltype_sender = 'SST',
@@ -222,7 +228,7 @@ plot_lr_path(object = obj,
222228

223229
### Use `plot_path2gene()` to view river plot of significantly activated pathways
224230

225-
```{r plot_path2gene, echo=TRUE}
231+
```{r plot_path2gene, fig.width=8, fig.height=6, fig.align='center', echo=TRUE}
226232
# River plot of significantly activated pathways and related downstream genes of receptors
227233
plot_path2gene(object = obj,
228234
celltype_sender = 'SST',
@@ -237,7 +243,7 @@ plot_path2gene(object = obj,
237243
To infer all paired cell-cell communications, use `dec_cci_all()` instead of `dec_cci()`
238244

239245
```{r dec_cci_all, echo=TRUE}
240-
# Infer cell-cell communications from SST to PVALB neurons
246+
# Infer all cell-cell communications
241247
# obj <- dec_cci_all(object = obj)
242248
```
243249

0 commit comments

Comments
 (0)