view recurring_lines.xml @ 0:f034a9d33aca draft default tip

Uploaded
author bgruening
date Thu, 15 May 2014 11:50:30 -0400
parents
children
line wrap: on
line source

<tool id="bg_text_file_with_recurring_lines" name="Create text file" version="0.1">
    <description>with recurring lines</description>
    <command>

        #for $token in $token_set:
            #if str($token.repeat_select.repeat_select_opts) == 'user':
                times=#echo $token.repeat_select.times#;
            #else:
                times=`wc -l $token.repeat_select.infile | awk '{print $1}'`;
            #end if

            yes -- "${token.line}" 2>/dev/null | head -n \$times >> $outfile;
        #end for

    </command>
    <inputs>

        <repeat name="token_set" title=" selection" min="1">

            <param name="line" type="text" size="30" label="Characters to insert" help="Specify the characters that will be inserted X times in every line"/>

            <conditional name="repeat_select">
                <param name="repeat_select_opts" type="select" label="Specify the number of iterations by">
                    <option value="file">File (for each line in file)</option>
                    <option value="user" selected="True">User defined number</option>
                </param>
                <when value="user">
                    <param name="times" size="10" type="integer" value="10" min="1" label="How many times?"/>
                </when>
                <when value="file">
                    <param name="infile" type="data" format="txt" label="Template file" 
                        help="For every line, the specified characters will be written once. That means X is the line-number from the given file."/>
                </when>
            </conditional>
        </repeat>

    </inputs>
    <outputs>
        <data format="txt" name="outfile" from_work_dir="prediction" label="Generated text file"/>
    </outputs>
    <tests>
        <test>
        </test>
    </tests>
    <help>

.. class:: infomark

**What it does** 

This tool creates a text file with recurring lines. You can specify a bunch of characters or entire sentences. 
The entire string will be printed X times separated by a line break. X can be either given by the use as a number or calculated by a given file.
In case the user provides a file, the line number will be used as X.


**References**

Bjoern A. Gruening: https://github.com/bgruening/galaxytools/

    </help>
</tool>