comparison ggplotscripthistogram.R @ 5:097e19ec0150 draft

Uploaded
author moheydarian
date Sun, 12 Mar 2017 19:28:08 -0400
parents 72abdc872e49
children 90be6d1315a4
comparison
equal deleted inserted replaced
4:25c690797274 5:097e19ec0150
34 'transform', 'c', 2, 'character', 34 'transform', 'c', 2, 'character',
35 'woutputdim', 'w', 2, 'integer', 35 'woutputdim', 'w', 2, 'integer',
36 'houtputdim', 'd', 2, 'integer', 36 'houtputdim', 'd', 2, 'integer',
37 'dim', 'k', 2, 'character', 37 'dim', 'k', 2, 'character',
38 'scaling', 'j', 2, 'character', 38 'scaling', 'j', 2, 'character',
39 'legend', 'l', 2, 'character',
39 'output', 'o', 2, 'character' 40 'output', 'o', 2, 'character'
40 ), byrow=TRUE, ncol=4); 41 ), byrow=TRUE, ncol=4);
41 42
42 # Parse options 43 # Parse options
43 options = getopt(option_specification); 44 options = getopt(option_specification);
55 cat("\n output: ",options$output) 56 cat("\n output: ",options$output)
56 57
57 integrated <- read.csv(options$input,sep='\t',header=TRUE) 58 integrated <- read.csv(options$input,sep='\t',header=TRUE)
58 input <- melt(integrated) 59 input <- melt(integrated)
59 60
61 gg_legend = show.legend=options$legend
60 62
61 #Choose between automatically scaled x and y axis or user defined 63 #Choose between automatically scaled x and y axis or user defined
62 if(options$scaling == "Automatic"){ 64 if(options$scaling == "Automatic"){
63 gg_scalex = NULL 65 gg_scalex = NULL
64 gg_scaley = NULL 66 gg_scaley = NULL
105 gg_colorscale = scale_color_brewer(palette=options$colors, direction=options$colororder) 107 gg_colorscale = scale_color_brewer(palette=options$colors, direction=options$colororder)
106 } 108 }
107 109
108 ggplot(input,aes(value,color=variable)) + 110 ggplot(input,aes(value,color=variable)) +
109 geom_freqpoly(binwidth=options$binwidth,size=options$size)+gg_facet+gg_colorscale+ 111 geom_freqpoly(binwidth=options$binwidth,size=options$size)+gg_facet+gg_colorscale+
110 gg_scalex+gg_scaley+theme_bw()+xlab(options$xlab)+ylab(options$ylab)+ 112 gg_scalex+gg_scaley+theme_bw()+xlab(options$xlab)+ylab(options$ylab)+gg_legend+
111 ggtitle(options$title) 113 ggtitle(options$title)
112 114
113 ggsave(file=options$output) 115 ggsave(file=options$output)