|
0
|
1 <tool id="GroupCompute" name="Group and Compute" version="1.0.2">
|
|
|
2 <description>operations on tabular data.</description>
|
|
|
3 <command>
|
|
|
4 compute
|
|
|
5 $header_in
|
|
|
6 $header_out
|
|
|
7 $need_sort
|
|
|
8 $print_full_line
|
|
|
9 $ignore_case
|
|
|
10 #if str($grouping)>0
|
|
|
11 --group '$grouping'
|
|
|
12 #end if
|
|
|
13 -T
|
|
|
14 #for $oper in $operations
|
|
|
15 ${oper.op_name}
|
|
|
16 ${oper.op_column}
|
|
|
17 #end for
|
|
|
18 < $in_file > $out_file
|
|
|
19 </command>
|
|
|
20 <inputs>
|
|
|
21 <param format="tabular" name="in_file" type="data" label="Select Input Data" help=""/>
|
|
|
22
|
|
|
23 <param name="grouping" label="Group by fields" type="text" help="Example: 1,4 - To group by the first and fourth fields. Leave empty to perform operation on entire file as one group."/>
|
|
|
24
|
|
|
25 <param name="header_in" type="boolean" truevalue="--header-in" falsevalue=""
|
|
|
26 label="Input file has a header line" help="Mark this if the input file's first line is a header line" />
|
|
|
27
|
|
|
28 <param name="header_out" type="boolean" truevalue="--header-out" falsevalue=""
|
|
|
29 label="Print header line" help="Mark this if you want the first line to show the field names" />
|
|
|
30
|
|
|
31 <param name="need_sort" type="boolean" truevalue="--sort" falsevalue=""
|
|
|
32 label="Sort input" help="Mark if the input file is not sorted. If the input file is already sorted, unmark this option to reduce computing time." />
|
|
|
33
|
|
|
34 <param name="print_full_line" type="boolean" truevalue="--full" falsevalue=""
|
|
|
35 label="Print all fields from input file" help="If set, all input fields will be printed. If unset, only fields used for grouping will be printed." />
|
|
|
36
|
|
|
37 <param name="ignore_case" type="boolean" truevalue="--ignore-case" falsevalue=""
|
|
|
38 label="Ignore case when grouping" help="If set, upper/lowercase differences will be ignored when grouping fields." />
|
|
|
39
|
|
|
40 <repeat name="operations" title="Operation to perform on each group">
|
|
|
41 <param name="op_name" type="select" label="Type">
|
|
|
42 <option value="count">count</option>
|
|
|
43 <option value="sum">sum</option>
|
|
|
44 <option value="min">minimum</option>
|
|
|
45 <option value="max">maximum</option>
|
|
|
46 <option value="absmin">Absolute minimum</option>
|
|
|
47 <option value="absmax">Absolute maximum</option>
|
|
|
48 <option value="mean">Mean</option>
|
|
|
49 <option value="median">Median</option>
|
|
|
50 <option value="mode">Mode</option>
|
|
|
51 <option value="antimode">Anti-Mode</option>
|
|
|
52 <option value="pstdev">Population Standard deviantion</option>
|
|
|
53 <option value="sstdev">Sample Standard deviantion</option>
|
|
|
54 <option value="unique">Combine all unique values</option>
|
|
|
55 <option value="collapse">Combine all values</option>
|
|
|
56 <option value="countunique">Count Unique values</option>
|
|
|
57 </param>
|
|
|
58 <param name="op_column" label="On column" type="data_column" data_ref="in_file" />
|
|
|
59 </repeat>
|
|
|
60 </inputs>
|
|
|
61
|
|
|
62 <outputs>
|
|
|
63 <data format="tabular" name="out_file" />
|
|
|
64 </outputs>
|
|
|
65
|
|
|
66 <requirements>
|
|
|
67 <requirement type="package" version="1.0.3">compute_cli</requirement>
|
|
|
68 </requirements>
|
|
|
69
|
|
|
70 <tests>
|
|
|
71 <test>
|
|
|
72 <param name="in_file" value="group_compute_input.txt" />
|
|
|
73 <param name="grouping" value="2" />
|
|
|
74 <param name="header_in" value="true" />
|
|
|
75 <param name="header_out" value="true" />
|
|
|
76 <param name="need_sort" value="true" />
|
|
|
77 <param name="print_full_line" value="false" />
|
|
|
78 <param name="op_column" value="3" />
|
|
|
79 <param name="op_name" value="sum" />
|
|
|
80 <param name="ignore_case" value="false" />
|
|
|
81 <output name="out_file" file="group_compute_output.txt" />
|
|
|
82 </test>
|
|
|
83 </tests>
|
|
|
84 <help>
|
|
|
85
|
|
|
86 .. class:: infomark
|
|
|
87
|
|
|
88 **TIP:** Input data must be TAB delimited. If the desired dataset does not appear in the input list, use *Text Manipulation->Convert* to convert it to **Tabular** type.
|
|
|
89
|
|
|
90 -----
|
|
|
91
|
|
|
92 **Syntax**
|
|
|
93
|
|
|
94 This tools performs common operations (such as summing, counting, mean, standard-deviation) on input file, based on tabular data. The tool can also optionaly group the input based on a given field.
|
|
|
95
|
|
|
96 -----
|
|
|
97
|
|
|
98 **Example 1**
|
|
|
99
|
|
|
100 - Find the average score in statistics course of college students, grouped by their college major. The input file has three fields (Name,Major,Score) and a header line::
|
|
|
101
|
|
|
102 Name Major Score
|
|
|
103 Bryan Arts 68
|
|
|
104 Isaiah Arts 80
|
|
|
105 Gabriel Health-Medicine 100
|
|
|
106 Tysza Business 92
|
|
|
107 Zackery Engineering 54
|
|
|
108 ...
|
|
|
109 ...
|
|
|
110
|
|
|
111 - Grouping the input by the second column (*Major*), and performing operations **mean** and **sample standard deviation** on the third column (*Score*), gives::
|
|
|
112
|
|
|
113 GroupBy(Major) mean(Score) sstdev(Score)
|
|
|
114 Arts 68.9474 10.4215
|
|
|
115 Business 87.3636 5.18214
|
|
|
116 Engineering 66.5385 19.8814
|
|
|
117 Health-Medicine 90.6154 9.22441
|
|
|
118 Life-Sciences 55.3333 20.606
|
|
|
119 Social-Sciences 60.2667 17.2273
|
|
|
120
|
|
|
121 This sample file is available at http://agordon.github.io/compute/examples.html .
|
|
|
122
|
|
|
123 **Example 2**
|
|
|
124
|
|
|
125 - Using the UCSC RefSeq Human Gene Track, available at: http://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/refGene.txt.gz
|
|
|
126
|
|
|
127 - List the number and identifiers of isoforms per gene. The gene identifier is in column 13, the isoform/transcript identifier is in column 2. Grouping by column 13 and performing **count** and **Combine all values** on column 2, gives::
|
|
|
128
|
|
|
129 GroupBy(field-13) count(field-2) collapse(field-2)
|
|
|
130 A1BG 1 NM_130786
|
|
|
131 A1BG-AS1 1 NR_015380
|
|
|
132 A1CF 6 NM_001198818,NM_001198819,NM_001198820,NM_014576,NM_138932,NM_138933
|
|
|
133 A2M 1 NM_000014
|
|
|
134 A2M-AS1 1 NR_026971
|
|
|
135 A2ML1 2 NM_001282424,NM_144670
|
|
|
136 ...
|
|
|
137
|
|
|
138 - Count how many transcripts are listed for each chromosome and strand. Chromosome is on column 3, Strand is in column 4. Transcript identifiers are in column 2. Grouping by columns **3,4** and performing operation **count** on column 2, gives::
|
|
|
139
|
|
|
140 GroupBy(field-3) GroupBy(field-4) count(field-2)
|
|
|
141 chr1 + 2456
|
|
|
142 chr1 - 2431
|
|
|
143 chr2 + 1599
|
|
|
144 chr2 - 1419
|
|
|
145 chr3 + 1287
|
|
|
146 chr3 - 1249
|
|
|
147 ...
|
|
|
148
|
|
|
149 -----
|
|
|
150
|
|
|
151 **Compute** is an open-sourced program, see more details on the Compute_ Website.
|
|
|
152
|
|
|
153 **Compute** is also available as a command-line program, see http://agordon.github.io/compute/examples.html .
|
|
|
154
|
|
|
155 .. _Compute: http://agordon.github.io/compute/
|
|
|
156
|
|
|
157 </help>
|
|
|
158 </tool>
|