File Coverage

blib/lib/Bio/GeneDesign/Oligo.pm
Criterion Covered Total %
statement 12 39 30.7
branch 0 10 0.0
condition 0 2 0.0
subroutine 4 7 57.1
pod n/a
total 16 58 27.5


line stmt bran cond sub pod time code
1             #
2             # GeneDesign module for sequence segmentation
3             #
4              
5             =head1 NAME
6              
7             Bio::GeneDesign::Oligo
8              
9             =head1 VERSION
10              
11             Version 5.52
12              
13             =head1 DESCRIPTION
14              
15              
16             =head1 AUTHOR
17              
18             Sarah Richardson <SMRichardson@lbl.gov>.
19              
20             =cut
21              
22             package Bio::GeneDesign::Oligo;
23             require Exporter;
24              
25 11     11   176 use Bio::GeneDesign::Basic qw(:GD);
  11         20  
  11         3003  
26 11     11   70 use strict;
  11         22  
  11         474  
27 11     11   64 use warnings;
  11         29  
  11         709  
28              
29             our $VERSION = 5.52;
30              
31 11     11   65 use base qw(Exporter);
  11         20  
  11         7050  
32             our @EXPORT_OK = qw(
33             _make_amplification_primers
34             _filter_homopolymer
35             _check_for_homopolymer
36             $VERSION
37             );
38             our %EXPORT_TAGS = (GD => \@EXPORT_OK);
39              
40             =head1 Functions
41              
42             =head2 _filter_homopolymer()
43              
44             =cut
45              
46             sub _filter_homopolymer
47             {
48 0     0     my ($seqarr, $length) = @_;
49 0           my @newarr = ();
50 0           foreach my $seq (@{$seqarr})
  0            
51             {
52 0 0         push @newarr, $seq if (! _check_for_homopolymer($seq, $length));
53             }
54 0           return \@newarr;
55             }
56              
57             =head2 _check_for_homopolymer()
58              
59             =cut
60              
61             sub _check_for_homopolymer
62             {
63 0     0     my ($seq, $length) = @_;
64 0   0       $length = $length || 5;
65 0 0         return 1 if ($length <= 1);
66 0 0         return 1 if $seq =~ m{A{$length}|T{$length}|C{$length}|G{$length}}msxi;
67 0           return 0;
68             }
69              
70             =head2 _make_amplification_primers()
71              
72             =cut
73              
74             sub _make_amplification_primers
75             {
76 0     0     my ($sequence, $temperature) = @_;
77              
78 0           my $left_length = 5;
79 0           my $lprimer = substr($sequence, 0, $left_length);
80 0           while (_melt($lprimer) < $temperature)
81             {
82 0           $left_length++;
83 0 0         last if ($left_length > 45);
84 0           $lprimer = substr($sequence, 0, $left_length)
85             }
86            
87 0           my $right_end = length($sequence);
88 0           my $right_length = 5;
89 0           my $rprimer = substr($sequence, $right_end - $right_length, $right_length);
90 0           while (_melt($rprimer) < $temperature)
91             {
92 0           $right_length++;
93 0 0         last if ($right_length > 45);
94 0           $rprimer = substr($sequence, $right_end - $right_length, $right_length);
95             }
96 0           $rprimer = _complement($rprimer, 1);
97            
98 0           return ($lprimer, $rprimer);
99             }
100              
101             1;
102              
103             __END__
104              
105             =head1 COPYRIGHT AND LICENSE
106              
107             Copyright (c) 2013, GeneDesign developers
108             All rights reserved.
109              
110             Redistribution and use in source and binary forms, with or without modification,
111             are permitted provided that the following conditions are met:
112              
113             * Redistributions of source code must retain the above copyright notice, this
114             list of conditions and the following disclaimer.
115              
116             * Redistributions in binary form must reproduce the above copyright notice, this
117             list of conditions and the following disclaimer in the documentation and/or
118             other materials provided with the distribution.
119              
120             * The names of Johns Hopkins, the Joint Genome Institute, the Lawrence Berkeley
121             National Laboratory, the Department of Energy, and the GeneDesign developers may
122             not be used to endorse or promote products derived from this software without
123             specific prior written permission.
124              
125             THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
126             ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
127             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
128             DISCLAIMED. IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
129             INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
130             LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
131             PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
132             LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
133             OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
134             ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
135              
136             =cut
137