tag fourth (and hopefully last) alpha
[bioperl-live.git] / branch-1-6 / Bio / Tools / Primer / Pair.pm
blob0913f553f4a0c2fd5d1d43cde2cf0160090de927
1 # $Id$
2 # BioPerl module for Bio::Tools::Primer::Pair
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Ewan Birney <birney@ebi.ac.uk>
8 # Copyright Ewan Birney
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Tools::Primer::Pair - two primers on left and right side
18 =head1 SYNOPSIS
20 use Bio::Tools::Primer::Pair;
22 my $pair = Bio::Tools::Primer::Pair->new( -left => $leftp , -right => $rightp);
24 # helper functions
26 print "GC percentage different",$pf->gc_difference(),"\n";
27 print "product length is ",$pf->product_length,"\n";
31 =head1 DESCRIPTION
33 Primer Pairs represents one primer in a primer pair. This object is mainly for
34 designing primers, and probably principly used in the primer design system
36 =head1 FEEDBACK
38 =head2 Mailing Lists
40 User feedback is an integral part of the evolution of this and other
41 Bioperl modules. Send your comments and suggestions preferably to
42 the Bioperl mailing list. Your participation is much appreciated.
44 bioperl-l@bioperl.org - General discussion
45 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
47 =head2 Support
49 Please direct usage questions or support issues to the mailing list:
51 I<bioperl-l@bioperl.org>
53 rather than to the module maintainer directly. Many experienced and
54 reponsive experts will be able look at the problem and quickly
55 address it. Please include a thorough description of the problem
56 with code and data examples if at all possible.
58 =head2 Reporting Bugs
60 Report bugs to the Bioperl bug tracking system to help us keep track
61 of the bugs and their resolution. Bug reports can be submitted via the
62 web:
64 http://bugzilla.open-bio.org/
66 =head1 AUTHOR - Ewan Birney
68 Email birney-at-ebi.ac.uk
70 =head1 APPENDIX
72 The rest of the documentation details each of the object methods.
73 Internal methods are usually preceded with a _
75 =cut
78 # Let the code begin...
82 package Bio::Tools::Primer::Pair;
84 use base qw(Bio::Root::Root);
86 sub new {
87 my ( $caller, @args) = @_;
88 my ($self) = $caller->SUPER::new(@args);
90 my ($left,$right) = $self->_rearrange([qw(LEFT RIGHT)],@args);
92 if( !defined $left || !defined $right ) {
93 $self->throw("Pair must be initialised with left and right primers");
96 $self->left($left);
97 $self->right($right);
99 # done - we hope
100 return $self;
103 sub left {
104 my $self = shift;
105 my $left = shift;
107 if( defined $left ) {
108 if( !ref $left || !$left->isa("Bio::Tools::Primer::Feature") ) {
109 $self->throw("left primer must be a Bio::Tools::Primer::Feature, not $left");
111 $self->{'left'} = $left;
114 return $self->{'left'};
118 sub right {
119 my $self = shift;
120 my $right = shift;
122 if( defined $right ) {
123 if( !ref $right || !$right->isa("Bio::Tools::Primer::Feature") ) {
124 $self->throw("right primer must be a Bio::Tools::Primer::Feature, not $right");
126 $self->{'right'} = $right;
129 return $self->{'right'};
132 sub gc_difference {
133 my $self = shift;
135 return abs ( $self->left->gc_percent - $self->right->gc_percent );
138 sub product_length {
139 my $self = shift;
141 return $self->right->end - $self->left->start +1;