Mercurial > repos > gordon > unix_tools
comparison easyjoin.xml @ 0:631dfde45073 draft default tip
First tool-shed public version
| author | gordon |
|---|---|
| date | Tue, 09 Oct 2012 18:48:06 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:631dfde45073 |
|---|---|
| 1 <tool id="cshl_easyjoin" name="Join" version="0.1.1"> | |
| 2 <description>two files</description> | |
| 3 <command interpreter="perl">easyjoin $jointype | |
| 4 -t ' ' | |
| 5 $header | |
| 6 -e '$empty_string_filler' | |
| 7 -o auto | |
| 8 $ignore_case | |
| 9 -1 "$column1" | |
| 10 -2 "$column2" | |
| 11 "$input1" "$input2" | |
| 12 > '$output' | |
| 13 </command> | |
| 14 | |
| 15 <inputs> | |
| 16 <param format="txt" name="input1" type="data" label="1st file" /> | |
| 17 <param name="column1" label="Column to use from 1st file" type="data_column" data_ref="input1" accept_default="true" /> | |
| 18 | |
| 19 <param format="txt" name="input2" type="data" label="2nd File" /> | |
| 20 <param name="column2" label="Column to use from 2nd file" type="data_column" data_ref="input2" accept_default="true" /> | |
| 21 | |
| 22 <param name="jointype" type="select" label="Output lines appearing in"> | |
| 23 <option value=" ">BOTH 1st & 2nd file.</option> | |
| 24 <option value="-v 1">1st but not in 2nd file. [-v 1]</option> | |
| 25 <option value="-v 2">2nd but not in 1st file. [-v 2]</option> | |
| 26 <option value="-a 1">both 1st & 2nd file, plus unpairable lines from 1st file. [-a 1]</option> | |
| 27 <option value="-a 2">both 1st & 2nd file, plus unpairable lines from 2st file. [-a 2]</option> | |
| 28 <option value="-a 1 -a 2">All Lines [-a 1 -a 2]</option> | |
| 29 <option value="-v 1 -v 2">All unpairable lines [-v 1 -v 2]</option> | |
| 30 </param> | |
| 31 | |
| 32 <param name="header" type="boolean" checked="false" truevalue="--header" falsevalue="" label="First line is a header line" help="Use if first line contains column headers. It will not be sorted." /> | |
| 33 | |
| 34 <param name="ignore_case" type="boolean" checked="false" truevalue="-i" falsevalue="" label="Ignore case" help="Sort and Join key column values regardless of upper/lower case letters." /> | |
| 35 | |
| 36 <param name="empty_string_filler" type="text" size="20" value="0" label="Value to put in unpaired (empty) fields"> | |
| 37 <sanitizer> | |
| 38 <valid initial="string.printable"> | |
| 39 <remove value="'"/> | |
| 40 </valid> | |
| 41 </sanitizer> | |
| 42 </param> | |
| 43 | |
| 44 </inputs> | |
| 45 <outputs> | |
| 46 <data name="output" format="input" metadata_source="input1" | |
| 47 /> | |
| 48 </outputs> | |
| 49 | |
| 50 <help> | |
| 51 **What it does** | |
| 52 | |
| 53 This tool joins two tabular files based on a common key column. | |
| 54 | |
| 55 ----- | |
| 56 | |
| 57 **Example** | |
| 58 | |
| 59 **First file**:: | |
| 60 | |
| 61 Fruit Color | |
| 62 Apple red | |
| 63 Banana yellow | |
| 64 Orange orange | |
| 65 Melon green | |
| 66 | |
| 67 **Second File**:: | |
| 68 | |
| 69 Fruit Price | |
| 70 Orange 7 | |
| 71 Avocado 8 | |
| 72 Apple 4 | |
| 73 Banana 3 | |
| 74 | |
| 75 **Joining** both files, using **key column 1** and a **header line**, will return:: | |
| 76 | |
| 77 Fruit Color Price | |
| 78 Apple red 4 | |
| 79 Avocado . 8 | |
| 80 Banana yellow 3 | |
| 81 Melon green . | |
| 82 Orange orange 7 | |
| 83 | |
| 84 # Input files need not be sorted. | |
| 85 # The header line (**Fruit Color Price**) was joined and kept as first line. | |
| 86 # Missing values ( Avocado's color, missing from the first file ) are replaced with a period character. | |
| 87 | |
| 88 ----- | |
| 89 | |
| 90 *easyjoin* was written by A. Gordon | |
| 91 | |
| 92 </help> | |
| 93 </tool> |
