Repository revision
6:ff2a81aa3f08

Repository 'split_file_on_column'
hg clone https://toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column

Split by group tool metadata
Miscellaneous
tp_split_on_column
toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column/tp_split_on_column/0.6
0.6
None
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column/tp_split_on_column/0.6 (this tool)
toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column/tp_split_on_column/0.5
toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column/tp_split_on_column/0.4
toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column/tp_split_on_column/0.2
toolshed.g2.bx.psu.edu/repos/bgruening/split_file_on_column/tp_split_on_column/0.1.1
tp_split_on_column
Requirements (dependencies defined in the <requirements> tag set)
name version type
gawk 5.1.0 package
Additional information about this tool
mkdir tmp_out &&
    #if $include_header
        awk -F '\t' 'NR==1{hdr=$0;next}f!="tmp_out/"\$$column".$infile.ext"{if(f) close(f); f="tmp_out/"\$$column".$infile.ext"}; {if (!seen[f]++) print hdr>f; print >> f}' $infile
    #else
        awk -F'\t' '{print >> "tmp_out/"\$$column".$infile.ext" }' '$infile'
    #end if

    
None
False
Functional tests
name inputs outputs required files
Test-1 infile: 5cols.tabular
column: 5
include_header: False
5cols.tabular
Test-2 infile: 5cols-with-header.tabular
column: 5
include_header: True
5cols-with-header.tabular
Test-3 infile: 5cols-with-header.tabular
column: 5
include_header: False
5cols-with-header.tabular
Test-4 infile: 5cols-unsorted.tabular
column: 5
include_header: False
5cols-unsorted.tabular
Test-5 infile: 5cols-unsorted-with-header.tabular
column: 5
include_header: True
5cols-unsorted-with-header.tabular