view tools/fasta_tools/fasta_to_tabular.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="fasta2tab" name="FASTA-to-Tabular" version="1.1.0">
	<description>converter</description>
	<command interpreter="python">fasta_to_tabular.py $input $output $keep_first $descr_columns</command>
	<inputs>
		<param name="input" type="data" format="fasta" label="Convert these sequences"/>
		<param name="descr_columns" type="integer" size="2" value="1" label="How many columns to divide title string into?" help="Typically 2 to take the ID (first word) and decription (rest) as two columns, or 1 to give a single column">
			<validator type="in_range" min="1" />
		</param>
		<param name="keep_first" type="integer" size="5" value="0" label="How many title characters to keep?" help="Applies only to the first column taken from the title string ('0' = keep the whole thing), useful when your sequence identifiers are all the same length.">
			<validator type="in_range" min="0" />
		</param>
	</inputs>
	<outputs>
		<data name="output" format="tabular"/>
	</outputs>
	<tests>
		<test>
			<param name="input" value="454.fasta" />
			<param name="descr_columns" value="1"/>
			<param name="keep_first" value="0"/>
			<output name="output" file="fasta_to_tabular_out1.tabular" />
		</test>
		
		<test>
			<param name="input" value="4.fasta" />
			<param name="descr_columns" value="1"/>
			<param name="keep_first" value="0"/>
			<output name="output" file="fasta_to_tabular_out2.tabular" />
		</test>
		
		<test>
			<param name="input" value="454.fasta" />
			<param name="descr_columns" value="1"/>
			<param name="keep_first" value="14"/>
			<output name="output" file="fasta_to_tabular_out3.tabular" />
		</test>

		<test>
			<param name="input" value="454.fasta" />
			<param name="descr_columns" value="2"/>
			<param name="keep_first" value="0"/>
			<output name="output" file="fasta_to_tabular_out4.tabular" />
		</test>

		<test>
			<param name="input" value="454.fasta" />
			<param name="descr_columns" value="5"/>
			<param name="keep_first" value="0"/>
			<output name="output" file="fasta_to_tabular_out5.tabular" />
		</test>

		<test>
			<param name="input" value="454.fasta" />
			<param name="descr_columns" value="5"/>
			<param name="keep_first" value="10"/>
			<output name="output" file="fasta_to_tabular_out6.tabular" />
		</test>

	</tests>
	<help>
	
**What it does**

This tool converts FASTA formatted sequences to TAB-delimited format.

Many tools consider the first word of the FASTA "&gt;" title line to be an identifier, and any remaining text to be a free form description.
It is therefore useful to split this text into two columns in Galaxy (identifier and any description) by setting **How many columns to divide title string into?** to **2**.
In some cases the description can be usefully broken up into more columns -- see the examples .

The option *How many characters to keep?* allows to select a specified number of letters from the beginning of each FASTA entry.
With the introduction of the **How many columns to divide title string into?** option this setting is of limited use, but does still allow you to truncate the identifier.

-----	

**Example**

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

    &gt;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_
    AATAAAACTAAATCAGCAAAGACTGGCAAATACTCACAGGCTTATACAATACAAATGTAA

Running this tool with the default settings will produce this (2 column output):

========================================================================== =======================================
EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_  AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
========================================================================== =======================================

Having the full title line (the FASTA "&gt;" line text) as a column is not always ideal.

The **How many characters to keep?** option is useful if your identifiers are all the same length.
In this example the identifier is 14 characters, so setting **How many characters to keep?** to **14** (and leaving **How many columns to divide title string into?** as the default, **1**) will produce this (2 column output):

============== =======================================
EYKX4VC02EQLO5 TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
EYKX4VC02D4GS2 AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
============== =======================================

If however your FASTA file has identifiers of variable length, it is better to split the text into at least two columns.
Running this tool with **How many columns to divide title string into?** to **2** will produce this (3 column output):

============== =========================================================== =======================================
EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_  AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
============== =========================================================== =======================================

Running this tool with **How many columns to divide title string into?** to **5** will produce this (5 column output):

============== ========== ============ ======== ========================== =======================================
EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
EYKX4VC02D4GS2 length=60  xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_ AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
============== ========== ============ ======== ========================== =======================================

Running this tool with **How many columns to divide title string into?** to **5** and **How many characters to keep?** to **10** will produce this (5 column output).
Notice that only the first column is truncated to 10 characters -- and be careful not to trim your sequence names too much (generally they should be unique):

========== ========== ============ ======== ========================== =======================================
EYKX4VC02E length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
EYKX4VC02D length=60  xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_ AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
========== ========== ============ ======== ========================== =======================================

Note the sequences have been truncated for display purposes in the above tables.

	</help>
</tool>