| 
0
 | 
     1 <tool id="tables_arithmetic_operations" name="Arithmetic Operations " version="1.0.0">
 | 
| 
 | 
     2   <description>on tables</description>
 | 
| 
 | 
     3   
 | 
| 
 | 
     4   <command interpreter="perl">
 | 
| 
 | 
     5   	tables_arithmetic_operations.pl $inputFile1 $inputFile2 $inputArithmeticOperation3 $outputFile1
 | 
| 
 | 
     6   </command>
 | 
| 
 | 
     7 
 | 
| 
 | 
     8   <inputs>
 | 
| 
 | 
     9   	<param format="tabular" name="inputFile1" type="data" label="Select the first input tabular file"/>
 | 
| 
 | 
    10   	<param format="tabular" name="inputFile2" type="data" label="Select the second input tabular file"/>
 | 
| 
 | 
    11   	
 | 
| 
 | 
    12     <param name="inputArithmeticOperation3" type="select" label="Choose the arithmetic operation:">
 | 
| 
 | 
    13     	<option value="Addition">Addition</option>
 | 
| 
 | 
    14       	<option value="Subtraction">Subtraction</option>
 | 
| 
 | 
    15       	<option value="Multiplication">Multiplication</option>
 | 
| 
 | 
    16       	<option value="Division">Division</option>
 | 
| 
 | 
    17     </param>
 | 
| 
 | 
    18   </inputs>
 | 
| 
 | 
    19   
 | 
| 
 | 
    20   <outputs>
 | 
| 
 | 
    21     <data format="tabular" name="outputFile1"/>
 | 
| 
 | 
    22   </outputs>
 | 
| 
 | 
    23   
 | 
| 
 | 
    24   <tests>
 | 
| 
 | 
    25   	<test>
 | 
| 
 | 
    26   		<param name="inputFile1" value="numericalTable1.tabular" />
 | 
| 
 | 
    27   		<param name="inputFile2" value="numericalTable1.tabular" />
 | 
| 
 | 
    28     	<param name="inputArithmeticOperation3" value="Addition" />
 | 
| 
 | 
    29     	<output name="outputFile1" file="table_addition_result.tabular" />
 | 
| 
 | 
    30   	</test>
 | 
| 
 | 
    31   	
 | 
| 
 | 
    32   	<test>
 | 
| 
 | 
    33   		<param name="inputFile1" value="numericalTable1.tabular" />
 | 
| 
 | 
    34   		<param name="inputFile2" value="numericalTable1.tabular" />
 | 
| 
 | 
    35     	<param name="inputArithmeticOperation3" value="Subtraction" />
 | 
| 
 | 
    36     	<output name="outputFile1" file="table_subtraction_result.tabular" />
 | 
| 
 | 
    37   	</test>
 | 
| 
 | 
    38   	
 | 
| 
 | 
    39   	<test>
 | 
| 
 | 
    40   		<param name="inputFile1" value="numericalTable1.tabular" />
 | 
| 
 | 
    41   		<param name="inputFile2" value="numericalTable1.tabular" />
 | 
| 
 | 
    42     	<param name="inputArithmeticOperation3" value="Multiplication" />
 | 
| 
 | 
    43     	<output name="outputFile1" file="table_multiplication_result.tabular" />
 | 
| 
 | 
    44   	</test>
 | 
| 
 | 
    45   	
 | 
| 
 | 
    46   	<test>
 | 
| 
 | 
    47   		<param name="inputFile1" value="numericalTable1.tabular" />
 | 
| 
 | 
    48   		<param name="inputFile2" value="numericalTable1.tabular" />
 | 
| 
 | 
    49     	<param name="inputArithmeticOperation3" value="Division" />
 | 
| 
 | 
    50     	<output name="outputFile1" file="table_division_result.tabular" />
 | 
| 
 | 
    51   	</test>
 | 
| 
 | 
    52   	
 | 
| 
 | 
    53   </tests>
 | 
| 
 | 
    54   
 | 
| 
 | 
    55   
 | 
| 
 | 
    56   <help> 
 | 
| 
 | 
    57 
 | 
| 
 | 
    58 .. class:: infomark
 | 
| 
 | 
    59 
 | 
| 
 | 
    60 **What it does**
 | 
| 
 | 
    61 
 | 
| 
 | 
    62 This program implements arithmetic operations on tabular files data. The program takes three inputs:
 | 
| 
 | 
    63 
 | 
| 
 | 
    64 - The first input is a TABULAR format file containing numbers only.
 | 
| 
 | 
    65 - The second input is a TABULAR format file containing numbers only.
 | 
| 
 | 
    66 - The third input is an arithmetic operation: +, -, x, or / for addition, subtraction, multiplication, or division, respectively. 
 | 
| 
 | 
    67 - The output file is a TABULAR format file containing the result of implementing the arithmetic operation on both input files.
 | 
| 
 | 
    68 
 | 
| 
 | 
    69 
 | 
| 
 | 
    70 Notes: 
 | 
| 
 | 
    71 
 | 
| 
 | 
    72 - The two files must have the same number of columns and the same number of rows.
 | 
| 
 | 
    73 - The output file has the same number of columns and the same number of rows as each of the two input files.
 | 
| 
 | 
    74 - In case of division, none of the values in the second input file could be 0, otherwise the program will stop and report an error.
 | 
| 
 | 
    75 
 | 
| 
 | 
    76 **Example**
 | 
| 
 | 
    77 
 | 
| 
 | 
    78 Let us have the first input file as follows::
 | 
| 
 | 
    79 
 | 
| 
 | 
    80 	5	4	0
 | 
| 
 | 
    81 	10	11	12
 | 
| 
 | 
    82 	1	3	1
 | 
| 
 | 
    83 	1	2	1
 | 
| 
 | 
    84 	2	0	4
 | 
| 
 | 
    85 	
 | 
| 
 | 
    86 And the second input file as follows::
 | 
| 
 | 
    87 
 | 
| 
 | 
    88 	5	4	4
 | 
| 
 | 
    89 	2	5	8
 | 
| 
 | 
    90 	1	2	1
 | 
| 
 | 
    91 	3	2	5
 | 
| 
 | 
    92 	2	4	4
 | 
| 
 | 
    93 
 | 
| 
 | 
    94 Running the program and choosing "Addition" as an arithmetic operation will give the following output::
 | 
| 
 | 
    95 
 | 
| 
 | 
    96 	10	8	4
 | 
| 
 | 
    97 	12	16	20
 | 
| 
 | 
    98 	2	5	2
 | 
| 
 | 
    99 	4	4	6
 | 
| 
 | 
   100 	4	4	8
 | 
| 
 | 
   101 
 | 
| 
 | 
   102 
 | 
| 
 | 
   103   </help>  
 | 
| 
 | 
   104   
 | 
| 
 | 
   105 </tool>
 |