comparison datamash-ops.xml @ 5:f33abb72cbe3

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