changeset 0:e91a07e82d96 draft

First Galaxy Version
author Assaf Gordon <assafgordon@gmail.com>
date Sat, 22 Mar 2014 16:39:59 -0400
parents
children 16903bd2bb5b
files compute.xml test-data/group_compute_input.txt test-data/group_compute_output.txt tool_dependencies.xml
diffstat 4 files changed, 256 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compute.xml	Sat Mar 22 16:39:59 2014 -0400
@@ -0,0 +1,159 @@
+<tool id="GroupCompute" name="Group and Compute" version="1.0.3">
+  <description>operations on tabular data.</description>
+
+  <requirements>
+    <requirement type="package" version="1.0.3">compute</requirement>
+  </requirements>
+
+  <command>
+    compute
+      $header_in
+      $header_out
+      $need_sort
+      $print_full_line
+      $ignore_case
+      #if str($grouping)>0
+      --group '$grouping'
+      #end if
+      -T
+      #for $oper in $operations
+        ${oper.op_name}
+        ${oper.op_column}
+      #end for
+      &lt; $in_file &gt; $out_file
+  </command>
+  <inputs>
+    <param format="tabular" name="in_file" type="data" label="Select Input Data" help=""/>
+
+    <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."/>
+
+    <param name="header_in" type="boolean" truevalue="--header-in" falsevalue=""
+	label="Input file has a header line" help="Mark this if the input file's first line is a header line" />
+
+    <param name="header_out" type="boolean" truevalue="--header-out" falsevalue=""
+	label="Print header line" help="Mark this if you want the first line to show the field names" />
+
+    <param name="need_sort" type="boolean" truevalue="--sort" falsevalue=""
+	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." />
+
+    <param name="print_full_line" type="boolean" truevalue="--full" falsevalue=""
+	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." />
+
+    <param name="ignore_case" type="boolean" truevalue="--ignore-case" falsevalue=""
+	label="Ignore case when grouping" help="If set, upper/lowercase differences will be ignored when grouping fields." />
+
+    <repeat name="operations" title="Operation to perform on each group">
+      <param name="op_name" type="select" label="Type">
+        <option value="count">count</option>
+        <option value="sum">sum</option>
+        <option value="min">minimum</option>
+        <option value="max">maximum</option>
+        <option value="absmin">Absolute minimum</option>
+        <option value="absmax">Absolute maximum</option>
+        <option value="mean">Mean</option>
+        <option value="median">Median</option>
+        <option value="mode">Mode</option>
+        <option value="antimode">Anti-Mode</option>
+        <option value="pstdev">Population Standard deviantion</option>
+        <option value="sstdev">Sample Standard deviantion</option>
+        <option value="unique">Combine all unique values</option>
+        <option value="collapse">Combine all values</option>
+        <option value="countunique">Count Unique values</option>
+      </param>
+      <param name="op_column" label="On column" type="data_column" data_ref="in_file" />
+    </repeat>
+  </inputs>
+
+  <outputs>
+    <data format="tabular" name="out_file" />
+  </outputs>
+
+  <tests>
+      <test>
+          <param name="in_file" value="group_compute_input.txt" />
+          <param name="grouping" value="2" />
+          <param name="header_in" value="true" />
+          <param name="header_out" value="true" />
+          <param name="need_sort"  value="true" />
+          <param name="print_full_line"  value="false" />
+          <param name="op_column" value="3" />
+          <param name="op_name" value="sum" />
+          <param name="ignore_case"  value="false" />
+          <output name="out_file" file="group_compute_output.txt" />
+      </test>
+  </tests>
+<help>
+
+.. class:: infomark
+
+**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.
+
+-----
+
+**Syntax**
+
+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.
+
+-----
+
+**Example 1**
+
+- 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::
+
+    Name        Major            Score
+    Bryan       Arts             68
+    Isaiah      Arts             80
+    Gabriel     Health-Medicine  100
+    Tysza       Business         92
+    Zackery     Engineering      54
+    ...
+    ...
+
+- Grouping the input by the second column (*Major*), and performing operations **mean** and **sample standard deviation** on the third column (*Score*), gives::
+
+    GroupBy(Major)     mean(Score)   sstdev(Score)
+    Arts               68.9474       10.4215
+    Business           87.3636       5.18214
+    Engineering        66.5385       19.8814
+    Health-Medicine    90.6154       9.22441
+    Life-Sciences      55.3333       20.606
+    Social-Sciences    60.2667       17.2273
+
+This sample file is available at http://agordon.github.io/compute/examples.html .
+
+**Example 2**
+
+- Using the UCSC RefSeq Human Gene Track, available at: http://hgdownload.soe.ucsc.edu/goldenPath/hg38/database/refGene.txt.gz
+
+- 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::
+
+    GroupBy(field-13)     count(field-2)     collapse(field-2)
+    A1BG                  1                  NM_130786
+    A1BG-AS1              1                  NR_015380
+    A1CF                  6                  NM_001198818,NM_001198819,NM_001198820,NM_014576,NM_138932,NM_138933
+    A2M                   1                  NM_000014
+    A2M-AS1               1                  NR_026971
+    A2ML1                 2                  NM_001282424,NM_144670
+    ...
+
+- 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::
+
+    GroupBy(field-3)     GroupBy(field-4)     count(field-2)
+    chr1                 +                    2456
+    chr1                 -                    2431
+    chr2                 +                    1599
+    chr2                 -                    1419
+    chr3                 +                    1287
+    chr3                 -                    1249
+    ...
+
+-----
+
+**Compute** is an open-sourced program, see more details on the Compute_ Website.
+
+**Compute** is also available as a command-line program, see http://agordon.github.io/compute/examples.html .
+
+.. _Compute: http://agordon.github.io/compute/
+
+</help>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/group_compute_input.txt	Sat Mar 22 16:39:59 2014 -0400
@@ -0,0 +1,84 @@
+Name	Major	Score
+Ignatius	Engineering	83
+Austin	Life-Sciences	91
+Zackery	Engineering	54
+Marques	Arts	58
+Darren	Business	94
+Darius	Social-Sciences	51
+Thanh	Engineering	53
+Joe'Quann	Engineering	75
+Bryan	Arts	68
+Devin	Engineering	92
+Joseph	Social-Sciences	61
+Joshua	Life-Sciences	14
+Ja'Won	Social-Sciences	37
+Tyreque	Arts	74
+Sage	Arts	55
+Antonio	Engineering	88
+Michael	Engineering	39
+Randy	Social-Sciences	68
+Dilan	Health-Medicine	84
+Omar	Engineering	99
+Zachary	Arts	80
+Faison	Engineering	47
+Angel	Health-Medicine	100
+Gabriel	Health-Medicine	100
+John	Life-Sciences	70
+Leonard	Business	87
+Juan	Business	79
+Jonathan	Health-Medicine	100
+Christopher	Life-Sciences	59
+Brandon	Life-Sciences	72
+D'Angelo	Health-Medicine	90
+Justin	Social-Sciences	90
+Israel	Health-Medicine	81
+William	Arts	46
+David	Social-Sciences	69
+Drake	Social-Sciences	59
+Drake	Social-Sciences	76
+Nathan	Arts	71
+Trevon	Arts	74
+Aaron	Business	83
+Daniel	Health-Medicine	91
+Kevin	Health-Medicine	100
+Antonio	Engineering	56
+Donovan	Arts	75
+Kerris	Business	82
+Andre	Health-Medicine	72
+Dakota	Business	83
+Aaron	Life-Sciences	58
+Walter	Arts	75
+Isaiah	Arts	80
+Christian	Life-Sciences	67
+Dalton	Health-Medicine	100
+Jesse	Social-Sciences	32
+Diego	Health-Medicine	82
+Nathen	Life-Sciences	46
+Anthony	Life-Sciences	32
+Christian	Business	88
+David	Business	92
+Avery	Engineering	51
+Paul	Arts	63
+Derek	Arts	60
+Levi	Arts	76
+Lance	Social-Sciences	65
+Sonny	Engineering	50
+Shawn	Arts	65
+Leonardo	Engineering	78
+Yeng	Life-Sciences	39
+Leroy	Social-Sciences	74
+Gurnam	Life-Sciences	66
+Fernando	Arts	78
+Williams	Social-Sciences	62
+Roberto	Arts	65
+Teriuse	Business	94
+Nathaniel	Arts	88
+Chase	Social-Sciences	27
+Caleb	Business	87
+Tysza	Business	92
+Nico	Arts	59
+Manuel	Social-Sciences	61
+Patrick	Health-Medicine	92
+Peter	Health-Medicine	86
+Allen	Life-Sciences	50
+Joel	Social-Sciences	72
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/group_compute_output.txt	Sat Mar 22 16:39:59 2014 -0400
@@ -0,0 +1,7 @@
+GroupBy(Major)	sum(Score)
+Arts	1310
+Business	961
+Engineering	865
+Health-Medicine	1178
+Life-Sciences	664
+Social-Sciences	904
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml	Sat Mar 22 16:39:59 2014 -0400
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+    <package name="compute" version="1.0.3">
+        <repository changeset_revision="de032d156cbc" name="package_compute_1_0_3" owner="agordon" toolshed="http://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>