Repository revision
6:a513e3fbb4c5

Repository 'datamash_transpose'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose

Transpose tool metadata
Miscellaneous
Transpose
rows/columns in a tabular file
datamash_transpose
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.8+galaxy1
1.8+galaxy1
None
True
Version lineage of this tool (guids ordered most recent to oldest)
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.8+galaxy1 (this tool)
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.8+galaxy0
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.1.0+galaxy2
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.1.0+galaxy1
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.1.0
toolshed.g2.bx.psu.edu/repos/iuc/datamash_transpose/datamash_transpose/1.0.6
datamash_transpose
Requirements (dependencies defined in the <requirements> tag set)
name version type
datamash 1.8 package
Additional information about this tool
#import os
        #set file_size_MB = $in_file.get_size() / (1024 * 1024)
        #set size_threshold_MB = 1024
        #if $file_size_MB <= $size_threshold_MB:
            datamash transpose 
        #if $in_file.ext == 'csv'
            -t ,
        #end if
     < $in_file > $out_file
        #else:
            ## Input matrix is very big: divide and conquer
            ## If the input file is very big, datamash runs out of memory (much earlier than file size ~ available RAM.
            ## Split into managable chunks of row vectors, transpose the chunks and juxtapose column vector chunks.
            #set num_chunks = 1 + int(file_size_MB/size_threshold_MB)
            echo Huge matrix detected, processing in $num_chunks chunks. &&
            split -n l/$num_chunks $in_file split_input_ &&
            for chunk in \$(ls split_input*); do
                datamash transpose 
        #if $in_file.ext == 'csv'
            -t ,
        #end if
     < \$chunk > \${chunk}_transposed;
            done &&
            paste split_input_*_transposed > $out_file
        #end if
    
None
False
Functional tests
name inputs outputs required files
Test-1 in_file: datamash_transpose_input.txt
name: value
datamash_transpose_input.txt
value