-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path3abc.Rmd
80 lines (63 loc) · 2.82 KB
/
3abc.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
---
title: "Figure 3"
output:
html_document:
df_print: paged
---
```{r message=FALSE, warning=FALSE}
suppressPackageStartupMessages(source("scripts/themes.R"))
tm.facs <- loadObject(filename = url("https://scfind.cog.sanger.ac.uk/indexes/tm_facs.rds"))
```
## Figure 3a
```{r message=FALSE, warning=FALSE, paged.print=TRUE}
result <- markerGenes(tm.facs,
gene.list = c("Acta1", "Actc1", "Atp2a2", "Myh6", "Nppa", "Ryr2", "Tnnc1", "Tpm"))
table.4a <- hyperQueryCellTypes(tm.facs,
gene.list = strsplit(as.character(result$Query[which.max(result$tfidf)]), ",")[[1]])
head(result[order(result$tfidf, decreasing = T),])
table.4a[order(table.4a$pval, decreasing = F),]
```
## Figure 3b
```{r eval=FALSE, message=FALSE, warning=FALSE}
df.4b <- readRDS("data/fig4b.rds")
ha = rowAnnotation("Tissue" = df.4b$tissues,
col = list("Tissue" = df.4b$colour18),
cells = anno_mark(at = c(32:38, 73:77, 102:106, 109),
labels = rownames(df.4b$mx)[ c(32:38, 73:77, 102:106, 109)] ),
annotation_legend_param = list( "Tissue" = list(nrow = 2)))
ta = HeatmapAnnotation("GO parents" = df.4b$V3,
col = list("GO parents" = df.4b$colourAncestors),
annotation_legend_param = list( "GO parents" = list(nrow = 2)))
draw(Heatmap(df.4b$mx, name = "-log10(p-value)",
cluster_rows = F, show_row_names = F,
cluster_columns = F,show_column_names = F,
col = c("white", brewer.pal(9, "RdPu")), na_col = "#49006A",
column_title = NULL,
top_annotation = ta,
right_annotation = ha
) ,
heatmap_legend_side = "right", annotation_legend_side = "bottom"
)
```
## Figure 3c
```{r message=FALSE, warning=FALSE}
df.4c <- read.table("data/fig4c.csv", sep = ",", header = T, stringsAsFactors = F)
df.4c$atlas <- factor(df.4c$atlas, levels = gsub("\\s", "\n", legend_order))
log_scale_y <- scale_y_log10(breaks = trans_breaks("log10", function(x) 10^x),
labels = trans_format("log10", math_format(10^.x)),
limits = c(-1,100)
)
p.4c <- ggplot(data = df.4c, aes(x = gene_number, y = x, colour = atlas)) +
main + log_scale_y +
labs(colour = "Atlas") + xlab("Number of genes") + ylab("Mean time (sec)") +
scale_colour_manual(values=RColorBrewer::brewer.pal(8,colorcode)[c(1:4, 6)]) +
geom_point(size = dotsize) + geom_line(size = linesize) + geom_ribbon(aes(ymin=df.4c$x + df.4c$se, ymax = df.4c$x - df.4c$se), linetype = 1, alpha = 0.1) + xlim(5, 25)
```
### Figure 3
```{r echo=FALSE, fig.height=5, fig.retina=10, fig.width=8, message=FALSE, warning=FALSE}
plot_grid(NULL,
p.4c,
labels = c('A','C'),
nrow = 2, ncol =2
)
```