0
|
1 <!--
|
|
2 # =====================================================
|
|
3 # $Id: ConvertFastaHeaders.xml 90 2011-01-19 13:20:31Z pieter.neerincx@gmail.com $
|
|
4 # $URL: https://trac.nbic.nl/svn/galaxytools/trunk/tools/general/FastaTools/ConvertFastaHeaders.xml $
|
|
5 # $LastChangedDate: 2011-01-19 07:20:31 -0600 (Wed, 19 Jan 2011) $
|
|
6 # $LastChangedRevision: 90 $
|
|
7 # $LastChangedBy: pieter.neerincx@gmail.com $
|
|
8 # =====================================================
|
|
9 -->
|
|
10 <tool id="ConvertFastaHeaders1" name="ConvertFastaHeaders" version="2.0">
|
|
11 <description>Converts sequence headers of FASTA files</description>
|
|
12 <command interpreter="perl">
|
|
13 #if $mode.action == "add" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.pos.position -a $mode.action -f "$mode.pos.xfixes" -l ERROR
|
|
14 #elif $mode.action == "strip" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.pos.position -a $mode.action -f "$mode.pos.xfixes" -l ERROR
|
|
15 #elif $mode.action == "replace" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.pos.position -a $mode.action -f "$mode.pos.xfixes" -n $mode.pos.newfix -l ERROR
|
|
16 #elif $mode.action == "delete" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.position -a $mode.action -l ERROR
|
|
17 #elif $mode.action == "shuffle" #ConvertFastaHeaders.pl -i $input -o $output -p $mode.position -a $mode.action -l ERROR
|
|
18 #end if
|
|
19 </command>
|
|
20 <inputs>
|
|
21 <param format="fasta" name="input" type="data" label="FASTA sequences"/>
|
|
22 <conditional name ="mode">
|
|
23 <param name="action" type="select">
|
|
24 <label>Action to perform on sequence identifiers</label>
|
|
25 <option value="add">Add Labels</option>
|
|
26 <option value="strip">Remove Labels</option>
|
|
27 <option value="replace">Replace Labels</option>
|
|
28 <option value="delete">Delete</option>
|
|
29 <option value="shuffle">Shuffle order</option>
|
|
30 </param>
|
|
31 <when value="add">
|
|
32 <conditional name="pos">
|
|
33 <param name="position" type="select" accept_default="true">
|
|
34 <label> Label position </label>
|
|
35 <option value="prefix">Prepend Prefixes</option>
|
|
36 <option value="suffix">Append Suffixes</option>
|
|
37 </param>
|
|
38 <when value="prefix">
|
|
39 <param name="xfixes" type="text" label="Space separated list of prefixes, which will be added"/>
|
|
40 </when>
|
|
41 <when value="suffix">
|
|
42 <param name="xfixes" type="text" label="Space separated list of suffixes, which will be added"/>
|
|
43 </when>
|
|
44 </conditional>
|
|
45 </when>
|
|
46 <when value="strip">
|
|
47 <conditional name="pos">
|
|
48 <param name="position" type="select" accept_default="true">
|
|
49 <label> Label position </label>
|
|
50 <option value="prefix">Strip Prefixes</option>
|
|
51 <option value="suffix">Strip Suffixes</option>
|
|
52 </param>
|
|
53 <when value="prefix">
|
|
54 <param name="xfixes" type="text" label="Space separated list of prefixes, which will be removed"/>
|
|
55 </when>
|
|
56 <when value="suffix">
|
|
57 <param name="xfixes" type="text" label="Space separated list of suffixes, which will be removed"/>
|
|
58 </when>
|
|
59 </conditional>
|
|
60 </when>
|
|
61 <when value="replace">
|
|
62 <conditional name="pos">
|
|
63 <param name="position" type="select" accept_default="true">
|
|
64 <label> Label position </label>
|
|
65 <option value="prefix">Replace prefixes with another prefix</option>
|
|
66 <option value="suffix">Replace suffixes with another suffix</option>
|
|
67 <option value="pre2suf">Replace prefixes with a suffix</option>
|
|
68 <option value="suf2pre">Replace suffixes with a prefix</option>
|
|
69 </param>
|
|
70 <when value="prefix">
|
|
71 <param name="xfixes" type="text" label="Space separated list of prefixes, which will be replaced"/>
|
|
72 <param name="newfix" type="text" label="New prefix to replace the current prefixes"/>
|
|
73 </when>
|
|
74 <when value="suffix">
|
|
75 <param name="xfixes" type="text" label="Space separated list of suffixes, which will be replaced"/>
|
|
76 <param name="newfix" type="text" label="New suffix to replace the current suffixes"/>
|
|
77 </when>
|
|
78 <when value="pre2suf">
|
|
79 <param name="xfixes" type="text" label="Space separated list of prefixes, which will be replaced"/>
|
|
80 <param name="newfix" type="text" label="New suffix to replace the current prefixes"/>
|
|
81 </when>
|
|
82 <when value="suf2pre">
|
|
83 <param name="xfixes" type="text" label="Space separated list of suffixes, which will be replaced"/>
|
|
84 <param name="newfix" type="text" label="New prefix to replace the current suffixes"/>
|
|
85 </when>
|
|
86 </conditional>
|
|
87 </when>
|
|
88 <when value="delete">
|
|
89 <param name="position" type="text" size="10" value="" label="Ranks of IDs to delete"
|
|
90 help="Comma separated list of numbers. For example 1,3 will delete the first and third ID from the FASTA headers."/>
|
|
91 </when>
|
|
92 <when value="shuffle">
|
|
93 <param name="position" type="text" size="10" value="" label="New order for the IDs"
|
|
94 help="Comma separated list of numbers. For example 1,3,2 will shuffle the order from 1,2,3 to 1,3,2."/>
|
|
95 </when>
|
|
96 </conditional>
|
|
97 </inputs>
|
|
98 <outputs>
|
|
99 <data format="fasta" name="output" label="${input.name} with converted FASTA headers"/>
|
|
100 </outputs>
|
|
101 <!--
|
|
102 <tests>
|
|
103 <test> -a add -f "UniProt-Acc: UniProt-ID:"
|
|
104 <param name="input" value="ConvertFastaHeaders_example_input_Add.fasta"/>
|
|
105 <output name="output" file="ConvertFastaHeaders_example_output_Add.fasta"/>
|
|
106 </test>
|
|
107 <test> -a strip -p prefix -f 'SP:'
|
|
108 <param name="input" value="ExtractPeptideSequenceContext_example_DB.fasta"/>
|
|
109 <output name="output" file="ConvertFastaHeaders_example_output_Strip.fasta"/>
|
|
110 </test>
|
|
111 <test> -a replace -p pre2suf -f 'SP:' -n '_CON'
|
|
112 <param name="input" value="ExtractPeptideSequenceContext_example_DB.fasta"/>
|
|
113 <output name="output" file="ConvertFastaHeaders_example_output_Replace.fasta"/>
|
|
114 </test>
|
|
115 <test> -a delete -p '1 3'
|
|
116 <param name="input" value="ExtractPeptideSequenceContext_example_DB.fasta"/>
|
|
117 <output name="output" file="ConvertFastaHeaders_example_output_Delete.fasta"/>
|
|
118 </test>
|
|
119 <test> -a shuffle -p '2 3 1'
|
|
120 <param name="input" value="ExtractPeptideSequenceContext_example_DB.fasta"/>
|
|
121 <output name="output" file="ConvertFastaHeaders_example_output_Shuffle.fasta"/>
|
|
122 </test>
|
|
123 </tests>
|
|
124 -->
|
|
125 <help>
|
|
126
|
|
127 .. class:: infomark
|
|
128
|
|
129 **What it does**
|
|
130
|
|
131 This tool converts the sequence headers (the description line starting with >) for a set of FASTA sequences. \
|
|
132 Currently supported conversions:
|
|
133
|
|
134 - Append prefixes like for example database namespace to identifiers / accession numbers.
|
|
135 - Append suffixes to identifiers / accession numbers.
|
|
136 - Remove prefixes like for example database namespace from identifiers / accession numbers.
|
|
137 - Remove suffixes from identifiers / accession numbers.
|
|
138 - Replace prefixes with a suffix or vice versa.
|
|
139
|
|
140 -----
|
|
141
|
|
142 **Examples**
|
|
143
|
|
144 ========================================================
|
|
145 *Appending database namespace prefixes*
|
|
146 ========================================================
|
|
147
|
|
148 Supply a space separated list of prefixes to add to pipe separated identifiers. \
|
|
149 The prefixes must contain both the database namespace you want to add and the character used to separate the namespace from the identifier. \
|
|
150 The order of the namespaces is important in this case! \
|
|
151 For example with action *Add Labels*, label position *Prepend Prefixes* and prefixes *UniProtAcc: UniProtID:*, this header::
|
|
152
|
|
153 >P32234|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
154
|
|
155 will be converted into::
|
|
156
|
|
157 >UniProtAcc:P32234|UniProtID:128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
158
|
|
159 ========================================================
|
|
160 *Removing database namespace prefixes*
|
|
161 ========================================================
|
|
162
|
|
163 Supply a space separated list of namespaces to remove from pipe separated identifiers. \
|
|
164 The prefixes must contain both the database namespace you want to remove and the character used to separate the namespace from the identifier. \
|
|
165 The order of the namespaces is not relevant in this case. \
|
|
166 For example with action *Remove Labels*, label position *Strip Prefixes* and \
|
|
167 with prefixes *UniProtAcc: UniProtID:* or with prefixes *UniProtID: UniProtAcc:*, this header::
|
|
168
|
|
169 >UniProtAcc:P32234|UniProtID:128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
170
|
|
171 will be converted into::
|
|
172
|
|
173 >P32234|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
174
|
|
175 ========================================================
|
|
176 *Replacing a prefix with a suffix*
|
|
177 ========================================================
|
|
178
|
|
179 Supply the prefix to remove from pipe separated identifiers and a new suffix. \
|
|
180 The order of the prefixes is not relevant in this case. \
|
|
181 Optionally you can specify more than one prefix to remove by separating them with spaces. \
|
|
182 You can specify only one new suffix though, so in case you specified more than one prefix they will all be replaced with the same new suffix. \
|
|
183 In the following example we'll replace a *REV_* prefix to indicate a reversed sequence with a *_REV* suffix. \
|
|
184 With action *Replace Labels*, label position *Replace prefixes with a suffix*, prefix *REV_* and new suffix *_REV*, this header::
|
|
185
|
|
186 >REV_P32234|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
187
|
|
188 will be converted into::
|
|
189
|
|
190 >P32234_REV|128UP_DROME GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
191
|
|
192 ========================================================
|
|
193 *Other \*fix replacements*
|
|
194 ========================================================
|
|
195
|
|
196 You can also replace a prefix with a new prefix, a suffix with a new suffix or a suffix with a new prefix. \
|
|
197 These replacements are all similar to the example above. \
|
|
198 Hence you can specify multiple \*-fixes to be replaced and only one new \*-fix to replace the existing ones.
|
|
199
|
|
200 ========================================================
|
|
201 *Deleting sequence identifiers*
|
|
202 ========================================================
|
|
203
|
|
204 Supply a comma separated list of numbers for the ranks of the identifiers / accession numbers you want to remove. \
|
|
205 Multiple identifiers must be separated with a pipe symbol. \
|
|
206 For example with action *Delete*, and Ranks of IDs to delete set to *1,3*, this header::
|
|
207
|
|
208 >UniProtID:128UP_DROME|UniProtAcc:P32234|EMBL:AY069810 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
209
|
|
210 will be converted into::
|
|
211
|
|
212 >UniProtAcc:P32234 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
213
|
|
214 ========================================================
|
|
215 *Changing the order of sequence identifiers*
|
|
216 ========================================================
|
|
217
|
|
218 Supply a comma separated list of numbers for the new order of all the identifiers / accession numbers in a header. \
|
|
219 Multiple identifiers must be separated with a pipe symbol. \
|
|
220 Hence if your headers contain 4 pipe separated IDs and you only want to swap the order of the first and the second, \
|
|
221 you will still need to specify the new (unchanged) order for number 3 and 4 too.
|
|
222
|
|
223 For example with action *Shuffle*, and New order for the IDs set to *2,1,3*, this header::
|
|
224
|
|
225 >UniProtID:128UP_DROME|UniProtAcc:P32234|EMBL:AY069810 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
226
|
|
227 will be converted into::
|
|
228
|
|
229 >UniProtAcc:P32234|UniProtID:128UP_DROME|EMBL:AY069810 GTP-binding protein 128up - Drosophila melanogaster (Fruit fly)
|
|
230
|
|
231 Specifying only *2,1* as the New order for the IDs will not work, because this header contains 3 IDs, \
|
|
232 so you'll have to include the (new) position for the third one as well.
|
|
233
|
|
234 ========================================================
|
|
235 *Need another type of conversion?*
|
|
236 ========================================================
|
|
237
|
|
238 Contact your local bioinformaticians to add other conversions...
|
|
239
|
|
240 </help>
|
|
241 </tool>
|