File Coverage

blib/lib/Bio/Tools/Run/BWA/Config.pm
Criterion Covered Total %
statement 28 32 87.5
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 35 39 89.7


line stmt bran cond sub pod time code
1             # $Id$
2             #
3             # BioPerl module for Bio::Tools::Run::BWA::Config
4             #
5             # Please direct questions and support issues to
6             #
7             # Cared for by Mark A. Jensen
8             #
9             # Copyright Mark A. Jensen
10             #
11             # You may distribute this module under the same terms as perl itself
12              
13             # POD documentation - main docs before the code
14              
15             =head1 NAME
16              
17             Bio::Tools::Run::BWA::Config - Configuration data for BWA commands
18              
19             =head1 SYNOPSIS
20              
21             Used internally by L.
22              
23             =head1 DESCRIPTION
24              
25             This package exports information describing BWA commands, parameters,
26             switches, and input and output filetypes for individual BWA commands.
27             See L.
28              
29             =head1 FEEDBACK
30              
31             =head2 Mailing Lists
32              
33             User feedback is an integral part of the evolution of this and other
34             Bioperl modules. Send your comments and suggestions preferably to
35             the Bioperl mailing list. Your participation is much appreciated.
36              
37             bioperl-l@bioperl.org - General discussion
38             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
39              
40             =head2 Support
41              
42             Please direct usage questions or support issues to the mailing list:
43              
44             L
45              
46             rather than to the module maintainer directly. Many experienced and
47             reponsive experts will be able look at the problem and quickly
48             address it. Please include a thorough description of the problem
49             with code and data examples if at all possible.
50              
51             =head2 Reporting Bugs
52              
53             Report bugs to the Bioperl bug tracking system to help us keep track
54             of the bugs and their resolution. Bug reports can be submitted via
55             the web:
56              
57             http://redmine.open-bio.org/projects/bioperl/
58              
59             =head1 AUTHOR - Mark A. Jensen
60              
61             Email maj@fortinbras.us
62              
63             Describe contact details here
64              
65             =head1 CONTRIBUTORS
66              
67             Additional contributors names and emails here
68              
69             =head1 APPENDIX
70              
71             The rest of the documentation details each of the object methods.
72             Internal methods are usually preceded with a _
73              
74             =cut
75              
76             # Let the code begin...
77              
78             package Bio::Tools::Run::BWA::Config;
79 1     1   4 use strict;
  1         1  
  1         23  
80 1     1   3 use warnings;
  1         2  
  1         21  
81 1     1   3 no warnings qw(qw);
  1         1  
  1         21  
82 1     1   3 use Bio::Root::Root;
  1         1  
  1         4  
83 1     1   14 use Exporter;
  1         1  
  1         26  
84 1     1   3 use base qw(Bio::Root::Root );
  1         1  
  1         420  
