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