comparison pattern_plots.r @ 1:faae21ba5c63 draft

Uploaded
author davidvanzessen
date Tue, 25 Oct 2016 07:28:43 -0400
parents c33d93683a09
children 012a738edf5a
comparison
equal deleted inserted replaced
0:c33d93683a09 1:faae21ba5c63
43 data1 = data1[order(data1$Type),] 43 data1 = data1[order(data1$Type),]
44 44
45 write.table(data1, plot1.txt, quote=F, sep="\t", na="", row.names=F, col.names=T) 45 write.table(data1, plot1.txt, quote=F, sep="\t", na="", row.names=F, col.names=T)
46 46
47 p = ggplot(data1, aes(Class, value)) + geom_bar(aes(fill=Type), stat="identity", position="dodge", colour = "black") + ylab("% of mutations") + guides(fill=guide_legend(title=NULL)) 47 p = ggplot(data1, aes(Class, value)) + geom_bar(aes(fill=Type), stat="identity", position="dodge", colour = "black") + ylab("% of mutations") + guides(fill=guide_legend(title=NULL))
48 p = p + theme(panel.background = element_rect(fill = "white", colour="black")) + scale_fill_manual(values=c("RGYW.WRCY" = "white", "TW.WA" = "blue4")) 48 p = p + theme(panel.background = element_rect(fill = "white", colour="black"),text = element_text(size=13, colour="black")) + scale_fill_manual(values=c("RGYW.WRCY" = "white", "TW.WA" = "blue4"))
49 #p = p + scale_colour_manual(values=c("RGYW.WRCY" = "black", "TW.WA" = "blue4")) 49 #p = p + scale_colour_manual(values=c("RGYW.WRCY" = "black", "TW.WA" = "blue4"))
50 png(filename=plot1.png, width=480, height=300) 50 png(filename=plot1.png, width=480, height=300)
51 print(p) 51 print(p)
52 dev.off() 52 dev.off()
53 53
77 data2 = data2[order(data2$Type),] 77 data2 = data2[order(data2$Type),]
78 78
79 write.table(data2, plot2.txt, quote=F, sep="\t", na="", row.names=F, col.names=T) 79 write.table(data2, plot2.txt, quote=F, sep="\t", na="", row.names=F, col.names=T)
80 80
81 p = ggplot(data2, aes(x=Class, y=value, fill=Type)) + geom_bar(position="fill", stat="identity", colour = "black") + scale_y_continuous(labels=percent_format()) + guides(fill=guide_legend(title=NULL)) + ylab("% of mutations") 81 p = ggplot(data2, aes(x=Class, y=value, fill=Type)) + geom_bar(position="fill", stat="identity", colour = "black") + scale_y_continuous(labels=percent_format()) + guides(fill=guide_legend(title=NULL)) + ylab("% of mutations")
82 p = p + theme(panel.background = element_rect(fill = "white", colour="black")) + scale_fill_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "white")) 82 p = p + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=13, colour="black")) + scale_fill_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "white"))
83 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black")) 83 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black"))
84 png(filename=plot2.png, width=480, height=300) 84 png(filename=plot2.png, width=480, height=300)
85 print(p) 85 print(p)
86 dev.off() 86 dev.off()
87 87
113 data3 = data3[order(data3$Type),] 113 data3 = data3[order(data3$Type),]
114 114
115 write.table(data3, plot3.txt, quote=F, sep="\t", na="", row.names=F, col.names=T) 115 write.table(data3, plot3.txt, quote=F, sep="\t", na="", row.names=F, col.names=T)
116 116
117 p = ggplot(data3, aes(Class, value)) + geom_bar(aes(fill=Type), stat="identity", position="dodge", colour = "black") + ylab("% of nucleotides") + guides(fill=guide_legend(title=NULL)) 117 p = ggplot(data3, aes(Class, value)) + geom_bar(aes(fill=Type), stat="identity", position="dodge", colour = "black") + ylab("% of nucleotides") + guides(fill=guide_legend(title=NULL))
118 p = p + theme(panel.background = element_rect(fill = "white", colour="black")) + scale_fill_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "white")) 118 p = p + theme(panel.background = element_rect(fill = "white", colour="black"), text = element_text(size=13, colour="black")) + scale_fill_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "white"))
119 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black")) 119 #p = p + scale_colour_manual(values=c("A/T" = "blue4", "G/C transversions" = "gray74", "G/C transitions" = "black"))
120 png(filename=plot3.png, width=480, height=300) 120 png(filename=plot3.png, width=480, height=300)
121 print(p) 121 print(p)
122 dev.off() 122 dev.off()
123 123