85              
86             our (@ISA, @EXPORT, @EXPORT_OK);
87             push @ISA, 'Exporter';
88             @EXPORT = qw(
89             @program_commands
90             %command_prefixes
91             %composite_commands
92             @program_params
93             @program_switches
94             %param_translation
95             %command_files
96             );
97              
98             @EXPORT_OK = qw();
99              
100             our @program_commands = qw(
101             run
102             index
103             aln
104             samse
105             sampe
106             dbwtsw
107             );
108              
109             # composite commands: pseudo-commands that run a
110             # sequence of commands
111             # composite command prefix => list of prefixes of commands this
112             # composite command runs
113             #
114              
115             our %composite_commands = (
116             'run' => [qw( map asm c2q )]
117             );
118              
119             # prefixes only for commands that take params/switches...
120             our %command_prefixes = (
121             'aln' => 'aln',
122             'dbwtsw' => 'bwt',
123             'index' => 'idx',
124             'samse' => 'sms',
125             'sampe' => 'smp',
126             'run' => 'run'
127             );
128              
129             our @program_params = qw(
130             command
131             idx|output_prefix
132             idx|algorithm
133             aln|max_edit_dist
134             aln|max_gap_opens
135             aln|max_gap_extns
136             aln|deln_protect_3p
137             aln|deln_protect_ends
138             aln|subseq_seed
139             aln|max_edit_dist_seed
140             aln|n_threads
141             aln|mm_penalty
142             aln|gap_open_penalty
143             aln|gap_extn_penalty
144             aln|subopt_hit_threshold
145             aln|trim_parameter
146             sms|hit_limit
147             smp|max_insert_size
148             smp|max_read_occur
149             bwt|match_score
150             bwt|mm_penalty
151             bwt|gap_open_penalty
152             bwt|gap_extn_penalty
153             bwt|n_threads
154             bwt|band_width
155             bwt|rel_min_score_threshold
156             bwt|threshold_adj_coeff
157             bwt|z_best
158             bwt|max_sa_interval
159             bwt|min_seeds_to_skip
160              
161             );
162              
163             our @program_switches = qw(
164             idx|color_space_idx
165             aln|reverse_no_comp
166             aln|no_iter_search
167             );
168              
169             our %param_translation = (
170             'idx|output_prefix' => 'p',
171             'idx|algorithm' => 'a',
172             'aln|max_edit_dist' => 'n',
173             'aln|max_gap_opens' => 'o',
174             'aln|max_gap_extns' => 'e',
175             'aln|deln_protect_3p' => 'd',
176             'aln|deln_protect_ends' => 'i',
177             'aln|subseq_seed' => 'l',
178             'aln|max_edit_dist_seed' => 'k',
179             'aln|n_threads' => 't',
180             'aln|mm_penalty' => 'M',
181             'aln|gap_open_penalty' => 'O',
182             'aln|gap_extn_penalty' => 'E',
183             'aln|subopt_hit_threshold' => 'R',
184             'aln|trim_parameter' => 'q',
185             'sms|hit_limit' => 'n',
186             'smp|max_insert_size' => 'a',
187             'smp|max_read_occur' => 'o',
188             'bwt|match_score' => 'a',
189             'bwt|mm_penalty' => 'b',
190             'bwt|gap_open_penalty' => 'q',
191             'bwt|gap_extn_penalty' => 'r',
192             'bwt|n_threads' => 't',
193             'bwt|band_width' => 'w',
194             'bwt|rel_min_score_threshold' => 'T',
195             'bwt|threshold_adj_coeff' => 'c',
196             'bwt|z_best' => 'z',
197             'bwt|max_sa_interval' => 's',
198             'bwt|min_seeds_to_skip' => 'N'
199             );
200              
201             #
202             # the order in the arrayrefs is the order required
203             # on the command line
204             #
205             # the strings in the arrayrefs (less special chars)
206             # become the keys for named parameters to run_maq
207             #
208             # special chars:
209             #
210             # '#' implies optional
211             # '*' implies variable number of this type
212             # <|> implies stdin/stdout redirect
213             #
214              
215             our %command_files = (
216             'run' => [qw( faq fas faq )],
217             'index' => [qw( fas )],
218             'aln' => [qw( fas faq >sai )],
219             'samse' => [qw( fas sai faq >sam )],
220             'sampe' => [qw( fas sai1 sai2 faq1 faq2 >sam )],
221             'dbwtsw' => [qw( fas faq )]
222             );
223              
224             INIT {
225             # add subcommand params and switches for
226             # composite commands
227 1     1   70 my @sub_params;
228             my @sub_switches;
229 1         4 foreach my $cmd (keys %composite_commands) {
230 1         1 foreach my $subcmd ( @{$composite_commands{$cmd}} ) {
  1         3  
231 3         78 my @sub_program_params = grep /^$subcmd\|/, @program_params;
232 3         29 my @sub_program_switches = grep /^$subcmd\|/, @program_switches;
233 3         6 for (@sub_program_params) {
234 0         0 m/^$subcmd\|(.*)/;
235 0         0 push @sub_params, "$cmd\|${subcmd}_".$1;
236             }
237 3         7 for (@sub_program_switches) {
238 0         0 m/^$subcmd\|(.*)/;
239 0         0 push @sub_switches, "$cmd\|${subcmd}_".$1;
240             }
241             }
242             }
243 1         2 push @program_params, @sub_params;
244 1         36 push @program_switches, @sub_switches;
245             # translations for subcmd params/switches not necessary
246             }
247             1;