upstream/fasta_to_tabular/fasta_to_tabular.xml
1<tool id="fasta2tab" name="FASTA-to-Tabular" version="1.1.1" profile="16.04">
2 <description>converter</description>
3 <requirements>
4 <requirement type="package" version="3.7">python</requirement>
5 </requirements>
6 <command>
7python '$__tool_directory__/fasta_to_tabular.py' '$input' '$output' $keep_first $descr_columns
8 </command>
9 <inputs>
10 <param name="input" type="data" format="fasta" label="Convert these sequences"/>
11 <param name="descr_columns" type="integer" value="1" min="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"/>
12 <param name="keep_first" type="integer" value="0" min="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."/>
13 </inputs>
14 <outputs>
15 <data name="output" format="tabular"/>
16 </outputs>
17 <tests>
18 <test>
19 <param name="input" value="454.fasta" />
20 <param name="descr_columns" value="1"/>
21 <param name="keep_first" value="0"/>
22 <output name="output" file="fasta_to_tabular_out1.tabular" />
23 </test>
24
25 <test>
26 <param name="input" value="4.fasta" />
27 <param name="descr_columns" value="1"/>
28 <param name="keep_first" value="0"/>
29 <output name="output" file="fasta_to_tabular_out2.tabular" />
30 </test>
31
32 <test>
33 <param name="input" value="454.fasta" />
34 <param name="descr_columns" value="1"/>
35 <param name="keep_first" value="14"/>
36 <output name="output" file="fasta_to_tabular_out3.tabular" />
37 </test>
38
39 <test>
40 <param name="input" value="454.fasta" />
41 <param name="descr_columns" value="2"/>
42 <param name="keep_first" value="0"/>
43 <output name="output" file="fasta_to_tabular_out4.tabular" />
44 </test>
45
46 <test>
47 <param name="input" value="454.fasta" />
48 <param name="descr_columns" value="5"/>
49 <param name="keep_first" value="0"/>
50 <output name="output" file="fasta_to_tabular_out5.tabular" />
51 </test>
52
53 <test>
54 <param name="input" value="454.fasta" />
55 <param name="descr_columns" value="5"/>
56 <param name="keep_first" value="10"/>
57 <output name="output" file="fasta_to_tabular_out6.tabular" />
58 </test>
59
60 </tests>
61 <help><![CDATA[
62
63**What it does**
64
65This tool converts FASTA formatted sequences to TAB-delimited format.
66
67Many tools consider the first word of the FASTA ">" title line to be an identifier, and any remaining text to be a free form description.
68It 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**.
69In some cases the description can be usefully broken up into more columns -- see the examples .
70
71The option *How many characters to keep?* allows to select a specified number of letters from the beginning of each FASTA entry.
72With 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.
73
74-----
75
76**Example**
77
78Suppose you have the following FASTA formatted sequences from a Roche (454) FLX sequencing run::
79
80 >EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_
81 TCCGCGCCGAGCATGCCCATCTTGGATTCCGGCGCGATGACCATCGCCCGCTCCACCACG
82 TTCGGCCGGCCCTTCTCGTCGAGGAATGACACCAGCGCTTCGCCCACG
83 >EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_
84 AATAAAACTAAATCAGCAAAGACTGGCAAATACTCACAGGCTTATACAATACAAATGTAA
85
86Running this tool with the default settings will produce this (2 column output):
87
88========================================================================== =======================================
89EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
90EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_ AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
91========================================================================== =======================================
92
93Having the full title line (the FASTA ">" line text) as a column is not always ideal.
94
95The **How many characters to keep?** option is useful if your identifiers are all the same length.
96In 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):
97
98============== =======================================
99EYKX4VC02EQLO5 TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
100EYKX4VC02D4GS2 AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
101============== =======================================
102
103If however your FASTA file has identifiers of variable length, it is better to split the text into at least two columns.
104Running this tool with **How many columns to divide title string into?** to **2** will produce this (3 column output):
105
106============== =========================================================== =======================================
107EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
108EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_ AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
109============== =========================================================== =======================================
110
111Running this tool with **How many columns to divide title string into?** to **5** will produce this (5 column output):
112
113============== ========== ============ ======== ========================== =======================================
114EYKX4VC02EQLO5 length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
115EYKX4VC02D4GS2 length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_ AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
116============== ========== ============ ======== ========================== =======================================
117
118Running 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).
119Notice 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):
120
121========== ========== ============ ======== ========================== =======================================
122EYKX4VC02E length=108 xy=1826_0455 region=2 run=R_2007_11_07_16_15_57_ TCCGCGCCGAGCATGCCCATCTTGGATTCCGGC...ACG
123EYKX4VC02D length=60 xy=1573_3972 region=2 run=R_2007_11_07_16_15_57_ AATAAAACTAAATCAGCAAAGACTGGCAAATAC...TAA
124========== ========== ============ ======== ========================== =======================================
125
126Note the sequences have been truncated for display purposes in the above tables.
127
128 ]]></help>
129</tool>