line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#
|
2
|
|
|
|
|
|
|
# module for PrimerMap
|
3
|
|
|
|
|
|
|
#
|
4
|
|
|
|
|
|
|
# based on the Bio::SeqFeature::Generic modules
|
5
|
|
|
|
|
|
|
# by Ewan Birney
|
6
|
|
|
|
|
|
|
# and the Bio::Graphics modules
|
7
|
|
|
|
|
|
|
# by Lincoln Stein
|
8
|
|
|
|
|
|
|
# Copyright Damien O'Halloran
|
9
|
|
|
|
|
|
|
#
|
10
|
|
|
|
|
|
|
# You may distribute this module under the same terms as perl itself
|
11
|
|
|
|
|
|
|
# History
|
12
|
|
|
|
|
|
|
# October 24, 2016
|
13
|
|
|
|
|
|
|
# POD documentation - main docs before the code
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
PrimerMap - generates a primer sequence graphcial map
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
use PrimerMap;
|
22
|
|
|
|
|
|
|
use Data::Dumper;
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $start = "12,24,28,32,824,888,902";
|
25
|
|
|
|
|
|
|
my $end = "40,59,48,50,801,848,880";
|
26
|
|
|
|
|
|
|
my $output = "myGene.png";
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# can also collect primer coordinates from a text file
|
29
|
|
|
|
|
|
|
# my $inFile = "primermap_file.txt";
|
30
|
|
|
|
|
|
|
# $tmp->read_file($inFile);
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $tmp = PrimerMap->new();
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
$tmp->load_map(
|
35
|
|
|
|
|
|
|
primer_start => $start,
|
36
|
|
|
|
|
|
|
primer_end => $end,
|
37
|
|
|
|
|
|
|
seq_length => "1200",
|
38
|
|
|
|
|
|
|
gene_name => "myGene",
|
39
|
|
|
|
|
|
|
out_file => $output || "output.png"
|
40
|
|
|
|
|
|
|
);
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# take a look at the object
|
43
|
|
|
|
|
|
|
print Dumper($tmp);
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# print the primer map
|
46
|
|
|
|
|
|
|
$tmp->primer_map();
|
47
|
|
|
|
|
|
|
print "\n\n";
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# getters and setters can be used as follows:
|
50
|
|
|
|
|
|
|
my $set_start = $tmp->set_start("22,24,2226");
|
51
|
|
|
|
|
|
|
print $set_start. "\n\n";
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $get_start = $tmp->get_start();
|
54
|
|
|
|
|
|
|
print $get_start. "\n\n";
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $set_end = $tmp->set_end("52,64,2202");
|
57
|
|
|
|
|
|
|
print $set_end. "\n\n";
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $get_end = $tmp->get_end();
|
60
|
|
|
|
|
|
|
print $get_end. "\n\n";
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
my $set_length = $tmp->set_length(2500);
|
63
|
|
|
|
|
|
|
print $set_length. "\n\n";
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $get_length = $tmp->get_length();
|
66
|
|
|
|
|
|
|
print $get_length. "\n\n";
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $set_id = $tmp->set_ID("myNewGeneName");
|
69
|
|
|
|
|
|
|
print $set_id. "\n\n";
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $get_id = $tmp->get_ID();
|
72
|
|
|
|
|
|
|
print $get_id. "\n\n";
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $set_file = $tmp->set_outfile("myOutPutFile.png");
|
75
|
|
|
|
|
|
|
print $set_file. "\n\n";
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $get_file = $tmp->get_outfile();
|
78
|
|
|
|
|
|
|
print $get_file. "\n\n";
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
# see the newly set object
|
81
|
|
|
|
|
|
|
print Dumper($tmp);
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# see the newly set primer map
|
84
|
|
|
|
|
|
|
$tmp->primer_map();
|
85
|
|
|
|
|
|
|
print "\n\n";
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This object extends the Bio::SeqFeature::Generic class to provide an object for Bio::Graphics. Uses primer starting and ending coordinates (base pairs) to generate a primer map relative to a base sequence.
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 FEEDBACK
|
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
damienoh@gwu.edu
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 Mailing Lists
|
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
User feedback is an integral part of the evolution of this module. Send your comments and suggestions preferably to one of the mailing lists. Your participation is much appreciated.
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 Support
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Please direct usage questions or support issues to:
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Please include a thorough description of the problem with code and data examples if at all possible.
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 Reporting Bugs
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Report bugs to the GitHub bug tracking system to help keep track of the bugs and their resolution. Bug reports can be submitted via the GitHub page:
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
https://github.com/dohalloran/Bio-SeqFeature-Generic-Ext-PrimerMap/issues
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 AUTHORS - Damien OHalloran
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Email: damienoh@gwu.edu
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 APPENDIX
|
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The rest of the documentation details each of the object
|
119
|
|
|
|
|
|
|
methods.
|
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut
|
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# Let the code begin...
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
package PrimerMap;
|
126
|
|
|
|
|
|
|
|
127
|
1
|
|
|
1
|
|
35373
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
49
|
|
128
|
|
|
|
|
|
|
|
129
|
1
|
|
|
1
|
|
523
|
use Bio::Graphics;
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
# inherits from the Bio::SeqFeature::Generic class
|
132
|
|
|
|
|
|
|
use parent qw/Bio::SeqFeature::Generic/;
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
our $VERSION = '1.0';
|
135
|
|
|
|
|
|
|
##################################
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 read_file()
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Title : read_file()
|
140
|
|
|
|
|
|
|
Usage : my $tmp->read_file($inFile);
|
141
|
|
|
|
|
|
|
Function: get data for $self hash from a file
|
142
|
|
|
|
|
|
|
Returns : Populates the $self->{start} and $self->{end} properties
|
143
|
|
|
|
|
|
|
Args : $filename, a texfile that contains input data of primer
|
144
|
|
|
|
|
|
|
starting and ending features as base pairs e.g.:
|
145
|
|
|
|
|
|
|
12,24,28,32,824,888,902
|
146
|
|
|
|
|
|
|
40,59,48,50,801,848,880
|
147
|
|
|
|
|
|
|
note: the starting positions is the first line
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
##################################
|
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
sub read_file {
|
154
|
|
|
|
|
|
|
my ( $self, $filename ) = @_;
|
155
|
|
|
|
|
|
|
my @tempArr;
|
156
|
|
|
|
|
|
|
my $fh;
|
157
|
|
|
|
|
|
|
open $fh, '<', $filename or $self->throw("Cannot open $filename: $!");
|
158
|
|
|
|
|
|
|
while (<$fh>) {
|
159
|
|
|
|
|
|
|
chomp;
|
160
|
|
|
|
|
|
|
push @tempArr, $_;
|
161
|
|
|
|
|
|
|
}
|
162
|
|
|
|
|
|
|
close($fh);
|
163
|
|
|
|
|
|
|
$self->{start} = $tempArr[0];
|
164
|
|
|
|
|
|
|
$self->{end} = $tempArr[1];
|
165
|
|
|
|
|
|
|
}
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
##################################
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head2 load_map()
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Title : load_map()
|
172
|
|
|
|
|
|
|
Usage : my $tmp->load_map(
|
173
|
|
|
|
|
|
|
primer_start => $start, #don't include if loading file
|
174
|
|
|
|
|
|
|
primer_end => $end, #don't include if loading file
|
175
|
|
|
|
|
|
|
seq_length => "1200",
|
176
|
|
|
|
|
|
|
gene_name => "myGene",
|
177
|
|
|
|
|
|
|
out_file => $output || "output.png"
|
178
|
|
|
|
|
|
|
);
|
179
|
|
|
|
|
|
|
Function: Populates the user data into $self hash
|
180
|
|
|
|
|
|
|
Returns : nothing returned
|
181
|
|
|
|
|
|
|
Args :
|
182
|
|
|
|
|
|
|
-primer_start, a csv string of starting base pairs for primers
|
183
|
|
|
|
|
|
|
-primer_end, a csv string of final base pairs for primers
|
184
|
|
|
|
|
|
|
-seq_length, the length in base pairs of the gene sequence
|
185
|
|
|
|
|
|
|
-gene_name, the ID to give to the gene (optional)
|
186
|
|
|
|
|
|
|
-out_file, name of the resulting graphical output file (optional)
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=cut
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
##################################
|
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub load_map {
|
193
|
|
|
|
|
|
|
my ( $self, %arg ) = @_;
|
194
|
|
|
|
|
|
|
if ( defined $arg{primer_start} ) {
|
195
|
|
|
|
|
|
|
$self->{start} = $arg{primer_start};
|
196
|
|
|
|
|
|
|
}
|
197
|
|
|
|
|
|
|
if ( defined $arg{primer_end} ) {
|
198
|
|
|
|
|
|
|
$self->{end} = $arg{primer_end};
|
199
|
|
|
|
|
|
|
}
|
200
|
|
|
|
|
|
|
if ( defined $arg{seq_length} ) {
|
201
|
|
|
|
|
|
|
$self->{seq_len} = $arg{seq_length};
|
202
|
|
|
|
|
|
|
}
|
203
|
|
|
|
|
|
|
if ( defined $arg{gene_name} ) {
|
204
|
|
|
|
|
|
|
$self->{seq_id} = $arg{gene_name};
|
205
|
|
|
|
|
|
|
}
|
206
|
|
|
|
|
|
|
if ( defined $arg{out_file} ) {
|
207
|
|
|
|
|
|
|
$self->{out_file} = $arg{out_file};
|
208
|
|
|
|
|
|
|
}
|
209
|
|
|
|
|
|
|
}
|
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
###################################
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head2 get_start()
|
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Title : get_start()
|
216
|
|
|
|
|
|
|
Usage : my $get_start = $tmp->get_start();
|
217
|
|
|
|
|
|
|
Function: Retrieves the primer starting features
|
218
|
|
|
|
|
|
|
Returns : A string containing primer start features
|
219
|
|
|
|
|
|
|
Args : none
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=cut
|
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
##################################
|
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
sub get_start {
|
226
|
|
|
|
|
|
|
my ($self) = @_;
|
227
|
|
|
|
|
|
|
return $self->{start};
|
228
|
|
|
|
|
|
|
}
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
###################################
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=head2 set_start()
|
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Title : set_start()
|
235
|
|
|
|
|
|
|
Usage : my $set_start = $tmp->set_start("22,24,2226");
|
236
|
|
|
|
|
|
|
Function: Populates the $self->{start} property
|
237
|
|
|
|
|
|
|
Returns : $self->{start}
|
238
|
|
|
|
|
|
|
Args : a csv string of starting base pairs for primers
|
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut
|
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
##################################
|
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub set_start {
|
245
|
|
|
|
|
|
|
my ( $self, $value ) = @_;
|
246
|
|
|
|
|
|
|
$self->{start} = $value;
|
247
|
|
|
|
|
|
|
return $self->{start};
|
248
|
|
|
|
|
|
|
}
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
###################################
|
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=head2 get_end()
|
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Title : get_end()
|
255
|
|
|
|
|
|
|
Usage : my $get_end = $tmp->get_end();
|
256
|
|
|
|
|
|
|
Function: Retrieves the primer ending features
|
257
|
|
|
|
|
|
|
Returns : A string containing primer end features
|
258
|
|
|
|
|
|
|
Args : none
|
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=cut
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
##################################
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub get_end {
|
265
|
|
|
|
|
|
|
my ($self) = @_;
|
266
|
|
|
|
|
|
|
return $self->{end};
|
267
|
|
|
|
|
|
|
}
|
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
###################################
|
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 set_end()
|
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
Title : set_end()
|
274
|
|
|
|
|
|
|
Usage : my $set_end = $tmp->set_end("52,64,2202");
|
275
|
|
|
|
|
|
|
Function: Populates the $self->{end} property
|
276
|
|
|
|
|
|
|
Returns : $self->{end}
|
277
|
|
|
|
|
|
|
Args : a csv string of ending base pairs for primers
|
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=cut
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
##################################
|
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
sub set_end {
|
284
|
|
|
|
|
|
|
my ( $self, $value ) = @_;
|
285
|
|
|
|
|
|
|
$self->{end} = $value;
|
286
|
|
|
|
|
|
|
return $self->{end};
|
287
|
|
|
|
|
|
|
}
|
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
###################################
|
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=head2 get_ID()
|
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
Title : get_ID()
|
294
|
|
|
|
|
|
|
Usage : my $get_ID = $tmp->get_ID();
|
295
|
|
|
|
|
|
|
Function: Retrieves the gene name
|
296
|
|
|
|
|
|
|
Returns : A string containing gene name
|
297
|
|
|
|
|
|
|
Args : none
|
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=cut
|
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
##################################
|
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
sub get_ID {
|
304
|
|
|
|
|
|
|
my ($self) = @_;
|
305
|
|
|
|
|
|
|
return $self->{seq_id};
|
306
|
|
|
|
|
|
|
}
|
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
###################################
|
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
=head2 set_ID()
|
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
Title : set_ID()
|
313
|
|
|
|
|
|
|
Usage : my $set_id = $tmp->set_ID("myNewGeneName");
|
314
|
|
|
|
|
|
|
Function: Populates the $self->{seq_id} property
|
315
|
|
|
|
|
|
|
Returns : $self->{seq_id}
|
316
|
|
|
|
|
|
|
Args : the ID to give to the gene
|
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=cut
|
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
##################################
|
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
sub set_ID {
|
323
|
|
|
|
|
|
|
my ( $self, $value ) = @_;
|
324
|
|
|
|
|
|
|
$self->{seq_id} = $value;
|
325
|
|
|
|
|
|
|
return $self->{seq_id};
|
326
|
|
|
|
|
|
|
}
|
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
###################################
|
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head2 get_outfile()
|
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Title : get_outfile()
|
333
|
|
|
|
|
|
|
Usage : my $get_outfile = $tmp->get_outfile();
|
334
|
|
|
|
|
|
|
Function: Retrieves the output filename
|
335
|
|
|
|
|
|
|
Returns : A string containing filename
|
336
|
|
|
|
|
|
|
Args : none
|
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=cut
|
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
##################################
|
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub get_outfile {
|
343
|
|
|
|
|
|
|
my ($self) = @_;
|
344
|
|
|
|
|
|
|
return $self->{out_file};
|
345
|
|
|
|
|
|
|
}
|
346
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
###################################
|
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
=head2 set_outfile()
|
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
Title : set_outfile()
|
352
|
|
|
|
|
|
|
Usage : my $set_output = $tmp->set_outfile("myOutPutFile.txt");
|
353
|
|
|
|
|
|
|
Function: Populates the $self->{out_file} property
|
354
|
|
|
|
|
|
|
Returns : $self->{out_file}
|
355
|
|
|
|
|
|
|
Args : name of the resulting graphical output file
|
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
=cut
|
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
##################################
|
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub set_outfile {
|
362
|
|
|
|
|
|
|
my ( $self, $value ) = @_;
|
363
|
|
|
|
|
|
|
$self->{out_file} = $value;
|
364
|
|
|
|
|
|
|
return $self->{out_file};
|
365
|
|
|
|
|
|
|
}
|
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
###################################
|
368
|
|
|
|
|
|
|
|
369
|
|
|
|
|
|
|
=head2 get_length()
|
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
Title : get_length()
|
372
|
|
|
|
|
|
|
Usage : my $get_length = $tmp->get_length();
|
373
|
|
|
|
|
|
|
Function: Retrieves the sequence length in base pairs
|
374
|
|
|
|
|
|
|
Returns : Gene length
|
375
|
|
|
|
|
|
|
Args : none
|
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
=cut
|
378
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
###################################
|
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
sub get_length {
|
382
|
|
|
|
|
|
|
my ($self) = @_;
|
383
|
|
|
|
|
|
|
return $self->{seq_len};
|
384
|
|
|
|
|
|
|
}
|
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
###################################
|
387
|
|
|
|
|
|
|
|
388
|
|
|
|
|
|
|
=head2 set_length()
|
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
Title : set_length()
|
391
|
|
|
|
|
|
|
Usage : my $set_length = $tmp->set_length(2500);
|
392
|
|
|
|
|
|
|
Function: Populates the $self->{seq_len} property
|
393
|
|
|
|
|
|
|
Returns : $self->{seq_len}
|
394
|
|
|
|
|
|
|
Args : length of gene
|
395
|
|
|
|
|
|
|
|
396
|
|
|
|
|
|
|
=cut
|
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
###################################
|
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
sub set_length {
|
401
|
|
|
|
|
|
|
my ( $self, $value ) = @_;
|
402
|
|
|
|
|
|
|
$self->{seq_len} = $value;
|
403
|
|
|
|
|
|
|
return $self->{seq_len};
|
404
|
|
|
|
|
|
|
}
|
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
###################################
|
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=head2 primer_map()
|
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
Title : primer_map()
|
411
|
|
|
|
|
|
|
Usage : my $tmp->primer_map();
|
412
|
|
|
|
|
|
|
Function: Populate the panels for Bio::Graphics::Panel and Bio::SeqFeature::Generic
|
413
|
|
|
|
|
|
|
Returns : A graphical files containing primer sequence map
|
414
|
|
|
|
|
|
|
Args : all collected from the Bio::SeqFeature::Generic constructor
|
415
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=cut
|
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
##################################
|
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
sub primer_map {
|
421
|
|
|
|
|
|
|
my ($self) = @_;
|
422
|
|
|
|
|
|
|
my $orientation;
|
423
|
|
|
|
|
|
|
my $out_dir = 'Output';
|
424
|
|
|
|
|
|
|
if ( !-e $out_dir ) {
|
425
|
|
|
|
|
|
|
print "Output directory ($out_dir) does not exist! Creating...\n";
|
426
|
|
|
|
|
|
|
mkdir($out_dir) or $self->throw("Failed to create the output directory ($out_dir): $!\n");
|
427
|
|
|
|
|
|
|
print "Done\n\n";
|
428
|
|
|
|
|
|
|
}
|
429
|
|
|
|
|
|
|
my $outputfile = "./".$out_dir."/".$self->{out_file};
|
430
|
|
|
|
|
|
|
my $out;
|
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
open $out, '>', $outputfile or $self->throw("Cannot open $outputfile: $!");
|
433
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
my $panel = Bio::Graphics::Panel->new(
|
435
|
|
|
|
|
|
|
-length => $self->{seq_len},
|
436
|
|
|
|
|
|
|
-width => 800,
|
437
|
|
|
|
|
|
|
-pad_left => 30,
|
438
|
|
|
|
|
|
|
-pad_right => 30,
|
439
|
|
|
|
|
|
|
-pad_top => 20,
|
440
|
|
|
|
|
|
|
-pad_bottom => 20,
|
441
|
|
|
|
|
|
|
);
|
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
my $full_length = Bio::SeqFeature::Generic->new(
|
444
|
|
|
|
|
|
|
-start => 1,
|
445
|
|
|
|
|
|
|
-end => $self->{seq_len},
|
446
|
|
|
|
|
|
|
-display_name => $self->{seq_id},
|
447
|
|
|
|
|
|
|
);
|
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
$panel->add_track(
|
450
|
|
|
|
|
|
|
$full_length,
|
451
|
|
|
|
|
|
|
-glyph => 'arrow',
|
452
|
|
|
|
|
|
|
-tick => 2,
|
453
|
|
|
|
|
|
|
-fgcolor => 'black',
|
454
|
|
|
|
|
|
|
-double => 1,
|
455
|
|
|
|
|
|
|
-label => 1,
|
456
|
|
|
|
|
|
|
-strand_arrow => 1,
|
457
|
|
|
|
|
|
|
);
|
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
my $track = $panel->add_track(
|
460
|
|
|
|
|
|
|
-glyph => 'transcript2',
|
461
|
|
|
|
|
|
|
-label => 1,
|
462
|
|
|
|
|
|
|
-strand_arrow => 1,
|
463
|
|
|
|
|
|
|
-bgcolor => 'blue',
|
464
|
|
|
|
|
|
|
-bump => +1,
|
465
|
|
|
|
|
|
|
-height => 12,
|
466
|
|
|
|
|
|
|
);
|
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
my @start_position = split /,/, $self->{start};
|
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
my @end_position = split /,/, $self->{end};
|
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
for my $i ( 0 .. $#start_position ) {
|
473
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
if ( $start_position[$i] - $end_position[$i] < 1 ) {
|
475
|
|
|
|
|
|
|
$orientation = +1;
|
476
|
|
|
|
|
|
|
}
|
477
|
|
|
|
|
|
|
else {
|
478
|
|
|
|
|
|
|
$orientation = -1;
|
479
|
|
|
|
|
|
|
}
|
480
|
|
|
|
|
|
|
my $feature = Bio::SeqFeature::Generic->new(
|
481
|
|
|
|
|
|
|
-display_name => "primer: " . $start_position[$i],
|
482
|
|
|
|
|
|
|
-start => $start_position[$i],
|
483
|
|
|
|
|
|
|
-strand => $orientation,
|
484
|
|
|
|
|
|
|
-end => $end_position[$i]
|
485
|
|
|
|
|
|
|
);
|
486
|
|
|
|
|
|
|
$track->add_feature($feature);
|
487
|
|
|
|
|
|
|
}
|
488
|
|
|
|
|
|
|
binmode $out;
|
489
|
|
|
|
|
|
|
print $out $panel->png;
|
490
|
|
|
|
|
|
|
close($out);
|
491
|
|
|
|
|
|
|
}
|
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
###################################
|
494
|
|
|
|
|
|
|
1;
|