| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
=head1 NAME |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Bio::Polloc::Typing::bandingPattern::amplification - banding-pattern-based |
|
4
|
|
|
|
|
|
|
methods for typing assessment using amplification |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Category 1 of genotyping methods in: |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Li, W., Raoult, D., & Fournier, P.-E. (2009). |
|
11
|
|
|
|
|
|
|
Bacterial strain typing in the genomic era. |
|
12
|
|
|
|
|
|
|
FEMS Microbiology Reviews, 33(5), 892-916. |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 IMPLEMENTS OR EXTENDS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=over |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=item * |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
L<Bio::Polloc::Typing::bandingPattern> |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=back |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 AUTHOR - Luis M. Rodriguez-R |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Email lmrodriguezr at gmail dot com |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
package Bio::Polloc::Typing::bandingPattern::amplification; |
|
31
|
2
|
|
|
2
|
|
10
|
use base qw(Bio::Polloc::Typing::bandingPattern); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1192
|
|
|
32
|
2
|
|
|
2
|
|
11
|
use strict; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
161
|
|
|
33
|
2
|
|
|
2
|
|
10
|
use Bio::Polloc::Polloc::IO; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
44
|
|
|
34
|
2
|
|
|
2
|
|
1151
|
use Bio::Polloc::LocusI; |
|
|
2
|
|
|
|
|
6
|
|
|
|
2
|
|
|
|
|
2279
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = 1.0503; # [a-version] from Bio::Polloc::Polloc::Version |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 APPENDIX |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Methods provided by the package |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 new |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Generic initialization method |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
|
49
|
0
|
|
|
0
|
1
|
0
|
my($caller,@args) = @_; |
|
50
|
0
|
|
|
|
|
0
|
my $self = $caller->SUPER::new(@args); |
|
51
|
0
|
|
|
|
|
0
|
$self->_initialize(@args); |
|
52
|
0
|
|
|
|
|
0
|
return $self; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 METHODS FROM Bio::Polloc::TypingI |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 scan |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 cluster |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 typing_value |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 graph_content |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 METHODS FROM Bio::Polloc::Typing::bandingPattern |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 fragments |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub fragments { |
|
72
|
0
|
|
|
0
|
1
|
0
|
my($self, @args) = @_; |
|
73
|
0
|
|
|
|
|
0
|
my ($locigroup) = $self->_rearrange([qw(LOCIGROUP)], @args); |
|
74
|
0
|
0
|
|
|
|
0
|
defined $locigroup or $self->throw('Trying to amplify fragments, but no loci group provided'); |
|
75
|
0
|
|
|
|
|
0
|
my $primers = $self->design_primers(-locigroup=>$locigroup); |
|
76
|
0
|
0
|
|
|
|
0
|
return unless defined $primers; |
|
77
|
0
|
0
|
0
|
|
|
0
|
UNIVERSAL::can($primers, 'isa') and $primers->isa('Bio::Polloc::Polloc::IO') |
|
78
|
|
|
|
|
|
|
or $self->throw('Wrong primers file', $primers, 'Bio::Polloc::Polloc::UnexpectedException'); |
|
79
|
0
|
0
|
|
|
|
0
|
defined $primers->file or $self->throw('Impossible to locate primers temporal file', $primers, 'Bio::Polloc::Polloc::UnexpectedException'); |
|
80
|
0
|
|
|
|
|
0
|
my $out = Bio::Polloc::LociGroup->new(-genomes=>$locigroup->genomes); |
|
81
|
0
|
|
|
|
|
0
|
for my $g (0 .. $#{$locigroup->genomes}){ |
|
|
0
|
|
|
|
|
0
|
|
|
82
|
0
|
0
|
|
|
|
0
|
next unless defined $locigroup->genomes->[$g]->file; |
|
83
|
0
|
|
|
|
|
0
|
my $run = Bio::Polloc::Polloc::IO->new(-file=>"primersearch '".$locigroup->genomes->[$g]->file."' ". |
|
84
|
|
|
|
|
|
|
"'".$primers->file."' '".$self->annealing_errors."' -auto -stdout |"); |
|
85
|
0
|
|
|
|
|
0
|
my $amp = []; |
|
86
|
0
|
|
|
|
|
0
|
my $k = -1; |
|
87
|
0
|
|
|
|
|
0
|
while(my $ln = $run->_readline){ |
|
88
|
0
|
|
|
|
|
0
|
chomp $ln; |
|
89
|
0
|
0
|
|
|
|
0
|
if($ln =~ m/^Amplimer (\d+)/){ |
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
0
|
$amp->[$k = $1-1] = Bio::Polloc::LocusI->new( |
|
91
|
|
|
|
|
|
|
-type=>'amplicon', |
|
92
|
|
|
|
|
|
|
-primersio=>$primers, |
|
93
|
|
|
|
|
|
|
-genome=>$locigroup->genomes->[$g]); |
|
94
|
|
|
|
|
|
|
}elsif($ln =~ m/^\s*Sequence: ([^\s]*)\s*/){ |
|
95
|
0
|
|
|
|
|
0
|
my $sid=$1; |
|
96
|
0
|
|
|
|
|
0
|
$amp->[$k]->seq($locigroup->genomes->[$g]->search_sequence($sid)); |
|
97
|
|
|
|
|
|
|
}elsif($ln =~ m/^\s*\S+ hits forward strand at (\d+) with (\d+) mismatches/){ |
|
98
|
0
|
|
|
|
|
0
|
my($from,$err) = ($1+0, $2+0); |
|
99
|
0
|
|
|
|
|
0
|
$amp->[$k]->from($from); |
|
100
|
0
|
|
|
|
|
0
|
$amp->[$k]->errors($err); |
|
101
|
|
|
|
|
|
|
} |
|
102
|
0
|
|
|
|
|
0
|
elsif($ln =~ m/^\s*\S+ hits reverse strand at \[(\d+)\] with (\d+) mismatches/){ $amp->[$k]->errors($2 + $amp->[$k]->errors) } |
|
103
|
0
|
|
|
|
|
0
|
elsif($ln =~ m/^\s*Amplimer length: (\d+) bp/){ $amp->[$k]->to($1 + $amp->[$k]->from - 1) } |
|
104
|
|
|
|
|
|
|
} |
|
105
|
0
|
|
|
|
|
0
|
$out->add_loci($g, @$amp); |
|
106
|
|
|
|
|
|
|
} |
|
107
|
0
|
|
|
|
|
0
|
return $out; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 min_size |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 max_size |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 SPECIFIC METHODS |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 design_primers |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Designs the primers to amplify all the loci in the group. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head3 Arguments |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=over |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item -locigroup I<Bio::Polloc::LociGroup> |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The loci to be amplified. |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head3 Returns |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
A <Bio::Polloc::Polloc::IO> object pointing to a file containing the primers |
|
133
|
|
|
|
|
|
|
designed in the format required by EMBOSS primerseq: |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
NAME_1 FWD-SEQ REV-SEQ |
|
136
|
|
|
|
|
|
|
... |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub design_primers { |
|
141
|
0
|
|
|
0
|
1
|
0
|
my($self,@args) = @_; |
|
142
|
0
|
|
|
|
|
0
|
my($locigroup) = $self->_rearrange([qw(LOCIGROUP)], @args); |
|
143
|
0
|
0
|
|
|
|
0
|
defined $locigroup or $self->throw('Trying to design primers, but no loci group provided'); |
|
144
|
0
|
|
|
|
|
0
|
$locigroup->fix_strands; |
|
145
|
|
|
|
|
|
|
# Align flanking regions |
|
146
|
0
|
0
|
|
|
|
0
|
my $left_aln = $locigroup->align_context(-1, $self->flanking_size, 0) or return; |
|
147
|
0
|
0
|
|
|
|
0
|
my $right_aln = $locigroup->align_context(1, $self->flanking_size, 0) or return; |
|
148
|
|
|
|
|
|
|
# Consensus |
|
149
|
0
|
|
|
|
|
0
|
my $left_cons = $left_aln->consensus_string($self->primer_conservation); |
|
150
|
0
|
|
|
|
|
0
|
my $right_cons = $right_aln->consensus_string($self->primer_conservation); |
|
151
|
|
|
|
|
|
|
# Conserved region |
|
152
|
0
|
|
|
|
|
0
|
my $len = $self->primer_size; |
|
153
|
0
|
|
|
|
|
0
|
$left_cons =~ s/^.*?([^?]{$len}).*$/$1/; |
|
154
|
0
|
|
|
|
|
0
|
$right_cons =~ s/^.*?([^?]{$len}).*$/$1/; |
|
155
|
0
|
0
|
0
|
|
|
0
|
return unless length($left_cons)==$len and length($right_cons)==$len; |
|
156
|
|
|
|
|
|
|
# Reverse complement |
|
157
|
0
|
|
|
|
|
0
|
my $uprc = Bio::Seq->new(-seq=>$left_cons )->revcom->seq; |
|
158
|
0
|
|
|
|
|
0
|
my $downrc = Bio::Seq->new(-seq=>$right_cons)->revcom->seq; |
|
159
|
|
|
|
|
|
|
# Output file |
|
160
|
0
|
|
|
|
|
0
|
my $io = Bio::Polloc::Polloc::IO->new(-createtemp=>1); |
|
161
|
0
|
|
|
|
|
0
|
$io->_print("Polloc $uprc $downrc\n"); |
|
162
|
0
|
|
|
|
|
0
|
return $io; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head2 primer_conservation |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Gets/sets the minimum conservation of a region to design primers. 1 by default. |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=cut |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
sub primer_conservation { |
|
172
|
3
|
|
|
3
|
1
|
8
|
my($self, $value) = @_; |
|
173
|
3
|
100
|
|
|
|
17
|
$self->{'_primer_conservation'} = $value+0 if defined $value; |
|
174
|
3
|
50
|
|
|
|
12
|
return 1 unless defined $self->{'_primer_conservation'}; |
|
175
|
3
|
|
|
|
|
8
|
return $self->{'_primer_conservation'}; |
|
176
|
|
|
|
|
|
|
} |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 primer_size |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Gets/sets the primer size. 20 by default. |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub primer_size { |
|
185
|
3
|
|
|
3
|
1
|
5
|
my($self, $value) = @_; |
|
186
|
3
|
100
|
|
|
|
10
|
$self->{'_primer_size'} = $value+0 if defined $value; |
|
187
|
3
|
50
|
|
|
|
9
|
return 20 unless defined $self->{'_primer_size'}; |
|
188
|
3
|
|
|
|
|
7
|
return $self->{'_primer_size'}; |
|
189
|
|
|
|
|
|
|
} |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=head2 flanking_size |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
Gets/sets the size of the flanking region to take into account for the |
|
194
|
|
|
|
|
|
|
primer design. 500 by default. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=cut |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub flanking_size { |
|
199
|
2
|
|
|
2
|
1
|
5
|
my($self, $value) = @_; |
|
200
|
2
|
50
|
|
|
|
6
|
$self->{'_flanking_size'} = $value+0 if defined $value; |
|
201
|
2
|
50
|
|
|
|
9
|
return 500 unless defined $self->{'_flanking_size'}; |
|
202
|
0
|
|
|
|
|
0
|
return $self->{'_flanking_size'}; |
|
203
|
|
|
|
|
|
|
} |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head2 annealing_errors |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
Gets/sets the maximum percentage of errors allowed for a primer to anneal. |
|
208
|
|
|
|
|
|
|
0 by default. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
sub annealing_errors { |
|
213
|
2
|
|
|
2
|
1
|
4
|
my($self, $value) = @_; |
|
214
|
2
|
50
|
|
|
|
7
|
$self->{'_annealing_errors'} = $value+0 if defined $value; |
|
215
|
2
|
|
50
|
|
|
14
|
return $self->{'_annealing_errors'} || 0; |
|
216
|
|
|
|
|
|
|
} |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 INTERNAL METHODS |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Methods intended to be used only within the scope of Bio::Polloc::* |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head2 _initialize |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head2 _initialize_method |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=cut |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
sub _initialize_method { |
|
229
|
2
|
|
|
2
|
|
7
|
my($self,@args) = @_; |
|
230
|
2
|
|
|
|
|
11
|
my($primerConservation, $primerSize, $flankingSize, $annealingErrors) = |
|
231
|
|
|
|
|
|
|
$self->_rearrange([qw(PRIMERCONSERVATION PRIMERSIZE FLANKINGSIZE ANNEALINGERRORS)], @args); |
|
232
|
2
|
|
|
|
|
11
|
$self->type('bandingPattern::amplification'); |
|
233
|
2
|
|
|
|
|
5
|
$self->primer_conservation($primerConservation); |
|
234
|
2
|
|
|
|
|
6
|
$self->primer_size($primerSize); |
|
235
|
2
|
|
|
|
|
6
|
$self->flanking_size($flankingSize); |
|
236
|
2
|
|
|
|
|
6
|
$self->annealing_errors($annealingErrors); |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
1; |