script/yaml-generator-42.pl untested

filter: Statementstmt 0.0% 0 / 289 Branchbran 0.0% 0 / 78 Conditioncond 0.0% 0 / 16 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 24 Podpod 0.0% 0 / 8 totaltotal 0.0% 0 / 415 SCAR 54.8
CC
15
Cov
0%
_get_tax_filter
56.0
_prompt4path
20.0
build_org_n_tax_filter_for
20.0
CRAP 240.0
1 #!/usr/bin/env perl
2 # PODNAME: yaml-generator-42.pl
3 # ABSTRACT: Interactive or batch generator for 42 YAML config files
4 # CONTRIBUTOR: Mick VAN VLIERBERGHE <mvanvlierberghe@doct.uliege.be>
5  
6 use autodie;
7 use Modern::Perl '2011';
8  
9 use Smart::Comments;
10 use Getopt::Euclid qw(:vars);
11  
12 use Template;
13 use Path::Class;
14 use Tie::IxHash;
15 use List::AllUtils;
16 use File::Basename;
17 use File::Find::Rule;
18  
19 use Bio::MUST::Core;
20 use aliased 'Bio::MUST::Core::SeqId';
21 use aliased 'Bio::MUST::Core::Taxonomy';
22 use Bio::FastParsers::Constants qw(:files);
23  
24 use Term::Completion::Path;
25 use IO::Prompter [
26 -verbatim,
27 -style => 'blue strong ',
28 -must => { 'be a string' => qr{\S+} }
29 ];
30 # bold => [qw<boldly strong heavy emphasis emphatic highlight highlighted fort forte>],
31 # dark => [qw<darkly dim deep>],
32 # faint => [qw<faintly light soft>],
33 # underline => [qw<underlined underscore underscored italic italics>],
34 # blink => [qw<blinking flicker flickering flash flashing>],
35 # reverse => [qw<reversed inverse inverted>],
36 # concealed => [qw<hidden blank invisible>],
37 # reset => [qw<normal default standard usual ordinary regular>],
38 # bright_ => [qw< bright\s+ vivid\s+ >],
39 # red => [qw< scarlet vermilion crimson ruby cherry cerise cardinal carmine
40 # burgundy claret chestnut copper garnet geranium russet
41 # salmon titian coral cochineal rose cinnamon ginger gules >],
42 # yellow => [qw< gold golden lemon cadmium daffodil mustard primrose tawny
43 # amber aureate canary champagne citrine citron cream goldenrod honey straw >],
44 # green => [qw< olive jade pea emerald lime chartreuse forest sage vert >],
45 # cyan => [qw< aqua aquamarine teal turquoise ultramarine >],
46 # blue => [qw< azure cerulean cobalt indigo navy sapphire >],
47 # magenta => [qw< amaranthine amethyst lavender lilac mauve mulberry orchid periwinkle
48 # plum pomegranate violet purple aubergine cyclamen fuchsia modena puce
49 # purpure >],
50 # black => [qw< charcoal ebon ebony jet obsidian onyx raven sable slate >],
51 # white => [qw< alabaster ash chalk ivory milk pearl silver argent >],
52  
53  
54  
55 # define config file template
56 my $tt_str = <<'EOT';
57 # ===Run mode===
58 # Two values are available: 'phylogenomic' and 'metagenomic'.
59 # The phylogenomic mode is designed to enrich multiple sequence alignements
60 # (ALIs) with orthologues for subsequent phylogenomic analysis. In contrast,
61 # the metagenomic mode is designed to probe contamination in transcriptomic
62 # data using reference ribosomal protein ALIs; it produces a taxonomic report
63 # per ALI listing the lineage of each identified orthologous sequence.
64 # When not specified, 'run_mode' internally defaults to 'phylogenomic'.
65 run_mode: [% run_mode %]
66  
67 # ===Suffix to append to infile basenames for deriving outfile names===
68 # When not specified 'outsuffix' internally defaults to '-42'.
69 # Use a bare 'out_suffix:' to reuse the ALI name and to preserve the original
70 # file by appending a .bak extension to its name.
71 out_suffix: [% out_suffix %]
72  
73  
74 # ===Orgs from where to select BLAST queries===
75 # Depending on availability at least one query by family and by org will be
76 # picked for the 'homologues' and 'references' BLAST rounds.
77 query_orgs: [% FOREACH org IN query_orgs.sort %]
78 - [% org %] [% END %]
79  
80  
81 # ===Optional args for each BLAST step===
82 # Any valid command-line option can be specified (see NCBIBLAST+ docs).
83 # Note the hyphens (-) before option names (departing from API consistency).
84 # -query, -db, -out, -outfmt, -db_gencode, -query_gencode will be ignored as
85 # they are directly handled by forty-two itself. -max_target_seqs may be
86 # specified at step 'homologues' to speed up things.
87 blast_args:
88 # TBLASTN vs banks
89 homologues:
90 -evalue: [% evalue %]
91 [% UNLESS SSUrRNA -%]-seg: [% homologues_seg %][%- END %]
92 -num_threads: 1
93 -max_target_seqs: [% max_target_seqs %]
94 [%- IF ref_brh == 'on' %]
95 # BLASTP vs ref banks (for transitive BRH ; actually two steps)
96 references:
97 -evalue: [% evalue %]
98 -num_threads: 1
99 # BLASTX vs ref banks (for transitive BRH)
100 orthologues:
101 -evalue: [% evalue %]
102 -num_threads: 1[% END %]
103 # BLASTX vs ALI (for tax filters and alignment)
104 templates:
105 -evalue: [% evalue %]
106 [% UNLESS SSUrRNA -%]-seg: [% templates_seg %][%- END %]
107 -num_threads: 1
108  
109  
110 # ===BRH switch for assessing orthology===
111 # Two values are available: 'on' and 'off'.
112 # If set to 'on', a candidate seq must be in BRH with all reference proteomes
113 # to be considered as an orthologous seq. In contrast, all candidate seqs are
114 # considered as orthologous seqs when this parameter is set to 'off'.
115 # When not specified, 'ref_brh' internally defaults to 'on'.
116 # To limit the number of candidate seqs, use the '-max_target_seqs' option of
117 # the BLAST executable(s) at the 'homologues' step.
118 ref_brh: [% ref_brh %]
119  
120 [% IF ref_brh == 'on' %]
121 # ===Path to dir holding complete proteome BLAST databases===
122 # Only required when setting 'ref_brh' to 'on'.
123 ref_bank_dir: [% ref_bank_dir %]
124  
125 # ===Basenames of complete proteome BLAST databases (keyed by org name)===
126 # Only required when setting 'ref_brh' to 'on'.
127 # You can list as many databases as needed here. Only those specified as
128 # 'ref_orgs' below will actually be used for BRH.
129 ref_org_mapper: [% FOREACH bank IN ref_org_for.keys.sort %]
130 [% ref_org_for.$bank %]: [% bank %] [% END %]
131  
132 # ===Orgs to be used for BRH checks===
133 # Only required when setting 'ref_brh' to 'on'.
134 # To be considered as an orthologue, a candidate seq must be in transitive BRH
135 # for all listed orgs (and not for only one of them). Listing more orgs thus
136 # increases the stringency of the BRH check. Note that 'ref_orgs' may but DO
137 # NOT NEED to match 'query_orgs'.
138 ref_orgs: [% FOREACH bank IN ref_org_for.keys.sort %]
139 - [% ref_org_for.$bank %] [% END %]
140  
141 # ===Fraction of ref_orgs to really use when assessing orthology===
142 # Only meaningful when setting 'ref_brh' to 'on'.
143 # This parameter introduces some flexibility when using reference proteomes.
144 # If set to a fractional value (below 1), only the best proteomes will be
145 # considered during BRHs. The best proteomes are those against which the
146 # queries have the highest average scores. This helps discarding ref_orgs that
147 # might hinder orthology assessment because they lack the orthologous gene(s).
148 # When not specified, 'reg_org_mul' internally defaults to 1.0, which is the
149 # strictest mode since all reference proteomes are used during BRHs.
150 ref_org_mul: [% ref_org_mul %]
151  
152 # ===Bit score reduction allowed when including non-1st hits among best hits===
153 # Only meaningful when setting 'ref_brh' to 'on'.
154 # This parameter applies when collecting best hits for queries to complete
155 # proteomes, so that close in-paralogues can all be included in the set of
156 # best hits. The allowed bit score reduction of any hit is expressed
157 # relatively to the score of the previous hit. During BRH checks, only the
158 # very first hit for the candidate seq is actually tested for inclusion in
159 # this set but for all complete proteomes. By default at most 10 hits are
160 # considered. To change this, use the '-max_target_seqs' option of the BLAST
161 # executable(s) at the 'reference' step.
162 # When not specified 'ref_score_mul' internally defaults to 1.0, which is the
163 # strictest mode since only equally-best hits are retained.
164 ref_score_mul: [% ref_score_mul %][% END %]
165  
166 [% IF tol_check == 'on' -%]
167 # ===TreeOfLife check===
168 #
169 #
170 tol_check: [% tol_check %]
171  
172 # ===Path to TreeOfLife database===
173 #
174 #
175 tol_bank_dir: [% tol_bank_dir %]
176 tol_bank: [% tol_bank %][%- END %]
177  
178 # ===Homologues trimming switch===
179 # Two values are available: 'on' and 'off'.
180 # If set to 'on', each candidate seq is first trimmed to the range covered by
181 # the HSPs that retrieved it. This makes the orthology assessment more robust
182 # and helps exonerate to splice genes correctly. The details of this trimming
183 # step can be fine-tuned by editing the other trim_* parameters of this
184 # configuration file.
185 # When not specified, 'trim_homologues' internally defaults to 'on'.
186 trim_homologues: [% trim_homologues %]
187  
188 [% IF trim_homologues == 'on' -%]
189 # ===Max distance between HSPs allowed when defining a hit range===
190 # Only meaningful when setting 'trim_homologues' to 'on'.
191 # HSPs define ranges that will be used to extract one or more candidate seq(s)
192 # from each hit. Before extraction, neighboring ranges are merged if they lie
193 # at max this distance (in nt) apart. This distance can thus be seen as the
194 # max length allowed for an intron within a gene to be added.
195 # When not specified 'trim_max_shift' internally defaults to 20000 nt.
196 trim_max_shift: [% trim_max_shift %]
197  
198 # ===Extra margin to hit range===
199 # Only meaningful when setting 'trim_homologues' to 'on'.
200 # Since HSPs can sometimes miss the beginning or end of the best hit, this
201 # parameter extends the range of the candidate seq to be extracted at both
202 # extremities (in nt) to allow for a potentially more complete seq.
203 # When not specified 'trim_extra_margin' internally defaults to 15 nt.
204 trim_extra_margin: [% trim_extra_margin %][%- END %]
205  
206 # ===Orthologues merging switch===
207 # Two values are available: 'on' and 'off'.
208 # If set to 'on', each batch of orthologous seqs from the same org is first
209 # fed to CAP3 in an attempt to merge some of them into contigs. Successfully
210 # merged orthologous seqs are identified by a trailing +N tag where N is the
211 # number of orthologous seqs removed in the merging process. The contig itself
212 # is named after the longest orthologous seq composing it.
213 # The details of this merging step can be fine-tuned by editing the other
214 # merge_* parameters of this configuration file.
215 # When not specified, 'merge_orthologues' internally defaults to 'off'.
216 # The YAML wizard automatically sets it to 'off' if 'run_mode' is 'metagenomic'.
217 merge_orthologues: [% merge_orthologues %]
218  
219 [% IF merge_orthologues == 'on' -%]
220 # ===Min identity in overlap for merging two orthologous seqs===
221 # Only meaningful when setting 'merge_orthologues' to 'on'.
222 # This parameter is the CAP3 '-p' parameter except that it is specified as a
223 # fractional number (between 0 and 1).
224 # When not specified, 'merge_min_ident' internally defaults to 0.9 (= 90%).
225 merge_min_ident: [% merge_min_ident %]
226  
227 # ===Min length of overlap for merging two orthologous seqs===
228 # Only meaningful when setting 'merge_orthologues' to 'on'.
229 # This parameter is the CAP3 '-o' parameter (in nt).
230 # When not specified, 'merge_min_len' internally defaults to 40 nt.
231 merge_min_len: [% merge_min_len %][%- END %]
232  
233  
234 # ===Engine to be used for aligning new seqs===
235 # Four values are available: 'blast', 'exonerate', 'exoblast' and 'off'.
236 # If the alignment engine is 'off', new seqs are added 'as is' to the ALI.
237 # Consequently, they will be full length but not aligned to existing seqs.
238 # This mode is meant for protein seqs only and thus cannot be used when adding
239 # transcripts from nucleotide banks.
240 # The 'exonerate' mode sometimes fails to align orthologous seqs due to a bug
241 # in exonerate executable. This causes new seqs to be lost. To automatically
242 # retry aligning them with BLAST in case of failure, use the 'exoblast' mode.
243 # When not specified, 'aligner_mode' internally defaults to 'blast'.
244 # The YAML wizard automatically sets it to 'off' if 'run_mode' is 'metagenomic'.
245 aligner_mode: [% aligner_mode %]
246  
247 [% UNLESS aligner_mode == 'off' %]
248 # ===Self-template selection switch for aligning new seqs===
249 # Only meaningful when setting 'aligner_mode' to a value other than 'off'.
250 # Two values are available: 'on' and 'off'.
251 # If set to 'on', closest relatives belonging to the same org as the new seqs
252 # will not be selected as templates, thus allowing the latter to align better.
253 # When not specified, 'ali_skip_self' internally defaults to 'off'.
254 ali_skip_self: [% ali_skip_self %]
255  
256 # ===Coverage improvement required to consider non-1st hits as templates===
257 # Only meaningful when setting 'aligner_mode' to a value other than 'off'.
258 # This parameter applies when collecting templates for aligning the new seqs.
259 # Templates get considered as long as query coverage improves at least of this
260 # value (relatively to the previous template). The exact effect of this
261 # parameter depends on the 'aligner_mode' engine: 'exonerate' will try to use
262 # the longest template for alignment while 'blast' will use each hit in turn
263 # (as a fall-back with 'exoblast'). New seqs can thus be added more than once
264 # to the ALI (with ids *.H1.N, *.H2.N etc).
265 # When not specified 'ali_cover_mul' internally defaults to 1.1., which means
266 # that if the BLAST alignment with the second template is at least 110% of the
267 # BLAST alignment with the first template, both templates are retained.
268 ali_cover_mul: [% ali_cover_mul %][% END %]
269  
270 # ===Preservation switch for '#NEW#' tags from preexisting sequences===
271 # Two values are available: 'on' and 'off'.
272 # If set to 'on' (default), #NEW# tags will be preserved. Note that
273 # preexisting new sequences are invisible to 42 (they cannot be used as
274 # queries etc).
275 ali_keep_old_new_tags: [% ali_keep_old_new_tags %]
276  
277 # ===Action to perform when a preexisting lengthened seq is identified===
278 # Currently, two values are available: 'remove' and 'keep'.
279 # The option is quite self-explanatory. It is useful when one runs 42 multiple
280 # times on the sames ALIs to repeatedly enrich the same orgs, assuming that
281 # org banks are updated between runs.
282 # When not specified, 'ali_keep_lengthened_seqs' internally defaults to
283 # 'keep'.
284 ali_keep_lengthened_seqs: [% ali_keep_lengthened_seqs %]
285  
286  
287 # ===Taxonomic report switch===
288 # Two values are available: 'on' and 'off'.
289 # If set to 'on', the lineage of new seqs is inferred by analyzing the
290 # taxonomy of their ALI closest relatives and one '.tax-report' file is
291 # generated for each ALI processed (see 'run_mode' above).
292 # The details of this taxonomic analysis can be fine-tuned by editing the
293 # other tax_* parameters of this configuration file.
294 # When not specified, 'tax_reports' internally defaults to 'off'. Yet, the
295 # The YAML wizard automatically sets it to 'on' if 'run_mode' is 'metagenomic'.
296 [% IF tax_reports %]tax_reports: [% tax_reports %][% ELSE %]tax_reports: on[% END -%]
297  
298 [% IF tax_dir %]
299 # ===Path to dir holding NCBI Taxonomy database===
300 # Only required when enabling 'tax_reports' or specifying 'tax_filter'.
301 # It can be installed using setup-taxdir.pl.
302 tax_dir: [% tax_dir %]
303  
304 # ===Min number of relatives to use when inferring taxonomy of new seqs===
305 # Only meaningful when enabling 'tax_reports' or specifying 'tax_filter'.
306 # This parameter is a lower bound. The real number will depend both on the
307 # four thresholds below ('tax_min_ident', 'tax_min_len', 'tax_min_score' and
308 # 'tax_score_mul') and on the ability of 42 to deduce the taxonomy of each
309 # individual relative to compute the LCA of the new seq.
310 # When not specified, 'tax_min_hits' internally defaults to 1.
311 [% IF tax_min_hits %]tax_min_hits: [% tax_min_hits %][% ELSE %]tax_min_hits: 1[% END %]
312  
313 # ===Max number of relatives to use when inferring taxonomy of new seqs===
314 # Only meaningful when enabling 'tax_reports' or specifying 'tax_filter'.
315 # As for 'tax_min_hits' above, this parameter is a upper bound.
316 # When not specified, 'tax_max_hits' internally defaults to unlimited.
317 [% IF megan_like %]tax_max_hits: 100
318 [%- ELSIF best_hit %]tax_max_hits: 1
319 [%- ELSIF tax_max_hits %]tax_max_hits: [% tax_max_hits %][%- END %]
320  
321 # ===Min identity of relatives to use when inferring taxonomy of new seqs===
322 # Only meaningful when enabling 'tax_reports' or specifying 'tax_filter'.
323 # This parameter is the traditional BLAST 'percent identity' statistics except
324 # that it is specified as a fractional number (between 0 and 1). It is
325 # evaluated on the first HSP of potential relatives.
326 # When not specified, 'tax_min_ident' internally defaults to 0.
327 [% IF megan_like %]tax_min_ident: 0[% ELSIF best_hit %]tax_min_ident: 0[% ELSIF tax_min_ident %]tax_min_ident: [% tax_min_ident %][% END -%]
328  
329 # ===Min length of relatives to use when inferring taxonomy of new seqs===
330 # Only meaningful when enabling 'tax_reports' or specifying 'tax_filter'.
331 # This parameter is the traditional BLAST 'alignment length' statistics. It is
332 # evaluated on the first HSP of potential relatives.
333 # When not specified, 'tax_min_len' internally defaults to 0.
334 [% IF megan_like %]tax_min_len: 0[% ELSIF best_hit %]tax_min_len: 0[% ELSIF tax_min_len %]tax_min_len: [% tax_min_len %][% END -%]
335  
336 # ===Min bit score of relatives to use when inferring taxonomy of new seqs===
337 # Only meaningful when enabling 'tax_reports' or specifying 'tax_filter'.
338 # This parameter is the traditional BLAST 'bit score' statistics. It is
339 # evaluated on the first HSP of potential relatives.
340 # When not specified, 'tax_min_score' internally defaults to 0.
341 [% IF megan_like %]tax_min_score: 80[% ELSIF best_hit %]tax_min_score: 0[% ELSIF tax_min_score %]tax_min_score: [% tax_min_score %][% END %]
342  
343 # ===Bit score reduction allowed when inferring taxonomy of new seqs===
344 # Only meaningful when enabling 'tax_reports' or specifying 'tax_filter'.
345 # The allowed bit score reduction of any relative is expressed relatively to
346 # the score of the FIRST relative (as in MEGAN algorithm).
347 # When not specified, 'tax_score_mul' internally defaults to 0.
348 [% IF megan_like %]tax_score_mul: 0.95[% ELSIF best_hit %]tax_score_mul: 0[% ELSIF tax_score_mul %]tax_score_mul: [% tax_score_mul %][% END %][%- END -%]
349  
350  
351 # ===Path to dir holding transcript BLAST databases===
352 bank_dir: [% bank_dir %]
353  
354 # ===Default args applying to all orgs unless otherwise specified===
355 # Some of these args can be thus specified on a per-org basis below if needed.
356 # This especially makes sense for 'code'.
357 defaults:
358 # ===Genetic code for translated BLAST searches===
359 # When not specified 'code' internally defaults to 1 (standard).
360 # See ftp://ftp.ncbi.nih.gov/entrez/misc/data/gc.prt for other codes.
361 code: [% code %]
362  
363 # ===Org-specific args===
364 # The only mandatory args are 'org' and 'banks'. All other args are taken from
365 # the 'defaults:' section described above.
366 # This part can be concatenated on a per-run basis to the previous part, which
367 # would be the same for several runs. In the future, forty-two might support
368 # two different configuration files to reflect this conceptual distinction.
369 orgs: [% FOREACH bank IN org_for.keys.sort %]
370 - org: [% org_for.$bank %]
371 banks:
372 - [% bank %]
373 [% tax_filter_for.$bank %] [% END %]
374  
375 #[% USE date %]
376 # This config file has been generated automatically on [% date.format %].
377 # We advise not to modify directly this file manually but rather to modify the
378 # yaml-generator command instead for traceability and reproducibility.
379 #
380 #yaml-generator-42.pl --run_mode=[% run_mode %][% IF SSUrRNA %] --SSUrRNA[% END %] --out_suffix=[% out_suffix %] \
381 #--queries [% queries %] \
382 #--evalue=[% evalue %][% UNLESS SSUrRNA %] --homologues_seg=[% homologues_seg %][% END %] --max_target_seqs=[% max_target_seqs %][% UNLESS SSUrRNA %] --templates_seg=[% templates_seg %][% END %] \
383 #--bank_dir [% bank_dir %] --bank_suffix=[% bank_suffix %] --bank_mapper [% bank_mapper %] --code=[% code %]\
384 #--ref_brh=[% ref_brh -%][% IF ref_brh == 'on' %] --ref_bank_dir [% ref_bank_dir %] --ref_bank_suffix=[% ref_bank_suffix %] --ref_bank_mapper [% ref_bank_mapper %] \
385 #--ref_org_mul=[% ref_org_mul %] --ref_score_mul=[% ref_score_mul %][%- END %] \
386 #--trim_homologues=[% trim_homologues %][% IF trim_homologues == 'on' %] --trim_max_shift=[% trim_max_shift %] --trim_extra_margin=[% trim_extra_margin %][%- END %] \
387 #--merge_orthologues=[% merge_orthologues %][% IF merge_orthologues == 'on' %] --merge_min_ident=[% merge_min_ident %] --merge_min_len=[% merge_min_len %][%- END %] \
388 #--aligner_mode=[% aligner_mode %][% UNLESS aligner_mode == 'off' %] --ali_skip_self=[% ali_skip_self %] --ali_cover_mul=[% ali_cover_mul %][% END %] --ali_keep_old_new_tags=[% ali_keep_old_new_tags %] --ali_keep_lengthened_seqs=[% ali_keep_lengthened_seqs %] \
389 #--tax_reports=[% tax_reports %][% IF tax_dir %] --tax_dir [% tax_dir %][% END %] \
390 #[% IF megan_like %]--megan_like \[% ELSIF best_hit %]--best_hit \[% ELSE %]--tax_min_score=[% tax_min_score %] --tax_score_mul=[% tax_score_mul %] --tax_min_ident=[% tax_min_ident %] --tax_min_len=[% tax_min_len %] \[% END %]
391 #--tol_check=[% tol_check %][% IF tol_check == 'on' %] --tol_db [% tol_db %] \[%- END %]
392 [% IF levels %]#--levels=[% levels.join(' ') %][%- END %]
393 EOT
394  
395 # CMD TEMPLATE
396 my $tt_cmd = <<'EOT';
397 [% USE date %]
398 # This config file has been generated automatically on [% date.format %].
399 # We advise not to modify directly this file manually but rather to modify
400 # the yaml-generator command instead for traceability and reproducibility.
401  
402 yaml-generator-42.pl --run_mode=[% run_mode %][% IF SSUrRNA %] --SSUrRNA[% END %] --out_suffix=[% out_suffix %] \
403 --queries [% queries %] \
404 --evalue=[% evalue %][% UNLESS SSUrRNA %] --homologues_seg=[% homologues_seg %][% END %] --max_target_seqs=[% max_target_seqs %][% UNLESS SSUrRNA %] --templates_seg=[% templates_seg %][% END %] \
405 --bank_dir [% bank_dir %] --bank_suffix=[% bank_suffix %] --bank_mapper [% bank_mapper %] --code=[% code %]\
406 --ref_brh=[% ref_brh -%][% IF ref_brh == 'on' %] --ref_bank_dir [% ref_bank_dir %] --ref_bank_suffix=[% ref_bank_suffix %] --ref_bank_mapper [% ref_bank_mapper %] \
407 --ref_org_mul=[% ref_org_mul %] --ref_score_mul=[% ref_score_mul %][%- END %] \
408 --trim_homologues=[% trim_homologues %][% IF trim_homologues == 'on' %] --trim_max_shift=[% trim_max_shift %] --trim_extra_margin=[% trim_extra_margin %][%- END %] \
409 --merge_orthologues=[% merge_orthologues %][% IF merge_orthologues == 'on' %] --merge_min_ident=[% merge_min_ident %] --merge_min_len=[% merge_min_len %][%- END %] \
410 --aligner_mode=[% aligner_mode %][% UNLESS aligner_mode == 'off' %] --ali_skip_self=[% ali_skip_self %] --ali_cover_mul=[% ali_cover_mul %][% END %] --ali_keep_old_new_tags=[% ali_keep_old_new_tags %] --ali_keep_lengthened_seqs=[% ali_keep_lengthened_seqs %] \
411 --tax_reports=[% tax_reports %][% IF tax_dir %] --tax_dir [% tax_dir %][% END %] \
412 [% IF megan_like %]--megan_like \[% ELSIF best_hit %]--best_hit \[% ELSE %]--tax_min_score=[% tax_min_score %] --tax_score_mul=[% tax_score_mul %] --tax_min_ident=[% tax_min_ident %] --tax_min_len=[% tax_min_len %] \[% END %]
413 --tol_check=[% tol_check %][% IF tol_check == 'on' %] --tol_db [% tol_db %][% END %][% IF levels %] \
414 --levels=[% levels.join(' ') %][%- END %]
415 EOT
416  
417 # HOW TO
418 my $howto = << "EOT";
419  
420 \e[1;35m============================== Prompting: How To? ==============================
421  
422 You may use the following control keys for manual input and menu input:\e[0m
423 ENTER yes/default value
424 CTRL-C quit
425  
426 \e[1;35mYou may use the following control keys for path input:\e[0m
427 TAB complete the word
428 CTRL-D show list of matching choices (same as TAB-TAB)
429 CTRL-U delete the entire input
430 CTRL-H delete a character (backspace)
431 CTRL-P cycle through choices (backward) (also up arrow)
432 CTRL-N cycle through choices (forward) (also down arrow)
433  
434 \e[1;35m================================================================================
435 EOT
436  
437 die "Error: No arguments provided!
438 Use the '--wizard' for a guided configuration or define at least the following variables: '--bank_dir' '--bank_suffix' '--queries'"
439 unless
440 List::AllUtils::all { defined $ARGV{$_} } qw(--bank_dir --bank_suffix --queries)
441 or defined $ARGV{'--wizard'};
442  
443 my $tf_auto;
444 if ( $ARGV{'--wizard'} ) {
445 # HOW TO
446 say $howto;
447  
448 # CONTEXT
449 $ARGV{'--run_mode'} = prompt "\nWhich mode would you like to run Forty-Two: ",
450 -menu => { 'phylogenomic' => 'phylogenomic', 'metagenomic' => 'metagenomic' },
451 '>';
452  
453 # OUT_SUFFIX
454 $ARGV{'--out_suffix'} = prompt "\nSuffix to append to infile basenames for deriving outfile names [default: -42]: ",
455 -def => $ARGV{'--out_suffix'};
456  
457 # QUERIES
458 $ARGV{'--queries'} = prompt4file("\nEnter path to query organisms list file: ");
459  
460 # ALI TYPE
461 $ARGV{'--SSUrRNA'} = prompt "\nWould you like to enrich SSU rRNA alignments?", -menu => { Yes => 1, no => 0 }, -def => 0;
462 $ARGV{'--ref_brh'} = 'off' if $ARGV{'--SSUrRNA'};
463  
464 # BLASTS
465 $ARGV{'--evalue'} = prompt "\nSet e-value for all blasts performed by 42 [default: 1e-05]: ",
466 -def => $ARGV{'--evalue'};
467  
468  
469 unless ( $ARGV{'--SSUrRNA'} ) {
470  
471 # REF BANKS
472 $ARGV{'--ref_brh'} = prompt "\nWould you like to use a ref_brh: ",
473 -menu => { 'on [default]' => $ARGV{'--ref_brh'}, off => 'off'},
474 -def => $ARGV{'--ref_brh'},
475 '>';
476  
477 unless ( $ARGV{'--ref_brh'} eq 'off' ) {
478 $ARGV{'--ref_bank_dir'} = prompt4dir("\nEnter path to reference organisms banks directory: ");
479 $ARGV{'--ref_bank_suffix'} = prompt4suffix("\nSet reference banks suffix: ", $ARGV{'--ref_bank_dir'});
480 $ARGV{'--ref_bank_mapper'} = prompt4file("\nEnter path to reference bank mapper file: ");
481  
482 $ARGV{'--ref_org_mul'} = prompt "\nSet ref org mul [default: 1.0]: ",
483 -must => { 'be a number between 0 and 1' => qr{^[0-1](?:\.\d+)?}xms },
484 -def => $ARGV{'--ref_org_mul'};
485  
486 $ARGV{'--ref_score_mul'} = prompt "\nSet ref score mul [default: 0.99]: ",
487 -must => { 'be a number between 0 and 1' => qr{^[0-1](?:\.\d+)?}xms },
488 -def => $ARGV{'--ref_score_mul'};
489 }
490  
491 my $tax_filter;
492  
493 # TreeOfLIfe CHECK
494 $ARGV{'--tol_check'} = prompt "\nDo you need to perform the Tree Of Life check before adding an ortholog?",
495 -menu => { 'yes' => 'on', 'no [default]' => 'off'},
496 -def => $ARGV{'--tol_check'},
497 '>';
498 if ($ARGV{'--tol_check'} eq 'on') {
499 $tax_filter = 1;
500 $ARGV{'--tol_db'} = prompt4dir("\nEnter path to TreeOfLife database: ");
501  
502 $tf_auto = prompt "\nSet tax filter input: ",
503 -menu => { 'from org mapper file' => 0,
504 "from NCBI's taxonomy - auto + prompt for missing" => 1,
505 "from NCBI's taxonomy - auto + prompt for all" => 2,
506 };
507 if ( $tf_auto == 1 ) {
508 @{ $ARGV{'--levels'} } = split ",", ( prompt "\nLevels separated by a coma (no whitespace): ");
509 }
510 }
511  
512 # TRIMMING HOMOLOGUES
513 $ARGV{'--trim_homologues'} = prompt "\nChoose trim_homologues mode: ",
514 -menu => { 'on [default]' => $ARGV{'--trim_homologues'}, off => 'off' }, '>',
515 -def => $ARGV{'--trim_homologues'};
516  
517 unless ( $ARGV{'--trim_homologues'} eq 'off' ) {
518 $ARGV{'--trim_max_shift' } = prompt "\nSet trim_max_shift: ", -def => $ARGV{'--trim_max_shift'};
519 $ARGV{'--trim_extra_margin'} = prompt "\nSet trim_extra_margin: ", -def => $ARGV{'--trim_extra_margin'};
520 }
521  
522 # MERGING ORTHOLOGUES
523 $ARGV{'--merge_orthologues'} = prompt "\nChoose merge_orthologues mode: ",
524 -menu => { on => 'on', 'off [default]' => $ARGV{'--merge_orthologues'} }, '>',
525 -def => $ARGV{'--merge_orthologues'};
526  
527 unless ( $ARGV{'--merge_orthologues'} eq 'off' ) {
528 $ARGV{'--merge_min_ident' } = prompt "\nSet merge_min_ident: ", -def => $ARGV{'--merge_min_ident'};
529 $ARGV{'--merge_min_len' } = prompt "\nSet merge_min_len: ", -def => $ARGV{'--merge_min_len'};
530 }
531  
532 # ali_keep_lengthened_seqs
533 $ARGV{'--ali_keep_lengthened_seqs'} = prompt "\nAction to perform when a preexisting lengthened seq is identified: ",
534 -menu => { 'keep [default]' => 'keep', remove => 'remove' },
535 -def => $ARGV{'--ali_keep_lengthened_seqs'}, '>';
536  
537 if ($ARGV{'--run_mode'} eq 'phylogenomic') {
538  
539 # ALIGNER
540 $ARGV{'--tax_reports'} = 'on';
541  
542 $ARGV{'--aligner_mode'} = prompt "\nSet aligner_mode: ",
543 -menu => { 'blast [default]' => $ARGV{'--aligner_mode'},
544 exonerate => 'exonerate',
545 exoblast => 'exoblast',
546 off => 'off'
547 },
548 -def => $ARGV{'--aligner_mode'},
549 '>';
550  
551  
552 # ali_skip_self
553 $ARGV{'--ali_skip_self'} = prompt "\nSet patch mode: ",
554 -menu => { 'off [default]' => $ARGV{'--ali_skip_self'}, on => 'on' },
555 -def => $ARGV{'--ali_skip_self'}, '>';
556  
557 # TAXONOMIC FILTER
558 unless ($tax_filter) {
559 $tax_filter = prompt "\nIs a taxonomic filter needed?", -menu => { Yes => 1, no => 0 };
560  
561 if ($tax_filter) {
562 $tf_auto = prompt "\nSet tax filter input: ",
563 -menu => { 'from org mapper file' => 0,
564 "from NCBI's taxonomy - auto + prompt for missing" => 1,
565 "from NCBI's taxonomy - auto + prompt for all" => 2,
566 };
567  
568 if ( $tf_auto == 1 ) {
569 @{ $ARGV{'--levels'} } = split ",", ( prompt "\nLevels separated by a coma (no whitespace): ");
570 }
571 }
572  
573 # TAXNOMIC AFFILIATION
574 $tax_filter = prompt "\nIs taxonomic classification needed?", -menu => { Yes => 1, no => 0 };
575 }
576 }
577  
578 else {
579 $ARGV{'--tax_reports'} = 'on';
580 $ARGV{'--aligner_mode'} = 'off';
581 $ARGV{'--merge_orthologues'} = 'off';
582 }
583  
584 if ($ARGV{'--run_mode'} eq 'metagenomic' || $tax_filter) {
585  
586 # TAX DIR
587 $ARGV{'--tax_dir'} = prompt4dir("\nEnter path to taxdump directory: ");
588  
589 my $tax_aff = prompt "\nChoose taxonomic affiliation mode: ",
590 -menu => { 'megan-like' => '--megan_like', 'best-hit' => '--best_hit' },
591 -def => 1;
592 $ARGV{"$tax_aff"} = 1;
593  
594 # BEST_HIT
595 if ( $ARGV{'--best_hit'} ) {
596 say "The '--best_hit' flag autosets the following parameter:\n'--tax_max_hits' = 1";
597 $ARGV{'--tax_max_hits'} = 1;
598  
599 my $hit_filtering = prompt "\nSet hit-filtering mode: ",
600 -menu => { 'default values' => 0, 'length/identity' => 'length_identity', 'Bit score' => 'bitscore' };
601  
602 if ($hit_filtering eq 'bitscore') {
603 $ARGV{'--tax_min_score'} = prompt "\nSet minimum bit score to consider a hit: ",
604 -must => { 'be an integer' => qr{^[0-9]+\z} },
605 -def => $ARGV{'--tax_min_score'};
606 }
607 if ($hit_filtering eq 'length_identity') {
608 $ARGV{'--tax_min_ident'} = prompt "\nSet minimum percentage of identity to consider a hit: ",
609 -must => { 'be a number between 0 and 1' => qr{^[0-1](?:\.\d+)?}xms },
610 -def => $ARGV{'--tax_min_ident'};
611  
612 $ARGV{'--tax_min_len'} = prompt "\nSet minimum length to consider a hit: ",
613 -must => { 'be an integer' => qr{^[1-9]+} },
614 -def => $ARGV{'--tax_min_len'};
615 }
616 }
617  
618 # MEGAN_LIKE
619 if ($ARGV{'--megan_like'}) {
620 say "\nThe '--megan_like' flag autosets the following parameters:\n'--tax_min_score' = 80,\n'--tax_score_mul' = 0.95,\n'--tax_min_ident' = 0,\n'--tax_min_len' = 0.";
621 say "\nFeel free to modify the default settings according to your own flavors.";
622  
623 $ARGV{'--tax_min_ident'} = 0;
624 $ARGV{'--tax_min_len'} = 0;
625 $ARGV{'--tax_min_score'} = 80;
626 $ARGV{'--tax_score_mul'} = 0.95;
627 }
628 }
629 }
630  
631 # BANKS
632 $ARGV{'--bank_dir'} = prompt4dir("\nEnter path to your candidate genomes directory: ");
633 $ARGV{'--bank_suffix'} = prompt4suffix("\nSet candiate banks suffix: ", $ARGV{'--bank_dir'});
634 $ARGV{'--bank_mapper'} = prompt4file("\nEnter path to bank mapper file: ");
635  
636 # CODE
637 $ARGV{'--code'} = prompt "\nGenetic code for translated BLAST searches [default: 1]: ",
638 -must => { 'be an integer' => qr{^[1-9]+} },
639 -def => $ARGV{'--code'};
640  
641 }
642  
643 ### %ARGV
644  
645 # tol arguments
646 if ( $ARGV{'--tol_db'} ) {
647 my $file = Path::Class::File->new($ARGV{'--tol_db'});
648 $ARGV{'--tol_bank'} = $file->basename;
649 $ARGV{'--tol_bank_dir'} = $file->dir->absolute->stringify;
650 }
651  
652 # convert arguments to values for placeholders
653 my %vars = map { tr/-<>//dr => $ARGV{$_} } keys %ARGV;
654  
655 # bank files
656 my @bank_files = File::Find::Rule
657 ->file()
658 ->relative()
659 ->maxdepth(1)
660 ->name( qr{ $ARGV{'--bank_suffix'} $}xmsi )
661 ->in($ARGV{'--bank_dir'})
662 ;
663 # org mapper: from file names or file
664 $ARGV{'--choose_tax_filter'} = 1 if $ARGV{'--levels'};
665 $tf_auto = $ARGV{'--choose_tax_filter'};
666 my $tax = Taxonomy->new_from_cache( tax_dir => $ARGV{'--tax_dir'} ) if $tf_auto > 0;
667 ### lvl: $ARGV{'--levels'}
668  
669 my ($org_for, $tax_filter_for) = build_org_n_tax_filter_for();
670 ### $org_for
671 ### $tax_filter_for
672  
673 # ref_bank files
674 my $ref_org_for;
675 my @ref_bank_files;
676 unless ( $ARGV{'--ref_brh'} eq 'off' ) {
677 @ref_bank_files = File::Find::Rule
678 ->file()
679 ->relative()
680 ->maxdepth(1)
681 ->name( qr{ $ARGV{'--ref_bank_suffix'} $}xmsi )
682 ->in($ARGV{'--ref_bank_dir'})
683 ;
684 # ref org mapper: from file names or file
685 $ref_org_for = build_ref_org_for();
686 }
687  
688 # queries
689 my @query_orgs;
690 open my $in, '<', $ARGV{'--queries'};
691 while (my $line = <$in>) {
692 chomp $line;
693 push @query_orgs, $line;
694 }
695 close $in;
696  
697 # complete %vars
698 $vars{org_for} = $org_for;
699 $vars{query_orgs} = \@query_orgs;
700 $vars{ref_org_for} = $ref_org_for if $ref_org_for;
701 $vars{tax_filter_for} = $tax_filter_for if $tax_filter_for;
702 ### %vars
703  
704 # build config filename
705 my $out_suffix = $ARGV{'--out_suffix'} =~ m/^\-/xms ? $ARGV{'--out_suffix'} : '-' . $ARGV{'--out_suffix'};
706 my $outyaml = 'config' . $out_suffix . '.yaml';
707 my $outcmd = 'build' . $out_suffix . '-yaml.sh';
708  
709 # fill-in template
710 my $tt = Template->new;
711 $tt->process(\$tt_str, \%vars, $outyaml) or die "Unable to write $outyaml";
712 $tt->process(\$tt_cmd, \%vars, $outcmd ) or die "Unable to write $outcmd";
713 # Set read only
714 #my $mode = "0444";
715 #chmod $mode, $outyaml;
716 #chmod $mode, $outcmd;
717  
718 say "\nSuccessfully wrote files: $outyaml and $outcmd!";
719  
720 # SUBROUTINES
721  
722 sub prompt4dir {
723 return _prompt4path(\&dir, @_);
724 }
725  
726  
727 sub prompt4file {
728 return _prompt4path(\&file, @_);
729 }
730  
731 sub _prompt4path {
732 my $sub = shift;
733 my $string = shift;
734 $string = "\e[1;34m$string\e[0m";
735 my $path;
736 my $areyousure = 0;
737 my $tc = Term::Completion::Path->new(
738 prompt => $string,
739 );
740 while ( $areyousure == 0 ) {
741 $path = '' unless $areyousure;
742 until (-e $path) {
743 $path = $tc->complete();
744 say "No such file or directory '$path'. Try again..." unless -e $path;
745 }
746 $path = $sub->($path)->absolute->resolve->stringify unless $ARGV{'--relative'};
747 $areyousure = prompt "\nIs that correct: $path ? ", -menu => { Yes => 1, no => 0 }, -def => 1, -style => 'blue';
748 }
749 return $path;
750 }
751  
752  
753 sub prompt4suffix {
754 my $string = shift;
755 my $dir = shift;
756 my $areyousure = 0;
757 my $suffix;
758  
759 while ( $areyousure == 0 ) {
760 $suffix = prompt $string;
761 say "\n\e[0;33mFiles in directory: ";
762 system("ls $dir/*$suffix | xargs -n1 basename");
763 $areyousure = prompt "\nIs that correct: $suffix ? ",
764 -menu => { Yes => 1, no => 0 },
765 -def => 1, -style => 'blue';
766 }
767 return $suffix;
768 }
769  
770 sub build_ref_org_for {
771 my %ref_org_for;
772 if ($ARGV{'--ref_bank_mapper'}) {
773 open my $in, '<', $ARGV{'--ref_bank_mapper'};
774 while (my $line = <$in>) {
775 chomp $line;
776 next LINE if $line =~ $COMMENT_LINE
777 || $line =~ $EMPTY_LINE;
778 $line =~ s/\s+$//xmsg;
779 my ($ref_org, $ref_bank) = split /\t/xms, $line;
780 ### $ref_bank
781 ### $ref_org
782 $ref_bank = basename($ref_bank, $ARGV{'--ref_bank_suffix'});
783 $ref_org_for{$ref_bank} = $ref_org;
784 }
785 close $in;
786 }
787 else {
788 my @ref_banks = map { basename($_, $ARGV{'--ref_bank_suffix'}) } @ref_bank_files;
789 my @ref_orgs = map { join " ", (split /_/xms, $_, 2) } @ref_banks;
790 @ref_org_for{@ref_banks} = @ref_orgs;
791 }
792 return \%ref_org_for;
793 }
794  
795 sub build_org_n_tax_filter_for {
796 my %org_for;
797 my %tax_filter_for;
798 if ($ARGV{'--bank_mapper'}) {
799 open my $in, '<', $ARGV{'--bank_mapper'};
800 while (my $line = <$in>) {
801 chomp $line;
802 my ($bank, $org, $tax_filters, $lineage);
803 if ($tf_auto > 0) {
804 ($org, $bank, undef, undef) = split /\t/xms, $line;
805 ($tax_filters, $lineage) = _get_tax_filter($org);
806 }
807 else {
808 ($org, $bank, $tax_filters, $lineage) = split /\t/xms, $line;
809 }
810  
811 $bank = basename($bank, $ARGV{'--bank_suffix'});
812 $org_for{$bank} = $org;
813 $tax_filter_for{$bank} = "tax_filter: [ $tax_filters ] # " . $lineage if defined $tax_filters;
814 }
815 close $in;
816 }
817 else {
818 my @banks = map { basename($_, $ARGV{'--bank_suffix'}) } @bank_files;
819 ### @banks
820 my @orgs = map { join q{ }, (split /_/xms, $_, 2) } @banks;
821 @org_for{@banks} = @orgs;
822 }
823 return \%org_for, \%tax_filter_for;
824 }
825  
826 sub _get_tax_filter {
827 my $org = shift;
828  
829 my $entity;
830 my $method;
831 my $lineage;
832 if ($org =~ m/^GCA|GCF/xms || $org =~ m/^\d+$/xms) {
833 $entity = $org;
834 $method = 'get_taxonomy_with_levels';
835 ### TID/GCA: $entity
836 }
837 else {
838 $entity = SeqId->new( full_id => $org . '@1');
839 $method = 'get_taxonomy_with_levels_from_seq_id';
840 ### ORG: $entity
841 }
842 my @tax = $tax->$method($entity);
843 $lineage = join q{; }, map { @{ $tax[$_] }[0] } 0..$#tax;
844 ### $lineage
845  
846 # Type a name untill it works!
847 my $loop;
848 while (! @tax) {
849 $loop++;
850 say "Warning: Unable to retrieve taxonomy for $org.\n"; #TODO
851 say "Try with '$org" . "_sp'" if $loop > 1;
852  
853 $org = prompt "Please enter a valid species name or taxonomic rank followed by '_sp'...\n", '>';
854 my $seq_id = SeqId->new( full_id => $org.'@1');
855 @tax = $tax->$method($seq_id);
856 $lineage = join q{; }, map { @{ $tax[$_] }[0] } 0..$#tax;
857 }
858  
859 tie my %tax_for, 'Tie::IxHash';
860 for my $tax_n_level (@tax) {
861 $tax_for{$$tax_n_level[1]} = $$tax_n_level[0];
862 }
863  
864 my $tax_filter;
865 if ($tf_auto == 1) {
866 LEVEL:
867 for my $level (@{ $ARGV{'--levels'} }) {
868 $tax_filter = $tax_for{$level};
869 last LEVEL if defined $tax_filter;
870 }
871 return '+' . $tax_filter, $lineage if defined $tax_filter;
872 }
873  
874 unless (defined $tax_filter) {
875 say "\nWarning: no taxon defined for level(s): @{ $ARGV{'--levels'} }";
876 }
877  
878 $tax_filter = '+' . _tax_prompter(\@tax, $org);
879  
880 return $tax_filter, $lineage;
881 }
882  
883 sub _tax_prompter {
884 my ($tax_ref, $org) = @_;
885 my @tax = map { @$_[0] } @$tax_ref;
886 my $tax_filter = prompt "\nChoose tax_filter for '$org':",
887 -menu => \@tax,
888 '>';
889 return $tax_filter;
890 }
891  
892 __END__
893  
894 =pod
895  
896 =head1 NAME
897  
898 yaml-generator-42.pl - Interactive or batch generator for 42 YAML config files
899  
900 =head1 VERSION
901  
902 version 0.210570
903  
904 =head1 USAGE
905  
906 # wizard: configuration assistant
907 ./yaml-generator-42.pl --wizard
908  
909 # basic: derive organisms name directly from filenames
910 ./yaml-generator-42.pl --bank_dir ./banks/ --ref_bank_dir ./ref_banks/ \
911 --tax_dir ~/taxdump/ --bank_suffix=.nsq --ref_bank_suffix=.psq \
912 --queries queries.idl [optional arguments]
913  
914 # use IDM files for banks, orgs and eventually tax_filters
915 ./yaml-generator-42.pl --bank_dir ./banks/ --ref_bank_dir ./ref_banks/ --tax_dir \
916 ~/taxdump/ --bank_suffix=.nsq --ref_bank_suffix=.psq --queries queries.idl \
917 --bank_mapper banks/bank_mapper.idm \
918 --ref_bank_mapper ref_banks/ref_bank_mapper.idm
919  
920 # dynamic choice of tax_filter using NCBI Taxonomy
921 ./yaml-generator-42.pl --bank_dir ./banks/ --ref_bank_dir ./ref_banks/ --tax_dir \
922 ~/taxdump/ --bank_suffix=.nsq --ref_bank_suffix=.psq --queries queries.idl \
923 --bank_mapper banks/bank_mapper.idm \
924 --ref_bank_mapper ref_banks/ref_bank_mapper.idm \
925 --levels=family
926  
927 # interactive choice of tax_filter using NCBI Taxonomy
928 ./yaml-generator-42.pl --bank_dir ./banks/ --ref_bank_dir ./ref_banks/ --tax_dir \
929 ~/taxdump/ --bank_suffix=.nsq --ref_bank_suffix=.psq --queries queries.idl \
930 --bank_mapper banks/bank_mapper.idm \
931 --ref_bank_mapper ref_banks/ref_bank_mapper.idm \
932 --levels=family --choose_tax_filter
933  
934 =head1 REQUIRED ARGUMENTS
935  
936 =over
937  
938 =back
939  
940 =head1 OPTIONAL ARGUMENTS
941  
942 =over
943  
944 =item --wizard
945  
946 Activate if you want an interactive step by step configuration.
947  
948 =item --run_mode=<str>
949  
950 'phylogenomic' or 'metagenomic'
951  
952 =for Euclid: str.type: str
953  
954 =item --out_suffix=<str>
955  
956 =for Euclid: str.type: str
957 str.default: '-42'
958  
959 =item --queries <file>
960  
961 =for Euclid: file.type: readable
962  
963 =item --evalue=<n>
964  
965 =for Euclid: n.type: number
966 n.default: 1e-5
967  
968 =item --SSUrRNA
969  
970 =item --homologues_seg=<str>
971  
972 =for Euclid: str.type: str
973 str.default: 'yes'
974  
975 =item --max_target_seqs=<str>
976  
977 =for Euclid: str.type: str
978 str.default: 10000
979  
980 =item --templates_seg=<str>
981  
982 =for Euclid: str.type: str
983 str.default: 'no'
984  
985 =item --ref_brh=<str>
986  
987 on or off.
988  
989 =for Euclid: str.type: str
990 str.default: 'on'
991  
992 =item --ref_bank_dir <dir>
993  
994 Path to reference bank files directory.
995  
996 =for Euclid: dir.type: readable
997  
998 =item --ref_bank_suffix=<str>
999  
1000 =for Euclid: str.type: str
1001  
1002 =item --ref_bank_mapper <file>
1003  
1004 Tab delimited file with bank and org in this order.
1005  
1006 =for Euclid: file.type: readable
1007  
1008 =item --ref_org_mul=<n>
1009  
1010 =for Euclid: n.type: number, n > 0 && n <= 1
1011 n.default: 1.0
1012  
1013 =item --ref_score_mul=<n>
1014  
1015 =for Euclid: n.type: number, n >= 0 && n <= 1
1016 n.default: 0.99
1017  
1018 =item --tol_check=<str>
1019  
1020 =for Euclid: str.type: str
1021 str.default: 'off'
1022  
1023 =item --tol_db <db>
1024  
1025 Path to TreeOfLife database.
1026  
1027 =for Euclid: db.type: string
1028  
1029 =item --trim_homologues=<str>
1030  
1031 =for Euclid: str.type: str
1032 str.default: 'on'
1033  
1034 =item --trim_max_shift=<n>
1035  
1036 =for Euclid: n.type: 0+number
1037 n.default: 20000
1038  
1039 =item --trim_extra_margin=<n>
1040  
1041 =for Euclid: n.type: 0+number
1042 n.default: 15
1043  
1044 =item --merge_orthologues=<str>
1045  
1046 =for Euclid: str.type: str
1047 str.default: 'off'
1048  
1049 =item --merge_min_ident=<n>
1050  
1051 =for Euclid: n.type: number, n >= 0 && n <= 1
1052 n.default: 0.9
1053  
1054 =item --merge_min_len=<n>
1055  
1056 =for Euclid: n.type: 0+number
1057 n.default: 40
1058  
1059 =item --aligner_mode=<str>
1060  
1061 off, blast, exonerate, exoblast.
1062  
1063 =for Euclid: str.type: str
1064 str.default: 'blast'
1065  
1066 =item --ali_skip_self=<str>
1067  
1068 on or off
1069  
1070 =for Euclid: str.type: str
1071 str.default: 'off'
1072  
1073 =item --ali_cover_mul=<n>
1074  
1075 =for Euclid: n.type: number, n > 0 && n <= 2
1076 n.default: 1.1
1077  
1078 =item --ali_keep_old_new_tags=<str>
1079  
1080 'on' or 'off'
1081  
1082 =for Euclid: str.type: str
1083 str.default: 'off'
1084  
1085 =item --bank_dir <dir>
1086  
1087 Path to bank files directory.
1088  
1089 =for Euclid: dir.type: readable
1090  
1091 =item --bank_suffix=<str>
1092  
1093 =for Euclid: str.type: str
1094  
1095 =item --bank_mapper <file>
1096  
1097 Tab delimited file with bank, org and optionnaly tax_filter in this order.
1098  
1099 =for Euclid: file.type: readable
1100  
1101 =item --tax_dir <dir>
1102  
1103 Path to taxdump directory.
1104  
1105 =for Euclid: dir.type: readable
1106  
1107 =item --levels=<level>...
1108  
1109 Taxonomic filter level(s). Several levels are allowed as input; in this case,
1110 the first defined level will be returned.
1111  
1112 Available levels are: 'superkingdom'
1113 'kingdom'
1114 'phylum'
1115 'subphylum'
1116 'class'
1117 'superorder'
1118 'order'
1119 'suborder'
1120 'infraorder'
1121 'parvorder'
1122 'superfamily'
1123 'family'
1124 'subfamily'
1125 'genus'
1126 'species'
1127  
1128 =for Euclid: level.type: string
1129  
1130 =item --choose_tax_filter=<n>
1131  
1132 Interactively choose taxonomic filter.
1133 0 => 'from org mapper file'
1134 1 => "from NCBI's taxonomy - auto + prompt for missing"
1135 2 => "from NCBI's taxonomy - auto + prompt for all"
1136  
1137 =for Euclid: n.type: 0+integer
1138 n.default: 0
1139  
1140 =item --tax_reports=<str>
1141  
1142 'on' or 'off'
1143  
1144 =for Euclid: str.type: str
1145 str.default: 'on'
1146  
1147 =item --best_hit
1148  
1149 Overides 'tax_' parameters and auto-sets 'tax_score_mul' to compute LCA in a
1150 MEGAN-like mode i.e. based on bitscore.
1151  
1152 =item --megan_like
1153  
1154 Overides 'tax_' parameters and auto-sets 'tax_score_mul' to compute LCA in a
1155 MEGAN-like mode i.e. based on bitscore.
1156  
1157 =item --tax_max_hits=<n>
1158  
1159 =for Euclid: n.type: 0+integer
1160  
1161 =item --tax_min_hits=<n>
1162  
1163 =for Euclid: n.type: 0+integer
1164  
1165 =item --tax_min_ident=<n>
1166  
1167 =for Euclid: n.type: number, n >= 0 && n <= 1
1168 n.default: 0
1169  
1170 =item --tax_min_len=<n>
1171  
1172 =for Euclid: n.type: 0+integer
1173 n.default: 0
1174  
1175 =item --tax_min_score=<n>
1176  
1177 =for Euclid: n.type: 0+integer
1178 n.default: 0
1179  
1180 =item --tax_score_mul=<n>
1181  
1182 =for Euclid: n.type: number, n >= 0 && n <= 1
1183 n.default: 0
1184  
1185 =item --ali_keep_lengthened_seqs=<str>
1186  
1187 keep or remove
1188  
1189 =for Euclid: str.type: str
1190 str.default: 'keep'
1191  
1192 =item --code=<n>
1193  
1194 =for Euclid: n.type: +integer
1195 n.default: 1
1196  
1197 =item --version
1198  
1199 =item --usage
1200  
1201 =item --help
1202  
1203 =item --man
1204  
1205 Print the usual program information
1206  
1207 =back
1208  
1209 =head1 AUTHOR
1210  
1211 Denis BAURAIN <denis.baurain@uliege.be>
1212  
1213 =head1 CONTRIBUTOR
1214  
1215 =for stopwords Mick VAN VLIERBERGHE
1216  
1217 Mick VAN VLIERBERGHE <mvanvlierberghe@doct.uliege.be>
1218  
1219 =head1 COPYRIGHT AND LICENSE
1220  
1221 This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
1222  
1223 This is free software; you can redistribute it and/or modify it under
1224 the same terms as the Perl 5 programming language system itself.
1225  
1226 =cut