t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / Tools / Primer / Pair.pm
blobf07ff6de6b67af343081aff85e0fea6fd40f26cb
1 # BioPerl module for Bio::Tools::Primer::Pair
3 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 # Cared for by Ewan Birney <birney@ebi.ac.uk>
7 # Copyright Ewan Birney
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
13 =head1 NAME
15 Bio::Tools::Primer::Pair - two primers on left and right side
17 =head1 SYNOPSIS
19 use Bio::Tools::Primer::Pair;
21 my $pair = Bio::Tools::Primer::Pair->new( -left => $leftp , -right => $rightp);
23 # helper functions
25 print "GC percentage different",$pf->gc_difference(),"\n";
26 print "product length is ",$pf->product_length,"\n";
30 =head1 DESCRIPTION
32 Primer Pairs represents one primer in a primer pair. This object is mainly for
33 designing primers, and probably principly used in the primer design system
35 =head1 FEEDBACK
37 =head2 Mailing Lists
39 User feedback is an integral part of the evolution of this and other
40 Bioperl modules. Send your comments and suggestions preferably to
41 the Bioperl mailing list. Your participation is much appreciated.
43 bioperl-l@bioperl.org - General discussion
44 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
46 =head2 Support
48 Please direct usage questions or support issues to the mailing list:
50 I<bioperl-l@bioperl.org>
52 rather than to the module maintainer directly. Many experienced and
53 reponsive experts will be able look at the problem and quickly
54 address it. Please include a thorough description of the problem
55 with code and data examples if at all possible.
57 =head2 Reporting Bugs
59 Report bugs to the Bioperl bug tracking system to help us keep track
60 of the bugs and their resolution. Bug reports can be submitted via the
61 web:
63 https://github.com/bioperl/bioperl-live/issues
65 =head1 AUTHOR - Ewan Birney
67 Email birney-at-ebi.ac.uk
69 =head1 APPENDIX
71 The rest of the documentation details each of the object methods.
72 Internal methods are usually preceded with a _
74 =cut
77 # Let the code begin...
81 package Bio::Tools::Primer::Pair;
83 use base qw(Bio::Root::Root);
85 sub new {
86 my ( $caller, @args) = @_;
87 my ($self) = $caller->SUPER::new(@args);
89 my ($left,$right) = $self->_rearrange([qw(LEFT RIGHT)],@args);
91 if( !defined $left || !defined $right ) {
92 $self->throw("Pair must be initialised with left and right primers");
95 $self->left($left);
96 $self->right($right);
98 # done - we hope
99 return $self;
102 sub left {
103 my $self = shift;
104 my $left = shift;
106 if( defined $left ) {
107 if( !ref $left || !$left->isa("Bio::Tools::Primer::Feature") ) {
108 $self->throw("left primer must be a Bio::Tools::Primer::Feature, not $left");
110 $self->{'left'} = $left;
113 return $self->{'left'};
117 sub right {
118 my $self = shift;
119 my $right = shift;
121 if( defined $right ) {
122 if( !ref $right || !$right->isa("Bio::Tools::Primer::Feature") ) {
123 $self->throw("right primer must be a Bio::Tools::Primer::Feature, not $right");
125 $self->{'right'} = $right;
128 return $self->{'right'};
131 sub gc_difference {
132 my $self = shift;
134 return abs ( $self->left->gc_percent - $self->right->gc_percent );
137 sub product_length {
138 my $self = shift;
140 return $self->right->end - $self->left->start +1;