Mercurial > repos > xuebing > sharplabtool
view tools/filters/wc_gnu.xml @ 1:cdcb0ce84a1b
Uploaded
author | xuebing |
---|---|
date | Fri, 09 Mar 2012 19:45:15 -0500 |
parents | 9071e359b9a3 |
children |
line wrap: on
line source
<tool id="wc_gnu" name="Line/Word/Character count"> <description>of a dataset</description> <command> #set $word_to_arg = { 'characters':'m', 'words':'w', 'lines':'l' } #set $arg_order = [ 'lines', 'words', 'characters' ] #if not isinstance( $options.value, list ): #set $args = [ $options.value ] #else: #set $args = $options.value #end if #if $include_header.value: echo "#${ "\t".join( [ i for i in $arg_order if i in $args ] ) }" > $out_file1 && #end if wc #for $option in $args: -${ word_to_arg[ str(option) ] } #end for $input1 | awk '{ print ${ '"\\t"'.join( [ "$%i" % ( i+1 ) for i in range( len( $args ) ) ] ) } }' >> $out_file1 </command> <inputs> <param format="txt" name="input1" type="data" label="Text file"/> <param name="options" type="select" multiple="True" display="checkboxes" label="Desired values"> <!-- <option value="bytes" selected="True">Byte count</option> --> <option value="lines" selected="True">Line count</option> <option value="words" selected="True">Word count</option> <option value="characters" selected="True">Character count</option> <validator type="no_options" message="You must pick at least one attribute to count." /> </param> <param name="include_header" type="boolean" label="Include Output header" checked="True"/> </inputs> <outputs> <data format="tabular" name="out_file1"/> </outputs> <tests> <test> <param name="input1" value="1.bed"/> <param name="options" value="lines,words,characters"/> <param name="include_header" value="True"/> <output name="out_file1" file="wc_gnu_out_1.tabular"/> </test> <test> <param name="input1" value="1.bed"/> <param name="options" value="lines,words,characters"/> <param name="include_header" value="False"/> <output name="out_file1" file="wc_gnu_out_2.tabular"/> </test> </tests> <help> **What it does** This tool outputs counts of specified attributes (lines, words, characters) of a dataset. ----- **Example Output** :: #lines words characters 7499 41376 624971 </help> </tool>