side by side on a specified fieldjoin.py $input1 $input2 $field1 $field2 $out_file1 $unmatched $partial --index_depth=3 --buffer=50000000 --fill_options_file=$fill_options_file<%
import simplejson
%>
#set $__fill_options = {}
#if $fill_empty_columns['fill_empty_columns_switch'] == 'fill_empty':
#set $__fill_options['fill_unjoined_only'] = $fill_empty_columns['fill_columns_by'].value == 'fill_unjoined_only'
#if $fill_empty_columns['do_fill_empty_columns']['column_fill_type'] == 'single_fill_value':
#set $__start_fill = $fill_empty_columns['do_fill_empty_columns']['fill_value'].value
#else:
#set $__start_fill = ""
#end if
#set $__fill_options['file1_columns'] = [ __start_fill for i in range( int( $input1.metadata.columns ) ) ]
#set $__fill_options['file2_columns'] = [ __start_fill for i in range( int( $input2.metadata.columns ) ) ]
#if $fill_empty_columns['do_fill_empty_columns']['column_fill_type'] == 'fill_value_by_column':
#for column_fill1 in $fill_empty_columns['do_fill_empty_columns']['column_fill1']:
#set $__fill_options['file1_columns'][ int( column_fill1['column_number1'].value ) - 1 ] = column_fill1['fill_value1'].value
#end for
#for column_fill2 in $fill_empty_columns['do_fill_empty_columns']['column_fill2']:
#set $__fill_options['file2_columns'][ int( column_fill2['column_number2'].value ) - 1 ] = column_fill2['fill_value2'].value
#end for
#end if
#end if
${simplejson.dumps( __fill_options )}
.. class:: warningmark
**This tool will attempt to reuse the metadata from your first input.** To change metadata assignments click on the "edit attributes" link of the history item generated by this tool.
.. class:: infomark
**TIP:** If your data is not TAB delimited, use *Text Manipulation->Convert*
-----
**Syntax**
This tool joins lines of two queries on a common field. An empty string ("") is not a valid identifier.
You may choose to include lines of your first input that do not join with your second input.
- Columns are referenced with a **number**. For example, **3** refers to the 3rd column of a tab-delimited file.
-----
**Example**
Query1::
chr1 10 20 geneA
chr1 50 80 geneB
chr5 10 40 geneL
Query2::
geneA tumor-supressor
geneB Foxp2
geneC Gnas1
geneE INK4a
Joining the 4th column of Query1 with the 1st column of Query2 will yield::
chr1 10 20 geneA geneA tumor-suppressor
chr1 50 80 geneB geneB Foxp2
Joining the 4th column of Query1 with the 1st column of Query2, while keeping all lines from Query1, will yield::
chr1 10 20 geneA geneA tumor-suppressor
chr1 50 80 geneB geneB Foxp2
chr5 10 40 geneL