| 1 | # | ||||||||||
| 2 | # BioPerl module for Bio::Tools::Primer::Feature | ||||||||||
| 3 | # | ||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||
| 5 | # | ||||||||||
| 6 | # Cared for by Ewan Birney <birney@ebi.ac.uk> | ||||||||||
| 7 | # | ||||||||||
| 8 | # Copyright Ewan Birney | ||||||||||
| 9 | # | ||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||
| 11 | |||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||
| 13 | |||||||||||
| 14 | =head1 NAME | ||||||||||
| 15 | |||||||||||
| 16 | Bio::Tools::Primer::Feature - position of a single primer | ||||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | use Bio::Tools::Primer::Feature; | ||||||||||
| 21 | |||||||||||
| 22 | my $pf = Bio::Tools::Primer::Feature->new( -start => $start, -end => $end, -strand => $strand); | ||||||||||
| 23 | $pf->attach_seq($seq); | ||||||||||
| 24 | |||||||||||
| 25 | # is a SeqFeatureI | ||||||||||
| 26 | |||||||||||
| 27 | print "primer starts at ",$pf->start," with sequence ",$pf->seq->seq(),"\n"; | ||||||||||
| 28 | |||||||||||
| 29 | # helper functions | ||||||||||
| 30 | |||||||||||
| 31 | print "GC percentage ",$pf->gc(),"\n"; | ||||||||||
| 32 | print "has inversion of size 4 at ",$pf->inversion(4),"\n"; | ||||||||||
| 33 | |||||||||||
| 34 | |||||||||||
| 35 | |||||||||||
| 36 | =head1 DESCRIPTION | ||||||||||
| 37 | |||||||||||
| 38 | Primer Features represents one primer in a primer pair. This object is | ||||||||||
| 39 | mainly for designing primers, and probably principly used in the | ||||||||||
| 40 | primer design system | ||||||||||
| 41 | |||||||||||
| 42 | =head1 FEEDBACK | ||||||||||
| 43 | |||||||||||
| 44 | =head2 Mailing Lists | ||||||||||
| 45 | |||||||||||
| 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. | ||||||||||
| 49 | |||||||||||
| 50 | bioperl-l@bioperl.org - General discussion | ||||||||||
| 51 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||
| 52 | |||||||||||
| 53 | =head2 Support | ||||||||||
| 54 | |||||||||||
| 55 | Please direct usage questions or support issues to the mailing list: | ||||||||||
| 56 | |||||||||||
| 57 | I<bioperl-l@bioperl.org> | ||||||||||
| 58 | |||||||||||
| 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. | ||||||||||
| 63 | |||||||||||
| 64 | =head2 Reporting Bugs | ||||||||||
| 65 | |||||||||||
| 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 | ||||||||||
| 68 | web: | ||||||||||
| 69 | |||||||||||
| 70 | https://github.com/bioperl/bioperl-live/issues | ||||||||||
| 71 | |||||||||||
| 72 | =head1 AUTHOR - Ewan Birney | ||||||||||
| 73 | |||||||||||
| 74 | Email birney-at-ebi.ac.uk | ||||||||||
| 75 | |||||||||||
| 76 | =head1 APPENDIX | ||||||||||
| 77 | |||||||||||
| 78 | The rest of the documentation details each of the object methods. | ||||||||||
| 79 | Internal methods are usually preceded with a _ | ||||||||||
| 80 | |||||||||||
| 81 | =cut | ||||||||||
| 82 | |||||||||||
| 83 | |||||||||||
| 84 | # Let the code begin... | ||||||||||
| 85 | |||||||||||
| 86 | |||||||||||
| 87 | |||||||||||
| 88 | package Bio::Tools::Primer::Feature; | ||||||||||
| 89 | 1 | $Bio::Tools::Primer::Feature::VERSION = '1.7.8'; | |||||||||
| 90 | 1 | ▶ | use base qw(Bio::SeqFeature::Generic); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 91 | |||||||||||
| 92 | |||||||||||
| 93 | |||||||||||
| 94 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 95 | 0 | my ( $caller, @args) = @_; | |||||||||
| 96 | 0 | my ($self) = $caller->SUPER::new(@args); | |||||||||
| 97 | |||||||||||
| 98 | # done - we hope | ||||||||||
| 99 | 0 | return $self; | |||||||||
| 100 | } | ||||||||||
| 101 | |||||||||||
| 102 | 0 | ▶ | sub gc_percent { | ||||||||
|
Subroutine
gc_percent: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 103 | 0 | my $self = shift; | |||||||||
| 104 | |||||||||||
| 105 | 0 | my $seq = $self->seq(); | |||||||||
| 106 | |||||||||||
| 107 | 0 | ▶ | if( !defined $seq ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 108 | 0 | $self->throw("Primer feature has no attached sequence, can't calculate GC"); | |||||||||
| 109 | } | ||||||||||
| 110 | |||||||||||
| 111 | 0 | my $str = $seq->seq(); | |||||||||
| 112 | |||||||||||
| 113 | 0 | my $count = $str =~ tr/GCgc/GCgc/; | |||||||||
| 114 | |||||||||||
| 115 | 0 | return $count*100.0 / $seq->length; | |||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | 0 | ▶ | sub inversion { | ||||||||
|
Subroutine
inversion: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||
| 119 | 0 | my $self = shift; | |||||||||
| 120 | 0 | my $size = shift; | |||||||||
| 121 | |||||||||||
| 122 | 0 | ▶ | if( !defined $size ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | 0 | $self->throw("Must have size paramter in inversion"); | |||||||||
| 124 | } | ||||||||||
| 125 | |||||||||||
| 126 | 0 | my $seq = $self->seq(); | |||||||||
| 127 | |||||||||||
| 128 | 0 | ▶ | if( !defined $seq ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 129 | 0 | $self->throw("Primer feature has no attached sequence, can't calculate inversion"); | |||||||||
| 130 | } | ||||||||||
| 131 | |||||||||||
| 132 | 0 | my $len = $seq->length - $size; | |||||||||
| 133 | |||||||||||
| 134 | 0 | my $str = $seq->seq(); | |||||||||
| 135 | |||||||||||
| 136 | 0 | foreach my $i ( 0 .. $len ) { | |||||||||
| 137 | 0 | my $revstr = substr($str,$i,$size); | |||||||||
| 138 | 0 | my $orig = $revstr; | |||||||||
| 139 | 0 | $revstr = reverse $revstr; | |||||||||
| 140 | 0 | $revstr = s/[^ATGCNatgcn]/N/g; | |||||||||
| 141 | |||||||||||
| 142 | 0 | $revstr =~ tr/ATGCNatgcn/TACGNtacgn/; | |||||||||
| 143 | |||||||||||
| 144 | 0 | ▶ | if( $str =~ /$revstr/ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 145 | 0 | return $orig; | |||||||||
| 146 | } | ||||||||||
| 147 | } | ||||||||||
| 148 | |||||||||||
| 149 | 0 | return; | |||||||||
| 150 | } | ||||||||||
| 151 | |||||||||||
| 152 | 1 | 1; | |||||||||