-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathncbi_makeblastdb.xml
More file actions
307 lines (298 loc) · 16.6 KB
/
ncbi_makeblastdb.xml
File metadata and controls
307 lines (298 loc) · 16.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<tool id="ncbi_makeblastdb" name="NCBI BLAST+ makeblastdb" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
<description>Make BLAST database</description>
<macros>
<token name="@BINARY@">makeblastdb</token>
<import>ncbi_macros.xml</import>
</macros>
<expand macro="preamble">
<requirement type="package" version="3.9">python</requirement>
</expand>
<command detect_errors="aggressive" strict="true"><![CDATA[
#set $inputs = []
#set $input_compression = []
#for r in $input.selection:
#if $input.type == "protein":
#silent $inputs.append($r.input_file)
#silent $input_compression.append($r.input_file.is_of_type('fasta.gz'))
#elif $r.nuc_choice.source == "history":
#silent $inputs.append($r.nuc_choice.input_file)
#silent $input_compression.append($r.nuc_choice.input_file.is_of_type('fasta.gz'))
#else:
#silent $inputs.append($r.nuc_choice.input_file.fields.path)
#silent $input_compression.append(False)
#end if
#end for
python $__tool_directory__/check_no_duplicates.py
##First check for duplicates (since BLAST+ 2.2.28 fails to do so)
##and abort (via the ampersand ampersand trick) if any are found.
#for i in $inputs#'$i' #end for#
&&
##makeblastdb does not like input redirects of the sort
##makeblastdb -in <(gunzip -c gzipped_fasta_file)
##therefore we're cramming everything
##into a single cat command below
cat
#for i, is_gzipped in zip($inputs, $input_compression):
#if $is_gzipped:
<(gunzip -c '$i')
#else:
'$i'
#end if
#end for
| makeblastdb -out '${os.path.join($outfile.files_path, "blastdb")}'
-blastdb_version 4
$parse_seqids
$hash_index
-in -
#if $title:
-title '${title}'
#else:
##Would default to being based on the cryptic Galaxy filenames, which is unhelpful
-title 'BLAST Database'
#end if
-dbtype
#if $input.type == "protein":
prot
#else:
nucl
#end if
## --------------------------------------------------------------------
## Masking
## --------------------------------------------------------------------
## HACK: If no mask files, evaluates as a list with just None in it:
## See Trello issue https://trello.com/c/lp5YmA1O
#if ' '.join( map(str, $mask_data_file) ) != 'None':
#for i in $mask_data_file:
-mask_data '${i}'
#end for
#end if
## --------------------------------------------------------------------
## Taxonomy
## --------------------------------------------------------------------
#if $tax.taxselect == 'id':
-taxid $tax.taxid
## #else if $tax.taxselect == 'map':
## -taxid_map $tax.taxmap
#end if
## --------------------------------------------------------------------
## Capture the stdout log information to the primary file (plain text):
> '$outfile'
]]></command>
<inputs>
<conditional name="input">
<param argument="-dbtype" name="type" type="select" label="Molecule type of input">
<option value="protein">protein</option>
<option value="nucleotide">nucleotide</option>
</param>
<!-- TODO Allow merging of existing BLAST databases (conditional on the database type)?
NOTE Double check the new database would be self contained first
-->
<when value="protein">
<repeat name="selection" title="Select input" min="1" default="1">
<!-- Note this is a mandatory parameter - default should be most recent FASTA file -->
<param name="input_file" argument="-in" type="data" format="fasta,fasta.gz" label="FASTA input" help="FASTA file with one or more sequences to add to the database" />
</repeat>
</when>
<when value="nucleotide">
<repeat name="selection" title="Select input" min="1" default="1">
<conditional name="nuc_choice">
<param name="source" type="select" label="Input is a">
<option value="history">Dataset in history</option>
<option value="cached">Genome on server</option>
</param>
<when value="history">
<param name="input_file" argument="-in" type="data" format="fasta,fasta.gz" label="FASTA input" help="FASTA file with one or more sequences to add to the database" />
</when>
<when value="cached">
<param name="input_file" type="select" label="Installed genome">
<options from_data_table="all_fasta"/>
</param>
</when>
</conditional>
</repeat>
</when>
</conditional>
<param argument="-title" type="text" value="" label="Title for BLAST database" help="This is the database name shown in BLAST search output" />
<param argument="-parse_seqids" type="boolean" truevalue="-parse_seqids" falsevalue="" checked="false" label="Parse the sequence identifiers" help="This is only advised if your FASTA file follows the NCBI naming conventions using pipe '|' symbols" />
<param argument="-hash_index" type="boolean" truevalue="-hash_index" falsevalue="" checked="true" label="Enable the creation of sequence hash values" help="These hash values can then be used to quickly determine if a given sequence data exists in this BLAST database." />
<!-- SEQUENCE MASKING OPTIONS -->
<!-- Note this is an optional parameter - default should be NO files -->
<param name="mask_data_file" argument="-mask_data" type="data" multiple="true" optional="true" value="" format="maskinfo-asn1,maskinfo-asn1-binary" label="Optional ASN.1 file(s) containing masking data" help="As produced by NCBI masking applications (e.g. dustmasker, segmasker, windowmasker)" />
<!-- TODO - Option to create GI indexed masking data? via -gi_mask and -gi_mask_name? -->
<!-- TAXONOMY OPTIONS -->
<conditional name="tax">
<param name="taxselect" type="select" label="Taxonomy options">
<option value="">Do not assign a Taxonomy ID to the sequences</option>
<option value="id">Assign the same Taxonomy ID to all the sequences</option>
<!--
<option value="map">Supply text file mapping sequence IDs to taxnomy IDs</option>
TODO - Can we use a tabular file for the taxonomy mapping?
-->
</param>
<when value="">
</when>
<when value="id">
<param argument="-taxid" type="integer" min="0" value="" label="NCBI taxonomy ID" help="Integer >=0, e.g. 9606 for Homo sapiens" />
</when>
<!-- TODO: File format?
<when value="map">
<param name="taxmap" argument="-taxid_map" type="data" format="txt" label="Seq ID : Tax ID mapping file" help="Format: SequenceId TaxonomyId" />
</when>
-->
</conditional>
</inputs>
<outputs>
<!-- If we only accepted one FASTA file, we could use its human name here... -->
<data name="outfile" format="data" label="${input.type} BLAST database from ${on_string}">
<change_format>
<when input="input.type" value="nucleotide" format="blastdbn" />
<when input="input.type" value="protein" format="blastdbp" />
</change_format>
</data>
</outputs>
<tests>
<!-- Note the (two line) PIN file is not reproducible run to run.
The same applies to the NIN file for nucleotide database.
Likewise there is a datestamp in the log file as well, so use contains comparison
With and without the masking makes no difference.
With and without the taxid the only real difference is in the *.phr file.
-->
<test>
<conditional name="input">
<param name="type" value="protein"/>
<repeat name="selection">
<param name="input_file" value="four_human_proteins.fasta" ftype="fasta" />
</repeat>
</conditional>
<param name="title" value="Just 4 human proteins" />
<param name="parse_seqids" value="false" />
<param name="hash_index" value="true" />
<output name="outfile" compare="contains" file="four_human_proteins.fasta.log.txt" ftype="blastdbp">
<extra_files type="file" value="four_human_proteins.fasta.phr" name="blastdb.phr" />
<extra_files type="file" value="four_human_proteins.fasta.pin" name="blastdb.pin" compare="sim_size" delta="0" />
<extra_files type="file" value="four_human_proteins.fasta.psq" name="blastdb.psq" />
<extra_files type="file" value="four_human_proteins.fasta.pog" name="blastdb.pog" />
<extra_files type="file" value="four_human_proteins.fasta.phd" name="blastdb.phd" />
<extra_files type="file" value="four_human_proteins.fasta.phi" name="blastdb.phi" />
<extra_files type="file" value="four_human_proteins.fasta.psd" name="blastdb.psd" />
<extra_files type="file" value="four_human_proteins.fasta.psi" name="blastdb.psi" />
</output>
</test>
<test>
<conditional name="input">
<param name="type" value="protein"/>
<repeat name="selection">
<param name="input_file" value="four_human_proteins.fasta" ftype="fasta" />
</repeat>
</conditional>
<param name="title" value="Just 4 human proteins" />
<param name="parse_seqids" value="false" />
<param name="hash_index" value="true" />
<conditional name="tax">
<param name="taxselect" value="id" />
<param name="taxid" value="9606" />
</conditional>
<output name="outfile" compare="contains" file="four_human_proteins_taxid.fasta.log.txt" ftype="blastdbp">
<extra_files type="file" value="four_human_proteins_taxid.fasta.phr" name="blastdb.phr" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.pin" name="blastdb.pin" compare="sim_size" delta="0" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.psq" name="blastdb.psq" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.pog" name="blastdb.pog" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.phd" name="blastdb.phd" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.phi" name="blastdb.phi" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.psd" name="blastdb.psd" />
<extra_files type="file" value="four_human_proteins_taxid.fasta.psi" name="blastdb.psi" />
</output>
</test>
<test>
<conditional name="input">
<param name="type" value="protein"/>
<repeat name="selection">
<param name="input_file" value="four_human_proteins.fasta" ftype="fasta" />
</repeat>
</conditional>
<param name="title" value="Just 4 human proteins" />
<param name="parse_seqids" value="false" />
<param name="hash_index" value="true" />
<param name="mask_data_file" value="segmasker_four_human.maskinfo-asn1" ftype="maskinfo-asn1" />
<output name="outfile" compare="contains" file="four_human_proteins.fasta.log.txt" ftype="blastdbp">
<extra_files type="file" value="four_human_proteins.fasta.phr" name="blastdb.phr" />
<extra_files type="file" value="four_human_proteins.fasta.pin" name="blastdb.pin" compare="sim_size" delta="0" />
<extra_files type="file" value="four_human_proteins.fasta.psq" name="blastdb.psq" />
<extra_files type="file" value="four_human_proteins.fasta.pog" name="blastdb.pog" />
<extra_files type="file" value="four_human_proteins.fasta.phd" name="blastdb.phd" />
<extra_files type="file" value="four_human_proteins.fasta.phi" name="blastdb.phi" />
<extra_files type="file" value="four_human_proteins.fasta.psd" name="blastdb.psd" />
<extra_files type="file" value="four_human_proteins.fasta.psi" name="blastdb.psi" />
</output>
</test>
<test>
<conditional name="input">
<param name="type" value="nucleotide"/>
<repeat name="selection">
<conditional name="nuc_choice">
<param name="source" value="history"/>
<param name="input_file" value="three_human_mRNA.fasta.gz" ftype="fasta.gz" />
</conditional>
</repeat>
</conditional>
<param name="title" value="Just 3 human mRNA sequences" />
<param name="parse_seqids" value="false" />
<param name="hash_index" value="true" />
<conditional name="tax">
<param name="taxselect" value="id" />
<param name="taxid" value="9606" />
</conditional>
<output name="outfile" compare="contains" file="three_human_mRNA.fasta.log.txt" ftype="blastdbn">
<extra_files type="file" value="three_human_mRNA.fasta.nhr" name="blastdb.nhr" />
<extra_files type="file" value="three_human_mRNA.fasta.nin" name="blastdb.nin" compare="sim_size" delta="8" />
<extra_files type="file" value="three_human_mRNA.fasta.nsq" name="blastdb.nsq" />
<extra_files type="file" value="three_human_mRNA.fasta.nog" name="blastdb.nog" />
<extra_files type="file" value="three_human_mRNA.fasta.nhd" name="blastdb.nhd" />
<extra_files type="file" value="three_human_mRNA.fasta.nhi" name="blastdb.nhi" />
<extra_files type="file" value="three_human_mRNA.fasta.nsd" name="blastdb.nsd" />
<extra_files type="file" value="three_human_mRNA.fasta.nsi" name="blastdb.nsi" />
</output>
</test>
<test>
<conditional name="input">
<param name="type" value="nucleotide"/>
<repeat name="selection">
<conditional name="nuc_choice">
<param name="source" value="cached"/>
<param name="input_file" value="three_human_mRNA" />
</conditional>
</repeat>
</conditional>
<param name="title" value="Just 3 human mRNA sequences" />
<param name="parse_seqids" value="false" />
<param name="hash_index" value="true" />
<conditional name="tax">
<param name="taxselect" value="id" />
<param name="taxid" value="9606" />
</conditional>
<output name="outfile" compare="contains" file="three_human_mRNA.fasta.log.txt" ftype="blastdbn">
<extra_files type="file" value="three_human_mRNA.fasta.nhr" name="blastdb.nhr" />
<extra_files type="file" value="three_human_mRNA.fasta.nin" name="blastdb.nin" compare="sim_size" delta="8" />
<extra_files type="file" value="three_human_mRNA.fasta.nsq" name="blastdb.nsq" />
<extra_files type="file" value="three_human_mRNA.fasta.nog" name="blastdb.nog" />
<extra_files type="file" value="three_human_mRNA.fasta.nhd" name="blastdb.nhd" />
<extra_files type="file" value="three_human_mRNA.fasta.nhi" name="blastdb.nhi" />
<extra_files type="file" value="three_human_mRNA.fasta.nsd" name="blastdb.nsd" />
<extra_files type="file" value="three_human_mRNA.fasta.nsi" name="blastdb.nsi" />
</output>
</test>
</tests>
<help>
**What it does**
Make BLAST database from one or more FASTA files and/or BLAST databases.
This is a wrapper for the NCBI BLAST+ tool 'makeblastdb', which is the
replacement for the 'formatdb' tool in the NCBI 'legacy' BLAST suite.
More information about makeblastdb can be found in the `BLAST Command Line Applications User Manual`_.
.. _BLAST Command Line Applications User Manual: https://www.ncbi.nlm.nih.gov/books/NBK279690/
<!--
Applying masks to an existing BLAST database will not change the original database; a new database will be created.
For this reason, it's best to apply all masks at once to minimize the number of unnecessary intermediate databases.
-->
</help>
<expand macro="blast_citations" />
</tool>