lib/Bio/PrimerDesigner/Result.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 47 CC 2 SCAR 10.6
CC
2
Cov
0%
BEGIN
6.0
init
2.0
keys
2.0
CRAP 2.9
1 # $Id: Result.pm,v 1.9 2005/08/23 13:51:14 smckay Exp $
2  
3 package Bio::PrimerDesigner::Result;
4  
5 =head1 NAME
6  
7 Bio::PrimerDesigner::Result - a class for handling primer
8 design or validation results
9  
10 =head1 SYNOPSIS
11  
12 use Bio::PrimerDesigner;
13
14 #
15 # primer3
16 #
17 my $primer3_obj = Bio::PrimerDesigner->new( program => 'primer3 );
18 my $result = $primer3_obj->design( %hash_of_options );
19 my $left_primer = $result->left;
20 my @left_primers = $result->left(1..$num_primers);
21
22 #
23 # e-PCR -- first make a hash of options from primer3 results
24 # then run e-PCR
25 #
26 my $epcr_obj = Bio::PrimerDesigner->new( program => 'primer3 );
27 my $epcr_result = $epcr_obj->design( %hash_of_options );
28 my $num_products = $epcr_result->products;
29
30 #
31 # one product
32 #
33 my $first_prod_size = $epcr_result->size;
34 my $first_prod_start = $epcr_result->start;
35 my $first_prod_stop = $epcr_result->start;
36
37 #
38 # more than one product
39 #
40 my @pcr_product_sizes = ();
41 for (1..$num_products) {
42 push @pcr_product_sizes, $epcr_result->size;
43 }
44  
45 =head1 DESCRIPTION
46  
47 Bio::PrimerDesigner::Result will autogenerate result access methods
48 for for Native Boulder IO keys and Bio::PrimerDesigner keys for
49 primer3, e-PCR, isPcr and ipcress.
50  
51 =head1 METHODS
52  
53 =cut
54  
55 use strict;
56 use base 'Class::Base';
57  
58 use vars '$VERSION';
59 $VERSION = sprintf "%d.%02d", q$Revision: 1.9 $ =~ /(\d+)\.(\d+)/;
60  
61 use constant AUTO_FIELDS => [
62 qw (
63 ***PRIMER3_KEYS***
64 PRIMER_LEFT_EXPLAIN PRIMER_RIGHT_EXPLAIN PRIMER_PAIR_EXPLAIN
65 PRIMER_INTERNAL_OLIGO_EXPLAIN left_explain right_explain
66 hyb_oligo_explain hyb_oligo lselfend PRIMER_LEFT rendstab
67 PRIMER_LEFT_SEQUENCE prod SEQUENCE TARGET PRIMER_RIGHT_END_STABILITY
68 right lselfany PRIMER_RIGHT_GC_PERCENT left PRIMER_PRODUCT_SIZE_RANGE
69 PRIMER_PAIR_COMPL_END raw_output lendstab PRIMER_INTERNAL_OLIGO_TM
70 hyb_tm PRIMER_RIGHT_SEQUENCE PRIMER_PRODUCT_SIZE PRIMER_PAIR_COMPL_ANY
71 leftgc PRIMER_LEFT_SELF_END rightgc rqual qual PRIMER_PAIR_PENALTY
72 PRIMER_LEFT_SELF_ANY PRIMER_SEQUENCE_ID PRIMER_LEFT_TM PRIMER_RIGHT_TM
73 tmright PRIMER_RIGHT startright tmleft pairendcomp PRIMER_RIGHT_SELF_END
74 PRIMER_LEFT_GC_PERCENT rselfend PRIMER_LEFT_PENALTY PRIMER_RIGHT_PENALTY
75 EXCLUDED_REGION PRIMER_LEFT_END_STABILITY PRIMER_NUM_RETURN
76 PRIMER_RIGHT_SELF_ANY rselfany pairanycomp lqual startleft
77 ***other keys***
78 products size start stop end amplicon strand
79 )
80 ];
81  
82 BEGIN {
83 for my $sub_name ( @{ +AUTO_FIELDS } ){
84 no strict 'refs';
85 *{ $sub_name } = sub {
86 my $self = shift;
87 my @nums = @_;
88 $nums[0] ||= 1;
89 my @result = map { $self->{$_}->{$sub_name} } @nums;
90 return @result > 1 ? @result : $result[0];
91 }
92 }
93 }
94  
95 # -------------------------------------------------------------------
96 sub init {
97 my ( $self, $config ) = @_;
98 $self->params( $config, 'data' );
99 return $self;
100 }
101  
102 # -------------------------------------------------------------------
103  
104 =head2 keys
105  
106 This handles result method calls made via the
107 Bio::PrimerDesigner::Result object. Returns either a scalar or list
108 depending on the on the arguments:
109  
110 ------------------+------------------------
111 Args passed | Returns
112 ------------------+------------------------
113 none scalar value for set 1
114 numeric n scalar value for set n
115 numeric list 1..n list with n elements
116  
117 The aliased output methods (below) return a string when called in a
118 scalar context and a list when called in a list context. The native
119 primer3 (Boulder IO) keys can also be used. There are also e-PCR,
120 isPcr and ipcress specific methods
121  
122 B<Primer3 keys>
123  
124 =over 4
125  
126 =item * left -- left primer sequence
127  
128 =item * right -- right primer sequence
129  
130 =item * hyb_oligo -- internal oligo sequence
131  
132 =item * startleft -- left primer 5' sequence coordinate
133  
134 =item * startright -- right primer 5' sequence coordinate
135  
136 =item * tmleft -- left primer tm
137  
138 =item * tmright -- right primer tm
139  
140 =item * qual -- primer pair penalty (Q value)
141  
142 =item * lqual -- left primer penalty
143  
144 =item * rqual -- right primer penalty
145  
146 =item * leftgc -- left primer % gc
147  
148 =item * rightgc -- right primer % gc
149  
150 =item * lselfany -- left primer self-complementarity (any)
151  
152 =item * lselfend -- left primer self-complementarity (end)
153  
154 =item * rselfany -- right primer self-complementarity (any)
155  
156 =item * rselfend -- right primer self-complementarity (end)
157  
158 =item * pairanycomp -- primer pair complementarity (any)
159  
160 =item * pairendcomp -- primer pair complementarity (end)
161  
162 =item * lendstab -- left primer end stability
163  
164 =item * rendstab -- right primer end stability
165  
166 =item * amplicon -- amplified PCR product
167  
168 =back
169  
170 B<Other keys>
171  
172 =over 4
173  
174 =item * products -- number of PCR products
175  
176 =item * size -- product size
177  
178 =item * start -- product start coordinate
179  
180 =item * stop -- product stop coordinate
181  
182 =item * end -- synonymous with stop
183  
184 =item * strand -- strand of product relative to the ref. sequence (isPCR, ipcress)
185  
186 =item * amplicon -- returns the PCR product (isPCR only)
187  
188 =back
189  
190 =cut
191  
192  
193 sub keys {
194  
195 my $self = shift;
196 return $self->error('method not implemented');
197 }
198  
199 1;
200  
201 # -------------------------------------------------------------------
202  
203 =pod
204  
205 =head1 AUTHOR
206  
207 Copyright Sheldon McKay E<lt>mckays@cshl.eduE<gt> and Ken Y. Clark E<lt>kclark@cpan.orgE<gt>.
208  
209 =head1 LICENSE
210  
211 This program is free software; you can redistribute it and/or modify
212 it under the terms of the GNU General Public License as published by
213 the Free Software Foundation; version 2.
214  
215 This program is distributed in the hope that it will be useful, but
216 WITHOUT ANY WARRANTY; without even the implied warranty of
217 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
218 General Public License for more details.
219  
220 You should have received a copy of the GNU General Public License
221 along with this program; if not, write to the Free Software
222 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
223 USA.
224  
225 =head1 SEE ALSO
226  
227 Bio::PrimerDesigner.
228  
229 =cut