-
Notifications
You must be signed in to change notification settings - Fork 0
/
PRAD_methods_S8_volcano.Rmd
80 lines (65 loc) · 2.72 KB
/
PRAD_methods_S8_volcano.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: "R Notebook"
output: html_notebook
---
This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code.
Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Cmd+Shift+Enter*.
```{r}
```
```{r}
library(EnhancedVolcano);
library(gtable);
library(gridExtra)
```
```{r}
dataExpr = read.csv("01_DEGsTreat_PRAD.csv");
head(dataExpr[1:6])
```
```{r}
itgExpr = dataExpr[grep("ITG",dataExpr$X),];
sig_itgExpr=subset(itgExpr, (itgExpr$logFC < -0.58 & itgExpr$adj.P.Val < 0.05) | (itgExpr$logFC > 0.58 & itgExpr$adj.P.Val < 0.05) );
sig_itgExpr
```
```{r}
keyvals = ifelse(dataExpr$logFC < -0.58 & dataExpr$adj.P.Val < 0.05, 'blue',
ifelse(dataExpr$logFC > 0.58 & dataExpr$adj.P.Val < 0.05, 'red',
'grey30'));
keyvals[is.na(keyvals)] ='grey30';
names(keyvals)[keyvals == 'red'] = 'Up-regulated';
names(keyvals)[keyvals == 'blue'] = 'Down-regulated';
names(keyvals)[keyvals == 'grey30'] = 'Not Significant'
```
```{r}
p = EnhancedVolcano(dataExpr,
lab = dataExpr$X,
x = 'logFC',
y = "adj.P.Val",
selectLab = sig_itgExpr$X,
xlim = c(-6,6),
ylim = c(0,15),
xlab = "Effect Size: log2 Fold Change",
ylab = "Significance: -log(FDR)",
axisLabSize = 14,
pCutoff = 0.05,
FCcutoff = 0.58,
title ="PRAD TCGA normal vs Tumor",
titleLabSize = 14,
subtitle = NULL,
caption = NULL,
pointSize = 1.5,
colCustom = keyvals,
colAlpha = 0.5,
legendPosition = 'none',
legendLabSize = 12,
legendIconSize = 3,
gridlines.major = FALSE,
gridlines.minor = FALSE,
boxedLabels = TRUE,
drawConnectors = TRUE,
widthConnectors = 2.0,
colConnectors = 'green');
p
```
Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Cmd+Option+I*.
When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Cmd+Shift+K* to preview the HTML file).
The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike *Knit*, *Preview* does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.