from another query
subtract_query.py $input1 $input2 $begin_col $end_col $output
.. class:: infomark
**TIP:** This tool complements the tool in the **Operate on Genomic Intervals** tool set which subtracts the intervals of two queries.
-----
**Syntax**
This tool subtracts an entire query from another query.
- Any text format is valid.
- 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.
- The begin column must be less than or equal to the end column. If it is not, begin column is switched with end column.
- If begin column is specified but end column is not, end column will default to begin_column (and vice versa).
- All blank and comment lines are skipped and not included in the resulting query (comment lines are lines beginning with a # character).
- 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.
-----
**Example**
If this is the **First query**::
chr1 4225 19670
chr10 6 8
chr1 24417 24420
chr6_hla_hap2 0 150
chr2 1 5
chr10 2 10
chr1 30 55
chrY 1 20
chr1 1225979 42287290
chr10 7 8
and this is the **Second query**::
chr1 4225 19670
chr10 6 8
chr1 24417 24420
chr6_hla_hap2 0 150
chr2 1 5
chr1 30 55
chrY 1 20
chr1 1225979 42287290
Subtracting the **Second query** from the **First query** (including all columns) will yield::
chr10 7 8
chr10 2 10
Conversely, subtracting the **First query** from the **Second query** (including all columns) will result in an empty dataset.
Subtracting the **Second query** from the **First query** (restricting to columns c1 and c2) will yield::
chr10 7
chr10 2