2 # BioPerl module for Bio::Tools::Primer::Feature
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
16 Bio::Tools::Primer::Feature - position of a single primer
20 use Bio::Tools::Primer::Feature;
22 my $pf = Bio::Tools::Primer::Feature->new( -start => $start, -end => $end, -strand => $strand);
23 $pf->attach_seq($seq);
27 print "primer starts at ",$pf->start," with sequence ",$pf->seq->seq(),"\n";
31 print "GC percentage ",$pf->gc(),"\n";
32 print "has inversion of size 4 at ",$pf->inversion(4),"\n";
38 Primer Features represents one primer in a primer pair. This object is
39 mainly for designing primers, and probably principly used in the
46 User feedback is an integral part of the evolution of this and other
47 Bioperl modules. Send your comments and suggestions preferably to
48 the Bioperl mailing list. Your participation is much appreciated.
50 bioperl-l@bioperl.org - General discussion
51 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
55 Please direct usage questions or support issues to the mailing list:
57 I<bioperl-l@bioperl.org>
59 rather than to the module maintainer directly. Many experienced and
60 reponsive experts will be able look at the problem and quickly
61 address it. Please include a thorough description of the problem
62 with code and data examples if at all possible.
66 Report bugs to the Bioperl bug tracking system to help us keep track
67 of the bugs and their resolution. Bug reports can be submitted via the
70 https://github.com/bioperl/bioperl-live/issues
72 =head1 AUTHOR - Ewan Birney
74 Email birney-at-ebi.ac.uk
78 The rest of the documentation details each of the object methods.
79 Internal methods are usually preceded with a _
84 # Let the code begin...
88 package Bio
::Tools
::Primer
::Feature
;
90 use base
qw(Bio::SeqFeature::Generic);
95 my ( $caller, @args) = @_;
96 my ($self) = $caller->SUPER::new
(@args);
105 my $seq = $self->seq();
107 if( !defined $seq ) {
108 $self->throw("Primer feature has no attached sequence, can't calculate GC");
111 my $str = $seq->seq();
113 my $count = $str =~ tr/GCgc/GCgc/;
115 return $count*100.0 / $seq->length;
122 if( !defined $size ) {
123 $self->throw("Must have size paramter in inversion");
126 my $seq = $self->seq();
128 if( !defined $seq ) {
129 $self->throw("Primer feature has no attached sequence, can't calculate inversion");
132 my $len = $seq->length - $size;
134 my $str = $seq->seq();
136 foreach my $i ( 0 .. $len ) {
137 my $revstr = substr($str,$i,$size);
139 $revstr = reverse $revstr;
140 $revstr = s/[^ATGCNatgcn]/N/g;
142 $revstr =~ tr/ATGCNatgcn/TACGNtacgn/;
144 if( $str =~ /$revstr/ ) {