view fasta_compute_length.xml @ 5:7d37cfda8e00 draft default tip

"planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/fasta_compute_length commit 34a6c9f94a5722bb7d2f887618aafa410a770e91"
author devteam
date Mon, 02 Mar 2020 06:46:51 -0500
parents e12f68d2cc4e
children
line wrap: on
line source

<tool id="fasta_compute_length" name="Compute sequence length" version="1.0.3" profile="16.04">
    <description></description>
    <requirements>
        <requirement type="package" version="3.7">python</requirement>
    </requirements>
    <command>
    #if $ref.ref_source == 'dbkey':
        cp '${ref.index.fields.len_path}' '$output'
    #else:
        python '$__tool_directory__/fasta_compute_length.py'
          #if $ref.ref_source == 'history':
            '$input'
          #else:
            '${ref.index.fields.path}'
          #end if
            '$output'
            $ref.keep_first
            $ref.keep_first_word
    #end if
    </command>
    <inputs>
        <conditional name="ref">
            <param name="ref_source" type="select" label="Sequences">
                <option value="history" selected="True">From History</option>
                <option value="dbkey">Locally Cached (pre-built length files)</option>
                <option value="fasta">Locally Cached (full genomes)</option>
            </param>
            <when value="history">
                <param name="input" type="data" format="fasta" label="Compute length for these sequences"/>
                <param name="keep_first" type="integer" value="0" label="How many title characters to keep?" help="'0' = keep the whole thing"/>
                <param name="keep_first_word" type="boolean" truevalue="id_only" falsevalue="id_and_desc"
                    label="Strip fasta description from header?"
                    help="Stripping the description will truncate the fasta header to just the sequence ID. Otherwise the header description will be kept. This step is done before the 'How many characters to keep' option."/>
            </when>
            <when value="dbkey">
                <param name="index" type="select" label="Source Genome Build">
                    <options from_data_table="__dbkeys__"/>
                </param>
            </when>
            <when value="fasta">
                <param name="index" type="select" label="Source Genome Build">
                    <options from_data_table="all_fasta"/>
                </param>
                <param name="keep_first" type="integer" value="0" label="How many title characters to keep?" help="'0' = keep the whole thing"/>
                <param name="keep_first_word" type="boolean" truevalue="id_only" falsevalue="id_and_desc"
                    label="Strip fasta description from header?"
                    help="Stripping the description will truncate the fasta header to just the sequence ID. Otherwise the header description will be kept. This step is done before the 'How many characters to keep' option."/>
            </when>
        </conditional>

    </inputs>
    <outputs>
        <data name="output" format="tabular"/>
    </outputs>
    <tests>
        <test>
            <param name="ref|input" value="454.fasta" />
            <param name="ref|keep_first" value="0"/>
            <param name="ref|keep_first_word" value="id_and_desc" />
            <output name="output" file="fasta_tool_compute_length_1.out" />
        </test>

        <test>
            <param name="ref|input" value="extract_genomic_dna_out1.fasta" />
            <param name="ref|keep_first" value="0"/>
            <param name="ref|keep_first_word" value="id_and_desc" />
            <output name="output" file="fasta_tool_compute_length_2.out" />
        </test>

        <test>
            <param name="ref|input" value="454.fasta" />
            <param name="ref|keep_first" value="14"/>
            <param name="ref|keep_first_word" value="id_and_desc" />
            <output name="output" file="fasta_tool_compute_length_3.out" />
        </test>

        <test>
            <param name="ref|ref_source" value="fasta" />
            <param name="ref|index" value="test_id"/>
            <param name="ref|keep_first_word" value="id_only" />
            <output name="output" file="merged.tab" />
        </test>

        <test>
            <param name="ref|ref_source" value="dbkey" />
            <param name="ref|index" value="test_id"/>
            <output name="output" file="merged.tab" />
        </test>
    </tests>
    <help><![CDATA[

**What it does**

This tool counts the length of each fasta sequence in the file. The output file has two columns per line (separated by tab): fasta titles and lengths of the sequences. The option *How many characters to keep?* allows to select a specified number of letters from the beginning of each FASTA entry.

-----

**Example**

Suppose you have the following FASTA formatted sequences from a Roche (454) FLX sequencing run::

    >EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_
    TCCGCGCCGAGCATGCCCATCTTGGATTCCGGCGCGATGACCATCGCCCGCTCCACCACG
    TTCGGCCGGCCCTTCTCGTCGAGGAATGACACCAGCGCTTCGCCCACG
    &gt;EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_
    AATAAAACTAAATCAGCAAAGACTGGCAAATACTCACAGGCTTATACAATACAAATGTAAfa

Running this tool while setting **How many characters to keep?** to **14** will produce this::

    EYKX4VC02EQLO5  108
    EYKX4VC02D4GS2   60

However, if your IDs are not all the same length, you may wish to just keep the fasta ID, and not the description::

    >EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_
    TCCGCGCCGAGCATGCCCATCTTGGATTCCGGCGCGATGACCATCGCCCGCTCCACCACG
    TTCGGCCGGCCCTTCTCGTCGAGGAATGACACCAGCGCTTCGCCCACG
    >EYKX4VC length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_
    AATAAAACTAAATCAGCAAAGACTGGCAAATACTCACAGGCTTATACAATACAAATGTAAfa

Running this tool with **Strip fasta description from header** set to **True** and **How many characters to keep?** set to **0** will produce::

    EYKX4VC02EQLO5  108
    EYKX4VC     60


    ]]></help>
    <citations>
        <citation type="doi">10.1093/bioinformatics/btq281</citation>
    </citations>
</tool>