Mercurial > repos > iuc > ggplot2_histogram
comparison ggplot_histogram.xml @ 0:9d060114554c draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ggplot2 commit 6e466ce83e2e5c0dd0ba30356d0488cf74574b8f
author | iuc |
---|---|
date | Tue, 22 Aug 2017 06:41:36 -0400 |
parents | |
children | f52035800250 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9d060114554c |
---|---|
1 <tool id="ggplot2_histogram" name="Histogram w ggplot2" version="@VERSION@"> | |
2 <macros> | |
3 <import>macros.xml</import> | |
4 </macros> | |
5 <expand macro="requirements"> | |
6 <requirement type="package" version="1.4.2">r-reshape2</requirement> | |
7 </expand> | |
8 <command detect_errors="exit_code"><![CDATA[ | |
9 cat '$script' && | |
10 Rscript '$script' | |
11 ]]></command> | |
12 <configfiles> | |
13 <configfile name="script"><![CDATA[ | |
14 | |
15 @R_INIT@ | |
16 | |
17 ## Import library | |
18 library("reshape2") | |
19 library("ggplot2") | |
20 | |
21 integrated <- read.csv('$input1', sep='\t', header=TRUE) | |
22 input <- melt(integrated) | |
23 | |
24 ## Show/hide legend | |
25 #if $legend == "yes" | |
26 gg_legend = NULL | |
27 #else | |
28 gg_legend = theme(legend.position="none") | |
29 #end if | |
30 | |
31 ## density | |
32 #if $density == "counts" | |
33 gg_density = ggplot(input,aes(value, color=variable)) | |
34 gg_freq = NULL | |
35 #elif $density == "nfreq" | |
36 gg_density = ggplot(input,aes(value, ..ncount.., color=variable)) | |
37 gg_freq = NULL | |
38 #elif $density == "freq" | |
39 gg_density = ggplot(input,aes(value, color=variable)) | |
40 gg_freq = aes(y=..count../sum(..count..)) | |
41 #end if | |
42 | |
43 @XY_SCALING@ | |
44 | |
45 gg_width = $with_output_dim | |
46 gg_height = $height_output_dim | |
47 | |
48 | |
49 @TRANSFORM@ | |
50 | |
51 #if $facet == "facet" | |
52 gg_facet = facet_wrap(~ variable) | |
53 #else | |
54 gg_facet = NULL | |
55 #end if | |
56 | |
57 #if $coloring.colorscheme == "Default" | |
58 gg_colorscale = NULL | |
59 #else | |
60 gg_colorscale = scale_color_brewer(palette=$coloring.colors, direction=$coloring.colororder) | |
61 #end if | |
62 | |
63 gg_density+ | |
64 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') | |
66 | |
67 ggsave(file='Rplot.pdf') | |
68 dev.off() | |
69 ]]></configfile> | |
70 </configfiles> | |
71 <inputs> | |
72 <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" /> | |
74 <expand macro="xy_lab" /> | |
75 <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"/> | |
77 | |
78 <expand macro="transform" /> | |
79 | |
80 <param name="density" type="select" label="Advanced - plot counts or density"> | |
81 <option value="counts">Plot counts 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> | |
94 <when value="Default"> | |
95 </when> | |
96 <when value="Defined"> | |
97 <expand macro="colors" /> | |
98 <param name="colororder" type="select" label="Reverse color scheme" > | |
99 <option value="1">Default order of color scheme</option> | |
100 <option value="-1">Reverse the order of my color scheme</option> | |
101 </param> | |
102 </when> | |
103 </conditional> | |
104 <expand macro="xy_scaling" /> | |
105 <expand macro="dimensions" /> | |
106 <param name="legend" type="select" label="Legend options"> | |
107 <option value="yes">Include legend on plot</option> | |
108 <option value="no">Hide legend</option> | |
109 </param> | |
110 </inputs> | |
111 <outputs> | |
112 <!-- <data name="output1" format="png" from_work_dir="Rplot.png"/> | |
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> | |
117 <tests> | |
118 <test> | |
119 <param name="input1" value="mtcars.txt"/> | |
120 <output name="output1" file="ggplot_histogram_result1.pdf" compare="sim_size"/> | |
121 </test> | |
122 </tests> | |
123 <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). | |
126 | |
127 Input data example: | |
128 ID Cond_A Cond_B | |
129 gene_A 10 15 | |
130 gene_B 8 12 | |
131 gene_C 10 15 | |
132 gene_D 6 9 | |
133 gene_E 9 13.5 | |
134 gene_F 8 12 | |
135 | |
136 ]]></help> | |
137 <expand macro="citations"/> | |
138 </tool> |