1 | <tool id="subtract_query1" name="Subtract Whole Query"> |
---|
2 | <description>from another query</description> |
---|
3 | <command interpreter="python">subtract_query.py $input1 $input2 $begin_col $end_col $output</command> |
---|
4 | <inputs> |
---|
5 | <param format="txt" name="input2" type="data" label="Subtract" help="Second query" /> |
---|
6 | <param format="txt" name="input1" type="data" label="from" help="First query" /> |
---|
7 | <param name="begin_col" type="data_column" data_ref="input1" force_select="False" label="Restrict subtraction between 'begin column'" /> |
---|
8 | <param name="end_col" type="data_column" data_ref="input1" force_select="False" label="and 'end column'" help="Specifying columns for restricting subtraction is available only for tabular formatted queries" /> |
---|
9 | </inputs> |
---|
10 | <outputs> |
---|
11 | <data format="input" name="output" metadata_source="input1" /> |
---|
12 | </outputs> |
---|
13 | <tests> |
---|
14 | <!-- Subtract 2 non-tabular files with no column restrictions. --> |
---|
15 | <!-- Cannot figure out why this test won't pass, it works in real time... |
---|
16 | <test> |
---|
17 | <param name="input1" value="1.txt" /> |
---|
18 | <param name="input2" value="2.txt" /> |
---|
19 | <param name="begin_col" value="None" /> |
---|
20 | <param name="end_col" value="None" /> |
---|
21 | <output name="output" file="subtract-query-1.dat" /> |
---|
22 | </test> |
---|
23 | --> |
---|
24 | <!-- Subtract 2 tabular files with no column restrictions. --> |
---|
25 | <test> |
---|
26 | <param name="input1" value="eq-showbeginning.dat" /> |
---|
27 | <param name="input2" value="eq-showtail.dat" /> |
---|
28 | <param name="begin_col" value="None" /> |
---|
29 | <param name="end_col" value="None" /> |
---|
30 | <output name="output" file="subtract-query-2.dat" /> |
---|
31 | </test> |
---|
32 | <!-- Subtract 2 tabular files with column restrictions. --> |
---|
33 | <test> |
---|
34 | <param name="input1" value="eq-showbeginning.dat" /> |
---|
35 | <param name="input2" value="eq-removebeginning.dat" /> |
---|
36 | <param name="begin_col" value="c1" /> |
---|
37 | <param name="end_col" value="c3" /> |
---|
38 | <output name="output" file="subtract-query-3.dat" /> |
---|
39 | </test> |
---|
40 | <!-- Subtract a non-tabular file from a tabular file with no column restrictions. --> |
---|
41 | <test> |
---|
42 | <param name="input1" value="eq-showbeginning.dat" /> |
---|
43 | <param name="input2" value="2.txt" /> |
---|
44 | <param name="begin_col" value="None" /> |
---|
45 | <param name="end_col" value="None" /> |
---|
46 | <output name="output" file="subtract-query-4.dat" /> |
---|
47 | </test> |
---|
48 | </tests> |
---|
49 | <help> |
---|
50 | |
---|
51 | .. class:: infomark |
---|
52 | |
---|
53 | **TIP:** This tool complements the tool in the **Operate on Genomic Intervals** tool set which subtracts the intervals of two queries. |
---|
54 | |
---|
55 | |
---|
56 | ----- |
---|
57 | |
---|
58 | **Syntax** |
---|
59 | |
---|
60 | This tool subtracts an entire query from another query. |
---|
61 | |
---|
62 | - Any text format is valid. |
---|
63 | - If both query formats are tabular, you may restrict the subtraction to specific columns **contained in both queries** and the resulting query will include only the columns specified. |
---|
64 | - The begin column must be less than or equal to the end column. If it is not, begin column is switched with end column. |
---|
65 | - If begin column is specified but end column is not, end column will default to begin_column (and vice versa). |
---|
66 | - All blank and comment lines are skipped and not included in the resulting query (comment lines are lines beginning with a # character). |
---|
67 | - Duplicate lines are eliminated from both queries prior to subtraction. If any duplicate lines were eliminated from the first query, the number is displayed in the resulting history item. |
---|
68 | |
---|
69 | ----- |
---|
70 | |
---|
71 | **Example** |
---|
72 | |
---|
73 | If this is the **First query**:: |
---|
74 | |
---|
75 | chr1 4225 19670 |
---|
76 | chr10 6 8 |
---|
77 | chr1 24417 24420 |
---|
78 | chr6_hla_hap2 0 150 |
---|
79 | chr2 1 5 |
---|
80 | chr10 2 10 |
---|
81 | chr1 30 55 |
---|
82 | chrY 1 20 |
---|
83 | chr1 1225979 42287290 |
---|
84 | chr10 7 8 |
---|
85 | |
---|
86 | and this is the **Second query**:: |
---|
87 | |
---|
88 | chr1 4225 19670 |
---|
89 | chr10 6 8 |
---|
90 | chr1 24417 24420 |
---|
91 | chr6_hla_hap2 0 150 |
---|
92 | chr2 1 5 |
---|
93 | chr1 30 55 |
---|
94 | chrY 1 20 |
---|
95 | chr1 1225979 42287290 |
---|
96 | |
---|
97 | Subtracting the **Second query** from the **First query** (including all columns) will yield:: |
---|
98 | |
---|
99 | chr10 7 8 |
---|
100 | chr10 2 10 |
---|
101 | |
---|
102 | Conversely, subtracting the **First query** from the **Second query** (including all columns) will result in an empty dataset. |
---|
103 | |
---|
104 | Subtracting the **Second query** from the **First query** (restricting to columns c1 and c2) will yield:: |
---|
105 | |
---|
106 | chr10 7 |
---|
107 | chr10 2 |
---|
108 | |
---|
109 | </help> |
---|
110 | </tool> |
---|