comparison datamash-ops.xml @ 10:ee35019e3cba

merged updates to 1.0.6 from test-toolshed
author Assaf Gordon <agordon@wi.mit.edu>
date Sat, 22 Nov 2014 21:13:52 -0500
parents 22080cbb0e2a
children
comparison
equal deleted inserted replaced
1:f6af66d4ded6 10:ee35019e3cba
1 <tool id="DatamashOps" name="Datamash" version="1.0.6">
2 <description>(operations on tabular data)</description>
3
4 <requirements>
5 <requirement type="package" version="1.0.6">datamash</requirement>
6 </requirements>
7
8 <command>
9 datamash
10 $header_in
11 $header_out
12 $need_sort
13 $print_full_line
14 $ignore_case
15 #if str($grouping).strip()
16 --group '$grouping'
17 #end if
18 #for $oper in $operations
19 ${oper.op_name}
20 ${oper.op_column}
21 #end for
22 &lt; $in_file &gt; $out_file
23 </command>
24 <inputs>
25 <param format="tabular" name="in_file" type="data" label="Select Input Data" help=""/>
26
27 <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.">
28 <validator type="regex" message="invalid fields value">^[0-9, ]*$</validator>
29 </param>
30
31 <param name="header_in" type="boolean" truevalue="--header-in" falsevalue=""
32 label="Input file has a header line" help="Mark this if the input file's first line is a header line" />
33
34 <param name="header_out" type="boolean" truevalue="--header-out" falsevalue=""
35 label="Print header line" help="Mark this if you want the first line to show the field names" />
36
37 <param name="need_sort" type="boolean" truevalue="--sort" falsevalue=""
38 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." />
39
40 <param name="print_full_line" type="boolean" truevalue="--full" falsevalue=""
41 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." />
42
43 <param name="ignore_case" type="boolean" truevalue="--ignore-case" falsevalue=""
44 label="Ignore case when grouping" help="If set, upper/lowercase differences will be ignored when grouping fields." />
45
46 <repeat name="operations" title="Operation to perform on each group" min="1" default="1">
47 <param name="op_name" type="select" label="Type">
48 <option value="count">count</option>
49 <option value="sum">sum</option>
50 <option value="min">minimum</option>
51 <option value="max">maximum</option>
52 <option value="absmin">Absolute minimum</option>
53 <option value="absmax">Absolute maximum</option>
54 <option value="mean">Mean</option>
55 <option value="pstdev">Population Standard deviantion</option>
56 <option value="sstdev">Sample Standard deviantion</option>
57 <option value="median">Median</option>
58 <option value="q1">1st quartile</option>
59 <option value="q3">3rd quartile</option>
60 <option value="iqr">Inter-quartile range</option>
61 <option value="mad">Median Absolute Deviation</option>
62 <option value="pvar">Variance (population)</option>
63 <option value="svar">Variance (sample)</option>
64 <option value="sskew">Skewness (sample)</option>
65 <option value="pskew">Skewness (population)</option>
66 <option value="skurt">Kurtosis (sample)</option>
67 <option value="pkurt">Kurtosis (population)</option>
68 <option value="jarque">Jarque-Bera Normality test</option>
69 <option value="dpo">DAgostino-Pearson Omnibus Normality Test</option>
70 <option value="mode">Mode</option>
71 <option value="antimode">Anti-Mode</option>
72 <option value="unique">Combine all unique values</option>
73 <option value="collapse">Combine all values</option>
74 <option value="countunique">Count Unique values</option>
75 </param>
76 <param name="op_column" label="On column" type="data_column" data_ref="in_file" />
77 </repeat>
78 </inputs>
79
80 <outputs>
81 <data format="tabular" name="out_file" />
82 </outputs>
83
84 <tests>
85 <test>
86 <param name="in_file" value="group_compute_input.txt" />
87 <param name="grouping" value="2" />
88 <param name="header_in" value="true" />
89 <param name="header_out" value="true" />
90 <param name="need_sort" value="true" />
91 <param name="print_full_line" value="false" />
92 <param name="op_column" value="3" />
93 <param name="op_name" value="sum" />
94 <param name="ignore_case" value="false" />
95 <output name="out_file" file="group_compute_output.txt" />
96 </test>
97 </tests>
98 <help>
99
100 .. class:: infomark
101
102 **TIP:** Input data must be TAB delimited. If the desired dataset does not appear in the input list, use *Text Manipulation-&gt;Convert* to convert it to **Tabular** type.
103
104 -----
105
106 **Syntax**
107
108 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.
109
110 -----
111
112 **Example 1**
113
114 - 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::
115
116 Name Major Score
117 Bryan Arts 68
118 Isaiah Arts 80
119 Gabriel Health-Medicine 100
120 Tysza Business 92
121 Zackery Engineering 54
122 ...
123 ...
124
125 - Grouping the input by the second column (*Major*), and performing operations **mean** and **sample standard deviation** on the third column (*Score*), gives::
126
127 GroupBy(Major) mean(Score) sstdev(Score)
128 Arts 68.9474 10.4215
129 Business 87.3636 5.18214
130 Engineering 66.5385 19.8814
131 Health-Medicine 90.6154 9.22441
132 Life-Sciences 55.3333 20.606
133 Social-Sciences 60.2667 17.2273
134
135 This sample file is available at http://www.gnu.org/software/datamash .
136
137 **Example 2**
138
139 - Using the UCSC RefSeq Human Gene Track, available at: http://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/refGene.txt.gz
140
141 - 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::
142
143 GroupBy(field-13) count(field-2) collapse(field-2)
144 A1BG 1 NM_130786
145 A1BG-AS1 1 NR_015380
146 A1CF 6 NM_001198818,NM_001198819,NM_001198820,NM_014576,NM_138932,NM_138933
147 A2M 1 NM_000014
148 A2M-AS1 1 NR_026971
149 A2ML1 2 NM_001282424,NM_144670
150 ...
151
152 - 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::
153
154 GroupBy(field-3) GroupBy(field-4) count(field-2)
155 chr1 + 2456
156 chr1 - 2431
157 chr2 + 1599
158 chr2 - 1419
159 chr3 + 1287
160 chr3 - 1249
161 ...
162
163 -----
164
165 **GNU Datamash** is a Free and Open Source Software, see more details on the Datamash_ Website.
166
167 **GNU Datamash** is also available as a command-line program, see http://www.gnu.org/software/datamash/download/ .
168
169 For more details about supported statistical operations, see Datamash_ website.
170
171 .. _Datamash: http://www.gnu.org/software/datamash/
172
173 </help>
174 </tool>