Mercurial > repos > davidvanzessen > shm_csr
comparison pattern_plots.r @ 42:1cf60ae234b4 draft
Uploaded
author | davidvanzessen |
---|---|
date | Tue, 28 Mar 2017 08:25:36 -0400 |
parents | a24f8c93583a |
children |
comparison
equal
deleted
inserted
replaced
41:b8ac74723ab0 | 42:1cf60ae234b4 |
---|---|
7 input.file = args[1] #the data that's get turned into the "SHM overview" table in the html report "data_sum.txt" | 7 input.file = args[1] #the data that's get turned into the "SHM overview" table in the html report "data_sum.txt" |
8 | 8 |
9 plot1.path = args[2] | 9 plot1.path = args[2] |
10 plot1.png = paste(plot1.path, ".png", sep="") | 10 plot1.png = paste(plot1.path, ".png", sep="") |
11 plot1.txt = paste(plot1.path, ".txt", sep="") | 11 plot1.txt = paste(plot1.path, ".txt", sep="") |
12 plot1.pdf = paste(plot1.path, ".pdf", sep="") | |
12 | 13 |
13 plot2.path = args[3] | 14 plot2.path = args[3] |
14 plot2.png = paste(plot2.path, ".png", sep="") | 15 plot2.png = paste(plot2.path, ".png", sep="") |
15 plot2.txt = paste(plot2.path, ".txt", sep="") | 16 plot2.txt = paste(plot2.path, ".txt", sep="") |
17 plot2.pdf = paste(plot2.path, ".pdf", sep="") | |
16 | 18 |
17 plot3.path = args[4] | 19 plot3.path = args[4] |
18 plot3.png = paste(plot3.path, ".png", sep="") | 20 plot3.png = paste(plot3.path, ".png", sep="") |
19 plot3.txt = paste(plot3.path, ".txt", sep="") | 21 plot3.txt = paste(plot3.path, ".txt", sep="") |
22 plot3.pdf = paste(plot3.path, ".pdf", sep="") | |
20 | 23 |
21 clean.output = args[5] | 24 clean.output = args[5] |
22 | 25 |
23 dat = read.table(input.file, header=F, sep=",", quote="", stringsAsFactors=F, fill=T, row.names=1) | 26 dat = read.table(input.file, header=F, sep=",", quote="", stringsAsFactors=F, fill=T, row.names=1) |
24 | |
25 | |
26 | 27 |
27 classes = c("IGA", "IGA1", "IGA2", "IGG", "IGG1", "IGG2", "IGG3", "IGG4", "IGM", "IGE") | 28 classes = c("IGA", "IGA1", "IGA2", "IGG", "IGG1", "IGG2", "IGG3", "IGG4", "IGM", "IGE") |
28 xyz = c("x", "y", "z") | 29 xyz = c("x", "y", "z") |
29 new.names = c(paste(rep(classes, each=3), xyz, sep="."), paste("un", xyz, sep="."), paste("all", xyz, sep=".")) | 30 new.names = c(paste(rep(classes, each=3), xyz, sep="."), paste("un", xyz, sep="."), paste("all", xyz, sep=".")) |
30 | 31 |
61 #p = p + scale_colour_manual(values=c("RGYW.WRCY" = "black", "TW.WA" = "blue4")) | 62 #p = p + scale_colour_manual(values=c("RGYW.WRCY" = "black", "TW.WA" = "blue4")) |
62 png(filename=plot1.png, width=510, height=300) | 63 png(filename=plot1.png, width=510, height=300) |
63 print(p) | 64 print(p) |
64 dev.off() | 65 dev.off() |
65 | 66 |
67 ggsave(plot1.pdf, p) | |
68 | |
66 data2 = dat[c(1, 5:8),] | 69 data2 = dat[c(1, 5:8),] |
67 | 70 |
68 data2 = data2[,names(data2)[grepl("\\.x", names(data2))]] | 71 data2 = data2[,names(data2)[grepl("\\.x", names(data2))]] |
69 names(data2) = gsub(".x", "", names(data2)) | 72 names(data2) = gsub(".x", "", names(data2)) |
70 | 73 |
97 p = p + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=15, colour="black"), axis.text.x = element_text(angle = 45, hjust = 1)) + scale_fill_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "white")) | 100 p = p + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=15, colour="black"), axis.text.x = element_text(angle = 45, hjust = 1)) + scale_fill_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "white")) |
98 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black")) | 101 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black")) |
99 png(filename=plot2.png, width=480, height=300) | 102 png(filename=plot2.png, width=480, height=300) |
100 print(p) | 103 print(p) |
101 dev.off() | 104 dev.off() |
105 | |
106 ggsave(plot2.pdf, p) | |
102 | 107 |
103 data3 = dat[c(5, 6, 8, 17:20),] | 108 data3 = dat[c(5, 6, 8, 17:20),] |
104 data3 = data3[,names(data3)[grepl("\\.x", names(data3))]] | 109 data3 = data3[,names(data3)[grepl("\\.x", names(data3))]] |
105 names(data3) = gsub(".x", "", names(data3)) | 110 names(data3) = gsub(".x", "", names(data3)) |
106 | 111 |
136 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black")) | 141 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black")) |
137 png(filename=plot3.png, width=480, height=300) | 142 png(filename=plot3.png, width=480, height=300) |
138 print(p) | 143 print(p) |
139 dev.off() | 144 dev.off() |
140 | 145 |
146 ggsave(plot3.pdf, p) | |
141 | 147 |
142 | 148 |
143 | 149 |
144 | 150 |
145 | 151 |
167 | 173 |
168 | 174 |
169 | 175 |
170 | 176 |
171 | 177 |
178 |