Mercurial > repos > iuc > ggplot2_histogram
comparison ggplot_histogram.xml @ 2:f52035800250 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit f9fb73a88ab8b52ce11c25a966d4fe99e67c9fbf
author | iuc |
---|---|
date | Mon, 11 Jun 2018 16:05:18 -0400 |
parents | 9d060114554c |
children | 536078949ae4 |
comparison
equal
deleted
inserted
replaced
1:d3d92fb20389 | 2:f52035800250 |
---|---|
1 <tool id="ggplot2_histogram" name="Histogram w ggplot2" version="@VERSION@"> | 1 <tool id="ggplot2_histogram" name="Histogram w ggplot2" version="@VERSION@+galaxy0"> |
2 <macros> | 2 <macros> |
3 <import>macros.xml</import> | 3 <import>macros.xml</import> |
4 </macros> | 4 </macros> |
5 <expand macro="requirements"> | 5 <expand macro="requirements"> |
6 <requirement type="package" version="1.4.2">r-reshape2</requirement> | 6 <requirement type="package" version="1.4.3">r-reshape2</requirement> |
7 <requirement type="package" version="1.2.1">r-svglite</requirement> | |
7 </expand> | 8 </expand> |
8 <command detect_errors="exit_code"><![CDATA[ | 9 <command detect_errors="exit_code"><![CDATA[ |
9 cat '$script' && | 10 cat '$script' && |
10 Rscript '$script' | 11 Rscript '$script' |
11 ]]></command> | 12 ]]></command> |
12 <configfiles> | 13 <configfiles> |
13 <configfile name="script"><![CDATA[ | 14 <configfile name="script"><![CDATA[ |
14 | |
15 @R_INIT@ | 15 @R_INIT@ |
16 | 16 |
17 ## Import library | 17 ## Import library |
18 library("reshape2") | 18 library(reshape2) |
19 library("ggplot2") | 19 library(ggplot2) |
20 | 20 |
21 integrated <- read.csv('$input1', sep='\t', header=TRUE) | 21 integrated <- read.csv('$input1', sep='\t', header=TRUE) |
22 input <- melt(integrated) | 22 input <- melt(integrated) |
23 | 23 |
24 ## Show/hide legend | 24 @LEGEND@ |
25 #if $legend == "yes" | |
26 gg_legend = NULL | |
27 #else | |
28 gg_legend = theme(legend.position="none") | |
29 #end if | |
30 | 25 |
31 ## density | 26 ## density |
32 #if $density == "counts" | 27 #if $adv.density == "counts" |
33 gg_density = ggplot(input,aes(value, color=variable)) | 28 gg_density = ggplot(input,aes(value, color=variable)) |
34 gg_freq = NULL | 29 gg_freq = NULL |
35 #elif $density == "nfreq" | 30 #elif $adv.density == "nfreq" |
36 gg_density = ggplot(input,aes(value, ..ncount.., color=variable)) | 31 gg_density = ggplot(input,aes(value, ..ncount.., color=variable)) |
37 gg_freq = NULL | 32 gg_freq = NULL |
38 #elif $density == "freq" | 33 #elif $adv.density == "freq" |
39 gg_density = ggplot(input,aes(value, color=variable)) | 34 gg_density = ggplot(input,aes(value, color=variable)) |
40 gg_freq = aes(y=..count../sum(..count..)) | 35 gg_freq = aes(y=..count../sum(..count..)) |
41 #end if | 36 #end if |
42 | 37 |
38 @TRANSFORM@ | |
39 | |
43 @XY_SCALING@ | 40 @XY_SCALING@ |
44 | 41 |
45 gg_width = $with_output_dim | 42 @THEME@ |
46 gg_height = $height_output_dim | |
47 | 43 |
48 | 44 #if $adv.facet == "facet" |
49 @TRANSFORM@ | |
50 | |
51 #if $facet == "facet" | |
52 gg_facet = facet_wrap(~ variable) | 45 gg_facet = facet_wrap(~ variable) |
53 #else | 46 #else |
54 gg_facet = NULL | 47 gg_facet = NULL |
55 #end if | 48 #end if |
56 | 49 |
57 #if $coloring.colorscheme == "Default" | 50 #if $adv.coloring.colorscheme == "Default" |
58 gg_colorscale = NULL | 51 gg_colorscale = NULL |
59 #else | 52 #else |
60 gg_colorscale = scale_color_brewer(palette=$coloring.colors, direction=$coloring.colororder) | 53 gg_colorscale = scale_color_brewer(palette=$adv.coloring.colors, direction=$adv.coloring.colororder) |
61 #end if | 54 #end if |
62 | 55 |
63 gg_density+ | 56 plot_out <- gg_density + |
64 geom_freqpoly(gg_freq, binwidth=$binwidth, size=$size)+gg_facet+gg_colorscale+ | 57 geom_freqpoly(gg_freq, binwidth=$binwidth, size=$size) + gg_facet + gg_colorscale + |
65 gg_scalex+gg_scaley+theme_bw()+xlab('$xlab')+ylab('$ylab')+gg_legend+ggtitle('$title') | 58 gg_scalex + |
59 gg_scaley + | |
60 gg_theme + | |
61 xlab('$xlab') + | |
62 ylab('$ylab') + | |
63 gg_legend + | |
64 ggtitle('$title') + | |
65 theme(plot.title = element_text(hjust = 0.5)) | |
66 | 66 |
67 ggsave(file='Rplot.pdf') | 67 @SAVE_OUTPUT@ |
68 dev.off() | |
69 ]]></configfile> | 68 ]]></configfile> |
70 </configfiles> | 69 </configfiles> |
71 <inputs> | 70 <inputs> |
72 <param name="input1" type="data" format="tabular" label="Input should have column headers - these will be the columns that are plotted"/> | 71 <param name="input1" type="data" format="tabular" label="Input should have column headers - these will be the columns that are plotted"/> |
73 <expand macro="title" /> | 72 <expand macro="title" /> |
74 <expand macro="xy_lab" /> | 73 <expand macro="xy_lab" /> |
75 <param name="size" type="float" value="1.0" label="relative line width" /> | 74 <param name="size" type="float" value="1.0" label="relative line width" /> |
76 <param name="binwidth" type="float" value="0.5" label="Bin width for plotting"/> | 75 <param name="binwidth" type="float" value="0.5" label="Bin width for plotting"/> |
77 | 76 <section name="adv" title="Advanced Options" expanded="false"> |
78 <expand macro="transform" /> | 77 <param name="density" type="select" label="Plot counts or density"> |
79 | 78 <option value="counts">Plot counts on the y-axis</option> |
80 <param name="density" type="select" label="Advanced - plot counts or density"> | 79 <option value="freq">Plot frequency on the y-axis</option> |
81 <option value="counts">Plot counts on the y-axis</option> | 80 <option value="nfreq">Plot normalized frequency on the y-axis</option> |
82 <option value="freq">Plot frequency on the y-axis</option> | |
83 <option value="nfreq">Plot normalized frequency on the y-axis</option> | |
84 </param> | |
85 <param name="facet" type="select" label="Advanced - faceting"> | |
86 <option value="none">Plot my groups on one plot</option> | |
87 <option value="facet">Plot my groups on individual plots</option> | |
88 </param> | |
89 <conditional name="coloring"> | |
90 <param name="colorscheme" type="select" label="Advanced - coloring groups" > | |
91 <option value="Default" selected="True">No thanks - just use the default scheme to color code my groups (columns)</option> | |
92 <option value="Defined">I want to use defined color palettes to differentiate my groups (columns) </option> | |
93 </param> | 81 </param> |
94 <when value="Default"> | 82 <param name="facet" type="select" label="Faceting"> |
95 </when> | 83 <option value="none">Plot my groups on one plot</option> |
96 <when value="Defined"> | 84 <option value="facet">Plot my groups on individual plots</option> |
97 <expand macro="colors" /> | 85 </param> |
98 <param name="colororder" type="select" label="Reverse color scheme" > | 86 <conditional name="coloring"> |
99 <option value="1">Default order of color scheme</option> | 87 <param name="colorscheme" type="select" label="Coloring groups" > |
100 <option value="-1">Reverse the order of my color scheme</option> | 88 <option value="Default" selected="true">No thanks - just use the default scheme to color code my groups (columns)</option> |
101 </param> | 89 <option value="Defined">I want to use defined color palettes to differentiate my groups (columns) </option> |
102 </when> | 90 </param> |
103 </conditional> | 91 <when value="Default"> |
104 <expand macro="xy_scaling" /> | 92 </when> |
105 <expand macro="dimensions" /> | 93 <when value="Defined"> |
106 <param name="legend" type="select" label="Legend options"> | 94 <expand macro="colors" /> |
107 <option value="yes">Include legend on plot</option> | 95 <param name="colororder" type="select" label="Reverse color scheme" > |
108 <option value="no">Hide legend</option> | 96 <option value="1">Default order of color scheme</option> |
109 </param> | 97 <option value="-1">Reverse the order of my color scheme</option> |
98 </param> | |
99 </when> | |
100 </conditional> | |
101 <expand macro="transform" /> | |
102 <expand macro="xy_scaling" /> | |
103 <expand macro="theme" /> | |
104 <expand macro="legend" /> | |
105 </section> | |
106 <section name="out" title="Output Options" expanded="true"> | |
107 <expand macro="dimensions" /> | |
108 </section> | |
110 </inputs> | 109 </inputs> |
111 <outputs> | 110 <outputs> |
112 <!-- <data name="output1" format="png" from_work_dir="Rplot.png"/> | 111 <expand macro="additional_output" /> |
113 ToDo: It would be nice to have different output formats for all tools | |
114 --> | |
115 <data name="output1" format="pdf" from_work_dir="Rplot.pdf"/> | |
116 </outputs> | 112 </outputs> |
117 <tests> | 113 <tests> |
118 <test> | 114 <test> |
119 <param name="input1" value="mtcars.txt"/> | 115 <param name="input1" value="mtcars.txt"/> |
120 <output name="output1" file="ggplot_histogram_result1.pdf" compare="sim_size"/> | 116 <param name="additional_output_format" value="pdf" /> |
117 <output name="output2" file="ggplot_histogram_result1.pdf" compare="sim_size"/> | |
121 </test> | 118 </test> |
122 </tests> | 119 </tests> |
123 <help><![CDATA[ | 120 <help><![CDATA[ |
124 | |
125 This tool will generate a histogram representing the distrinutions of each numerical column. Each column should have a descriptive header with no spaces, which will be used in the plot legend to represent the corresponding column (group). | 121 This tool will generate a histogram representing the distrinutions of each numerical column. Each column should have a descriptive header with no spaces, which will be used in the plot legend to represent the corresponding column (group). |
126 | 122 |
127 Input data example: | 123 Input data example: |
128 ID Cond_A Cond_B | 124 ID Cond_A Cond_B |
129 gene_A 10 15 | 125 gene_A 10 15 |
130 gene_B 8 12 | 126 gene_B 8 12 |
131 gene_C 10 15 | 127 gene_C 10 15 |
132 gene_D 6 9 | 128 gene_D 6 9 |
133 gene_E 9 13.5 | 129 gene_E 9 13.5 |
134 gene_F 8 12 | 130 gene_F 8 12 |
135 | |
136 ]]></help> | 131 ]]></help> |
137 <expand macro="citations"/> | 132 <expand macro="citations"/> |
138 </tool> | 133 </tool> |