/tools/fasta_tools/fasta_to_tabular.xml

https://bitbucket.org/cistrome/cistrome-harvard/ · XML · 128 lines · 101 code · 27 blank · 0 comment · 0 complexity · cb3c7ce13cb384fa3ee199fa173334f8 MD5 · raw file

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