8
8
9
9
10
10
# ########################################################################################################################################
11
- # Create the figures for the report and the HTML page #
11
+ # Create the figures for the report and the HTML page #
12
12
# ########################################################################################################################################
13
13
14
14
@@ -23,13 +23,13 @@ suppressMessages(suppressWarnings(require("getopt")))
23
23
# Recover the arguments
24
24
# -------------------------------------------------------------------------------
25
25
spec = matrix (c(
26
- " folderFigure" , " folderFigure" , 1 , " character" ,
27
- " folderTemp" , " folderTemp" , 1 , " character" ,
28
- " filename" , " filename" , 1 , " character" ,
29
- " help" , " h" , 0 , " logical"
30
- ),
31
- byrow = TRUE , ncol = 4
32
- )
26
+ " folderFigure" , " folderFigure" , 1 , " character" ,
27
+ " folderTemp" , " folderTemp" , 1 , " character" ,
28
+ " filename" , " filename" , 1 , " character" ,
29
+ " help" , " h" , 0 , " logical"
30
+ ),
31
+ byrow = TRUE , ncol = 4
32
+ )
33
33
34
34
opt = getopt(spec )
35
35
@@ -56,6 +56,7 @@ if ( !is.null(opt$help) )
56
56
suppressMessages(suppressWarnings(library(ggplot2 )))
57
57
suppressMessages(suppressWarnings(library(gplots )))
58
58
suppressMessages(suppressWarnings(library(gtable )))
59
+ suppressMessages(suppressWarnings(library(grid )))
59
60
60
61
61
62
@@ -111,14 +112,13 @@ bar <- bar + theme_classic()
111
112
bar <- bar + xlab(" " )
112
113
# Set the color of the bars and Changing the labels in the legend
113
114
bar <- bar + scale_fill_manual(values = c(" blue" , " black" , " red" , " gray" , " #00CC33" , " pink" ),
114
- labels = c(" C:G>A:T" , " C:G>G:C" , " C:G>T:A" , " T:A>A:T" , " T:A>C:G" , " T:A>G:C" )
115
- )
115
+ labels = c(" C:G>A:T" , " C:G>G:C" , " C:G>T:A" , " T:A>A:T" , " T:A>C:G" , " T:A>G:C" )
116
+ )
116
117
# Remove the label in x axis
117
118
bar <- bar + theme(axis.text.x = element_blank())
118
119
# Change the name of the y label
119
120
bar <- bar + ylab(" Percent" )
120
121
# Save the plot for the HTML page (higher resolution)
121
- options(bitmapType = ' cairo' )
122
122
png(outputDistrSBS , width = 1800 , height = 1500 , res = 300 )
123
123
print(bar )
124
124
dev.off()
@@ -147,7 +147,6 @@ pie <- pie + guides(fill=guide_legend(ncol=2)) + theme(legend.position="bottom")
147
147
# Remove the legend title
148
148
pie <- pie + labs(fill = " " )
149
149
# Save the plot for the HTML page (higher resolution)
150
- options(bitmapType = ' cairo' )
151
150
png(outputImpactProt , width = 1600 , height = 1800 , res = 300 )
152
151
print(pie )
153
152
dev.off()
@@ -172,7 +171,6 @@ cb_palette_SB <- c("#0072B2", "#CC0000")
172
171
# Base plot
173
172
p_sb <- ggplot(file_sb , aes(x = Alteration , y = Count , fill = Strand )) + theme_classic() + geom_bar(stat = " identity" , position = " dodge" ) + scale_fill_manual(values = cb_palette_SB ) + theme(axis.text.x = element_text(angle = 60 , hjust = 1 )) + xlab(" " ) + theme(legend.position = " bottom" )
174
173
# Save the plot for the HTML page (higher resolution)
175
- options(bitmapType = ' cairo' )
176
174
png(outputSB , width = 1000 , height = 1200 , res = 300 )
177
175
print(p_sb )
178
176
dev.off()
@@ -198,27 +196,23 @@ outputHeatmapGenomicPercentReport <- paste0(opt$folderTemp, "/", opt$filename, "
198
196
# # COUNT
199
197
heatmap_C <- read.table(inputHeatmapGenomic , header = T )
200
198
# Save the plot for the report
201
- options(bitmapType = ' cairo' )
202
199
png(filename = outputHeatmapGenomicReport , bg = " transparent" , width = 240 , height = 360 )
203
200
# Heatmap with an absolute scale
204
201
heatmap.2(as.matrix(heatmap_C ),Rowv = F ,Colv = F ,col = colorpanel(384 ,low = " yellow" ,high = " red" ),dendrogram = " none" ,scale = " none" ,trace = " none" ,key = F ,labRow = rownames(as.matrix(heatmap_C )),labCol = colnames(as.matrix(heatmap_C )),lmat = rbind(c(5 ,1 ,4 ),c(3 ,1 ,2 )), lhei = c(0.75 ,0.75 ),lwid = c(0.5 ,1.5 ,0.5 ))
205
202
dev.off()
206
203
# Save the plot for the HTML page (higher resolution)
207
- options(bitmapType = ' cairo' )
208
204
png(filename = outputHeatmapGenomic , width = 1100 , height = 1600 , res = 300 )
209
205
heatmap.2(as.matrix(heatmap_C ),Rowv = F ,Colv = F ,col = colorpanel(384 ,low = " yellow" ,high = " red" ),dendrogram = " none" ,scale = " none" ,trace = " none" ,key = F ,labRow = rownames(as.matrix(heatmap_C )),labCol = colnames(as.matrix(heatmap_C )),lmat = rbind(c(5 ,1 ,4 ),c(3 ,1 ,2 )), lhei = c(0.75 ,0.75 ),lwid = c(0.5 ,1.5 ,0.5 ))
210
206
dev.off()
211
207
212
208
# # PERCENT
213
209
heatmap_P <- read.table(inputHeatmapGenomicPercent , header = T )
214
210
# Save the plot for the report
215
- options(bitmapType = ' cairo' )
216
211
png(filename = outputHeatmapGenomicPercentReport ,bg = " transparent" , width = 240 , height = 360 )
217
212
# Heatmap with an absolute scale
218
213
heatmap.2(as.matrix(heatmap_P ),Rowv = F ,Colv = F ,col = colorpanel(384 ,low = " yellow" ,high = " red" ),dendrogram = " none" ,scale = " none" ,trace = " none" ,key = F ,labRow = rownames(as.matrix(heatmap_P )),labCol = colnames(as.matrix(heatmap_P )),lmat = rbind(c(5 ,1 ,4 ),c(3 ,1 ,2 )), lhei = c(0.75 ,0.75 ),lwid = c(0.5 ,1.5 ,0.5 ))
219
214
dev.off()
220
215
# Save the plot for the HTML page (higher resolution)
221
- options(bitmapType = ' cairo' )
222
216
png(filename = outputHeatmapGenomicPercent , width = 1100 , height = 1600 , res = 300 )
223
217
heatmap.2(as.matrix(heatmap_P ),Rowv = F ,Colv = F ,col = colorpanel(384 ,low = " yellow" ,high = " red" ),dendrogram = " none" ,scale = " none" ,trace = " none" ,key = F ,labRow = rownames(as.matrix(heatmap_P )),labCol = colnames(as.matrix(heatmap_P )),lmat = rbind(c(5 ,1 ,4 ),c(3 ,1 ,2 )), lhei = c(0.75 ,0.75 ),lwid = c(0.5 ,1.5 ,0.5 ))
224
218
dev.off()
0 commit comments