3 # BioPerl module for Bio::Tools::Primer::Feature
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Ewan Birney <birney@ebi.ac.uk>
9 # Copyright Ewan Birney
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
17 Bio::Tools::Primer::Feature - position of a single primer
21 use Bio::Tools::Primer::Feature;
23 my $pf = Bio::Tools::Primer::Feature->new( -start => $start, -end => $end, -strand => $strand);
24 $pf->attach_seq($seq);
28 print "primer starts at ",$pf->start," with sequence ",$pf->seq->seq(),"\n";
32 print "GC percentage ",$pf->gc(),"\n";
33 print "has inversion of size 4 at ",$pf->inversion(4),"\n";
39 Primer Features represents one primer in a primer pair. This object is
40 mainly for designing primers, and probably principly used in the
47 User feedback is an integral part of the evolution of this and other
48 Bioperl modules. Send your comments and suggestions preferably to
49 the Bioperl mailing list. Your participation is much appreciated.
51 bioperl-l@bioperl.org - General discussion
52 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
56 Please direct usage questions or support issues to the mailing list:
58 L<bioperl-l@bioperl.org>
60 rather than to the module maintainer directly. Many experienced and
61 reponsive experts will be able look at the problem and quickly
62 address it. Please include a thorough description of the problem
63 with code and data examples if at all possible.
67 Report bugs to the Bioperl bug tracking system to help us keep track
68 of the bugs and their resolution. Bug reports can be submitted via the
71 http://bugzilla.open-bio.org/
73 =head1 AUTHOR - Ewan Birney
75 Email birney-at-ebi.ac.uk
79 The rest of the documentation details each of the object methods.
80 Internal methods are usually preceded with a _
85 # Let the code begin...
89 package Bio
::Tools
::Primer
::Feature
;
91 use base
qw(Bio::SeqFeature::Generic);
96 my ( $caller, @args) = @_;
97 my ($self) = $caller->SUPER::new
(@args);
106 my $seq = $self->seq();
108 if( !defined $seq ) {
109 $self->throw("Primer feature has no attached sequence, can't calculate GC");
112 my $str = $seq->seq();
114 my $count = $str =~ tr/GCgc/GCgc/;
116 return $count*100.0 / $seq->length;
123 if( !defined $size ) {
124 $self->throw("Must have size paramter in inversion");
127 my $seq = $self->seq();
129 if( !defined $seq ) {
130 $self->throw("Primer feature has no attached sequence, can't calculate inversion");
133 my $len = $seq->length - $size;
135 my $str = $seq->seq();
137 foreach my $i ( 0 .. $len ) {
138 my $revstr = substr($str,$i,$size);
140 $revstr = reverse $revstr;
141 $revstr = s/[^ATGCNatgcn]/N/g;
143 $revstr =~ tr/ATGCNatgcn/TACGNtacgn/;
145 if( $str =~ /$revstr/ ) {