File Coverage

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


line stmt bran cond sub pod time code
1             # $Id$
2             #
3             # BioPerl module for Bio::Tools::Run::Maq::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::Maq::Config - Configuration data for maq commands
18              
19             =head1 SYNOPSIS
20              
21             Used internally by L.
22              
23             =head1 DESCRIPTION
24              
25             This package exports information describing maq commands, parameters,
26             switches, and input and output filetypes for individual maq commands.
27              
28             =head1 FEEDBACK
29              
30             =head2 Mailing Lists
31              
32             User feedback is an integral part of the evolution of this and other
33             Bioperl modules. Send your comments and suggestions preferably to
34             the Bioperl mailing list. Your participation is much appreciated.
35              
36             bioperl-l@bioperl.org - General discussion
37             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
38              
39             =head2 Support
40              
41             Please direct usage questions or support issues to the mailing list:
42              
43             L
44              
45             rather than to the module maintainer directly. Many experienced and
46             reponsive experts will be able look at the problem and quickly
47             address it. Please include a thorough description of the problem
48             with code and data examples if at all possible.
49              
50             =head2 Reporting Bugs
51              
52             Report bugs to the Bioperl bug tracking system to help us keep track
53             of the bugs and their resolution. Bug reports can be submitted via
54             the web:
55              
56             http://redmine.open-bio.org/projects/bioperl/
57              
58             =head1 AUTHOR - Mark A. Jensen
59              
60             Email maj@fortinbras.us
61              
62             Describe contact details here
63              
64             =head1 CONTRIBUTORS
65              
66             Additional contributors names and emails here
67              
68             =head1 APPENDIX
69              
70             The rest of the documentation details each of the object methods.
71             Internal methods are usually preceded with a _
72              
73             =cut
74              
75             # Let the code begin...
76              
77              
78             package Bio::Tools::Run::Maq::Config;
79 1     1   4 use strict;
  1         1  
  1         39  
80 1     1   4 use warnings;
  1         1  
  1         23  
81 1     1   3 no warnings qw(qw);
  1         1  
  1         27  
82 1     1   3 use Bio::Root::Root;
  1         1  
  1         13  
83 1     1   15 use Exporter;
  1         1  
  1         29  
