-
Notifications
You must be signed in to change notification settings - Fork 1
/
boxplot_histplot.Rmd
79 lines (59 loc) · 2.36 KB
/
boxplot_histplot.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
---
title: "Box_Hist_plot"
author: "Chengqi(Charley) Wang"
date: "2/4/2020"
output: html_document
---
---
<br/><br/>
####load the significant differential genes normalized by DESeq
```{r}
load('~/Documents/work/paper_write/genome_training/R_training/deseq.sig.R')
colnames(sigNorData) <- c('c1','c2','t1','t2')
```
<br/><br/>
####Draw the boxplot for up-regulated gene
```{r}
dfHigh <- sigNorData[which(resSig$foldChange > 1),]
boxplot(dfHigh)
## remove the outline
boxplot(dfHigh, outline = F)
## change the color of the box
boxplot(dfHigh, outline = F, col = c('red','red',
'navy','navy'))
##remove the boarder
boxplot(dfHigh, outline = F, col = c('red','red','navy','navy'),
border = c('red','red','navy','navy'))
## add the median color
boxplot(dfHigh, outline = F, col = c('red','red',
'navy','navy'),
border = c('red','red','navy','navy'),
medcol = rep('white', 4))
```
<br/><br/>
####Draw the histplot for up-regulated gene
```{r}
dfLow <- sigNorData[which(resSig$foldChange < 1),]
dfLow_mean <- data.frame(cMean = (dfLow[,1] + dfLow[,2])/2,
tMean = (dfLow[,3] + dfLow[,4])/2)
###draw seperate histplot
par(mar = c(4,4,1,1), mfrow = c(2,1))
hist(dfLow_mean$cMean)
hist(dfLow_mean$tMean)
###draw histplot with same x-axis range
hist(dfLow_mean$cMean, xlim = c(0,10000))
hist(dfLow_mean$tMean, xlim = c(0,10000))
###draw histplot with same number of bar
hist(dfLow_mean$cMean, xlim = c(0,10000), breaks = seq(0,10000,length.out = 30))
hist(dfLow_mean$tMean, xlim = c(0,10000), , breaks = seq(0,10000,length.out = 30))
###with different color
hist(dfLow_mean$cMean, xlim = c(0,10000), breaks = seq(0,10000,length.out = 30), col = 'red')
hist(dfLow_mean$tMean, xlim = c(0,10000), , breaks = seq(0,10000,length.out = 30), col = 'navy')
###merge them together
hist(dfLow_mean$cMean, xlim = c(0,10000), breaks = seq(0,10000,length.out = 30), col = 'red', ylim = c(0,25))
hist(dfLow_mean$tMean, xlim = c(0,10000), , breaks = seq(0,10000,length.out = 30), col = 'navy', add = T)
## make the color navy transparent
hist(dfLow_mean$cMean, xlim = c(0,10000), breaks = seq(0,10000,length.out = 30), col = 'red', ylim = c(0,25))
hist(dfLow_mean$tMean, xlim = c(0,10000), , breaks = seq(0,10000,length.out = 30), col = rgb(0,0,128, max = 255, alpha = 100),
add = T)
```