####load the significant differential genes normalized by DESeq

load('~/Documents/work/paper_write/genome_training/R_training/deseq.sig.R')
colnames(sigNorData) <- c('c1','c2','t1','t2')



####Draw the boxplot for up-regulated gene

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))



####Draw the histplot for up-regulated gene

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)