84 1     1   3 use base qw(Bio::Root::Root );
  1         3  
  1         481  
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              
101              
102             our @program_commands = qw(
103             run
104             fasta2bfa
105             fastq2bfq
106             map
107             mapmerge
108             rmdup
109             assemble
110             indelpe
111             indelsoa
112             sol2sanger
113             bfq2fastq
114             mapass2maq
115             mapview
116             mapcheck
117             pileup
118             cns2fq
119             cns2snp
120             cns2view
121             cns2ref
122             cns2win
123             fasta2csfa
124             csmap2nt
125             submap
126             eland2maq
127             export2maq
128             );
129              
130             # composite commands: pseudo-commands that run a
131             # sequence of commands
132             # composite command prefix => list of prefixes of commands this
133             # composite command runs
134             #
135              
136             our %composite_commands = (
137             'run' => [qw( map asm c2q )]
138             );
139              
140             # prefixes only for commands that take params/switches...
141             our %command_prefixes = (
142             'fastq2bfq' => 'q2q',
143             'map' => 'map',
144             'assemble' => 'asm',
145             'mapview' => 'mv',
146             'mapcheck' => 'mck',
147             'pileup' => 'pup',
148             'cns2fq' => 'c2q',
149             'cns2win' => 'c2w',
150             'submap' => 'sub',
151             'eland2maq' => 'l2m',
152             'export2maq' => 'x2m',
153             'run' => 'run'
154             );
155              
156             our @program_params = qw(
157             command
158             q2q|n
159             map|adaptor_file
160             map|first_read_length
161             map|max_hits
162             map|max_mismatches
163             map|max_outer_distance
164             map|max_outer_distance_rf
165             map|mismatch_dump
166             map|mismatch_posn_dump
167             map|mismatch_thr
168             map|mutation_rate
169             map|second_read_length
170             map|unmapped_dump
171             asm|error_dep_coeff
172             asm|het_fraction
173             asm|max_mismatches
174             asm|max_quality_sum
175             asm|min_map_quality
176             asm|num_haplotypes
177             mck|max_mismatches
178             mck|min_map_quality
179             pup|max_mismatches
180             pup|max_quality_vals
181             pup|min_map_quality
182             pup|site_input_file
183             c2q|min_map_quality
184             c2q|min_read_depth
185             c2q|min_nbr_quality
186             c2q|max_read_depth
187             c2w|window_size
188             c2w|ref_seq
189             c2w|start_posn
190             c2w|end_posn
191             c2w|min_cons_quality
192             sub|max_mismatches
193             sub|max_quality_sum
194             sub|min_map_quality
195             l2q|def_qual
196             x2m|max_outer_distance
197             x2m|first_read_length
198             x2m|second_read_length
199             );
200              
201             our @program_switches = qw(
202             asm|single_end_quality
203             asm|discard_wrong_pairs
204             mv|omit_seq_qual
205             mv|show_mismatch_posns
206             mck|single_end_quality
207             pup|single_end_quality
208             pup|discard_wrong_pairs
209             pup|verbose
210             pup|show_base_posn
211             sub|discard_wrong_pairs
212             x2m|retain_filt_reads
213             );
214              
215             our %param_translation = (
216             'q2q|n' => 'n',
217             'map|max_mismatches' => 'n',
218             'map|max_outer_distance' => 'a',
219             'map|max_outer_distance_rf' => 'A',
220             'map|first_read_length' => '1',
221             'map|second_read_length' => '2',
222             'map|mutation_rate' => 'm',
223             'map|adaptor_file' => 'd',
224             'map|unmapped_dump' => 'u',
225             'map|mismatch_thr' => 'e',
226             'map|mismatch_dump' => 'H',
227             'map|max_hits' => 'C',
228             'map|mismatch_posn_dump' => 'N',
229             'asm|error_dep_coeff' => 't',
230             'asm|het_fraction' => 'r',
231             'asm|max_mismatches' => 'm',
232             'asm|max_quality_sum' => 'Q',
233             'asm|min_map_quality' => 'q',
234             'asm|num_haplotypes' => 'N',
235             'mck|max_mismatches' => 'm',
236             'mck|min_map_quality' => 'q',
237             'pup|max_mismatches' => 'm',
238             'pup|max_quality_vals' => 'Q',
239             'pup|min_map_quality' => 'q',
240             'pup|site_input_file' => 'l',
241             'c2q|min_map_quality' => 'Q',
242             'c2q|min_read_depth' => 'd',
243             'c2q|min_nbr_quality' => 'n',
244             'c2q|max_read_depth' => 'D',
245             'c2w|window_size' => 'w',
246             'c2w|ref_seq' => 'c',
247             'c2w|start_posn' => 'b',
248             'c2w|end_posn' => 'e',
249             'c2w|min_cons_quality' => 'q',
250             'sub|max_mismatches' => 'm',
251             'sub|max_quality_sum' => 'Q',
252             'sub|min_map_quality' => 'q',
253             'l2q|def_qual' => 'q',
254             'x2m|max_outer_distance' => 'a',
255             'x2m|first_read_length' => '1',
256             'x2m|second_read_length' => '2',
257             'asm|single_end_quality' => 's',
258             'asm|discard_wrong_pairs' => 'p',
259             'mv|omit_seq_qual' => 'b',
260             'mv|show_mismatch_posns' => 'N',
261             'mck|single_end_quality' => 's',
262             'pup|single_end_quality' => 's',
263             'pup|discard_wrong_pairs' => 'p',
264             'pup|verbose' => 'v',
265             'pup|show_base_posn' => 'P',
266             'sub|discard_wrong_pairs' => 'p',
267             'x2m|retain_filt_reads' => 'n'
268             );
269              
270             #
271             # the order in the arrayrefs is the order required
272             # on the command line
273             #
274             # the strings in the arrayrefs (less special chars)
275             # become the keys for named parameters to run_maq
276             #
277             # special chars:
278             #
279             # '#' implies optional
280             # '*' implies variable number of this type
281             # <|> implies stdin/stdout redirect
282             #
283              
284             our %command_files = (
285             'run' => [qw( faq fas faq )],
286             'fastq2bfq' => [qw( faq bfq )],
287             'fasta2bfa' => [qw( fas bfa )],
288             'map' => [qw( map bfa bfq1 #bfq2 2>#log )],
289             'mapmerge' => [qw( out_map *in_map )],
290             'rmdup' => [qw( out_map in_map )],
291             'assemble' => [qw( cns bfa map 2>#log )],
292             'indelpe' => [qw( bfa map >txt )],
293             'indelsoa' => [qw( bfa map >txt )],
294             'sol2sanger' => [qw( in_faq out_faq )],
295             'bfq2fastq' => [qw( bfq faq )],
296             'mapass2maq' => [qw( in_map out_map )],
297             'mapview' => [qw( map >txt )],
298             'mapcheck' => [qw( bfa map >txt )],
299             'pileup' => [qw( bfa map >txt )],
300             'cns2fq' => [qw( cns >faq )],
301             'cns2snp' => [qw( cns >txt )],
302             'cns2view' => [qw( cns >txt )],
303             'cns2ref' => [qw( cns >fas )],
304             'cns2win' => [qw( cns >txt )],
305             'fasta2csfa' => [qw( in_fas >out_fas )],
306             'csmap2nt' => [qw( out_map bfa in_map )],
307             'submap' => [qw( out_map in_map )],
308             'eland2maq' => [qw( map lis eld )],
309             'export2maq' => [qw( map lis xpt )]
310             );
311              
312             INIT {
313             # add subcommand params and switches for
314             # composite commands
315 1     1   65 my @sub_params;
316             my @sub_switches;
317 1         4 foreach my $cmd (keys %composite_commands) {
318 1         1 foreach my $subcmd ( @{$composite_commands{$cmd}} ) {
  1         3  
319 3         81 my @sub_program_params = grep /^$subcmd\|/, @program_params;
320 3         30 my @sub_program_switches = grep /^$subcmd\|/, @program_switches;
321 3         5 for (@sub_program_params) {
322 22         57 m/^$subcmd\|(.*)/;
323 22         39 push @sub_params, "$cmd\|${subcmd}_".$1;
324             }
325 3         5 for (@sub_program_switches) {
326 2         8 m/^$subcmd\|(.*)/;
327 2         7 push @sub_switches, "$cmd\|${subcmd}_".$1;
328             }
329             }
330             }
331 1         4 push @program_params, @sub_params;
332 1         3 push @program_switches, @sub_switches;
333             # translations for subcmd params/switches not necessary
334             }
335             1;