view recurring_lines.xml @ 6:60edf2f8c28f draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit b'e6ee273f75fff61d1e419283fa8088528cf59470\n'
author bgruening
date Sat, 06 May 2017 13:09:05 -0400
parents 37e1eb05b1b4
children 74a8bef53a00
line wrap: on
line source

<tool id="tp_text_file_with_recurring_lines" name="Create text file" version="@BASE_VERSION@.0">
    <description>with recurring lines</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements" />
    <version_command>yes --version | head -n 1</version_command>
    <command>
<![CDATA[
        #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"
                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" 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="text" name="outfile"/>
    </outputs>
    <tests>
        <test>
            <repeat name="token_set">
                <param name="line" value="freedom" />
                <param name="repeat_select_opts" value="file" />
                <param name="infile" value="multijoin2.txt" />
            </repeat>
            <output name="outfile" file="recurring_result1.txt" />
        </test>
        <test>
            <repeat name="token_set">
                <param name="line" value="freedom" />
                <param name="repeat_select_opts" value="user" />
                <param name="times" value="10" />
            </repeat>
            <repeat name="token_set">
                <param name="line" value="war is over" />
                <param name="repeat_select_opts" value="user" />
                <param name="times" value="10" />
            </repeat>
            <output name="outfile" file="recurring_result2.txt" />
        </test>
    </tests>
    <help>
<![CDATA[
.. 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@
]]>
    </help>
    <expand macro="citations" />
</tool>