0
|
1 # BioPerl module for Bio::PrimedSeq
|
|
2 #
|
|
3 # Cared for by Chad Matsalla <bioinformatics1@dieselwurks.com>
|
|
4 #
|
|
5 # Copyright Chad Matsalla
|
|
6 #
|
|
7 # You may distribute this module under the same terms as perl itself
|
|
8
|
|
9 # POD documentation - main docs before the code
|
|
10
|
|
11 =head1 Bio::Seq::PrimedSeq
|
|
12
|
|
13 Bio::Seq::PrimedSeq - A representation of a sequence and two primers flanking a
|
|
14 target region for amplification
|
|
15
|
|
16 =head1 SYNOPSIS
|
|
17
|
|
18 # create a sequence
|
|
19 my $sequence = "ctagctagctagctagctagctagctagctgatcgtagctagctagct";
|
|
20 # create left and right primer seqfeatures
|
|
21 # unfortunately, I haven't created constructors for these yet.
|
|
22 my $left = Bio::SeqFeature::Primer();
|
|
23 my $right = Bio::SeqFeature::Primer();
|
|
24 # now create the PrimedSeq
|
|
25 $primedseq = new Bio::Seq::PrimedSeq(
|
|
26 -seq => $sequence,
|
|
27 -display_id => "chads_fantastic_sequence",
|
|
28 -LEFT_PRIMER => $left,
|
|
29 -RIGHT_PRIMER => $right,
|
|
30 -TARGET => '513,26'
|
|
31 -PRIMER_PRODUCT_SIZE_RANGE => '100-500'
|
|
32 -PRIMER_FILE_FLAG => '0'
|
|
33 -PRIMER_LIBERAL_BASE => '1'
|
|
34 -PRIMER_NUM_RETURN => '1'
|
|
35 -PRIMER_FIRST_BASE_INDEX => '1'
|
|
36 -PRIMER_EXPLAIN_FLAG => '1'
|
|
37 -PRIMER_PRODUCT_SIZE => '185'
|
|
38 );
|
|
39 # get the amplified region
|
|
40 my $amplified_sequence = $primed_seq->get_amplified_sequence();
|
|
41
|
|
42 =head1 DESCRIPTION
|
|
43
|
|
44 This module is a slightly glorified capsule containg a primed seqBuence. It was
|
|
45 created to address the fact that a primer is more the a seqfeature and there
|
|
46 need to be ways to represent the primer-sequence complex and the behaviors and
|
|
47 attributes that are associated with the complex.
|
|
48
|
|
49 =head1 FEEDBACK
|
|
50
|
|
51 User feedback is an integral part of the evolution of this and other
|
|
52 Bioperl modules. Send your comments and suggestions preferably to one
|
|
53 of the Bioperl mailing lists. Your participation is much appreciated.
|
|
54
|
|
55 bioperl-l@bioperl.org - General discussion
|
|
56 http://bio.perl.org/MailList.html - About the mailing lists
|
|
57
|
|
58 =head2 Reporting Bugs
|
|
59
|
|
60 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
61 the bugs and their resolution. Bug reports can be submitted via email
|
|
62 or the web:
|
|
63
|
|
64 bioperl-bugs@bio.perl.org
|
|
65 http://bugzilla.bioperl.org/
|
|
66
|
|
67 =head1 APPENDIX
|
|
68
|
|
69 The rest of the documentation details each of the object
|
|
70 methods. Internal methods are usually preceded with a _
|
|
71
|
|
72 =cut
|
|
73
|
|
74
|
|
75 # Let the code begin...
|
|
76
|
|
77
|
|
78 package Bio::Seq::PrimedSeq;
|
|
79 use vars qw(@ISA);
|
|
80 use strict;
|
|
81
|
|
82 use Bio::RangeI;
|
|
83
|
|
84 @ISA = qw(Bio::Seq);
|
|
85
|
|
86
|
|
87 =head2 new
|
|
88
|
|
89 Title : new()
|
|
90 Usage : $primed_sequence = new Bio::SeqFeature::Primer( -seq => $sequence,
|
|
91 -left_primer => $left_primer,
|
|
92 -right_primer => $right_primer);
|
|
93 Function: A constructor for an object representing a primed sequence
|
|
94 Returns : A Bio::Seq::PrimedSeq object
|
|
95 Args :
|
|
96 -seq => a Bio::Seq object
|
|
97 -left_primer => a Bio::SeqFeature::Primer object
|
|
98 -right_primer => a Bio::SeqFeature::Primer object
|
|
99 Many other parameters can be included including all of the output
|
|
100 parameters from the primer3 program.
|
|
101 Developer Notes: This is incomplete and doesn't work. As of ISMB2002 I am working on it.
|
|
102
|
|
103
|
|
104 =cut
|
|
105
|
|
106 sub new {
|
|
107 my($class,@args) = @_;
|
|
108 my %arguments = @args;
|
|
109 my $self = $class->SUPER::new(@args);
|
|
110 # these are the absolute minimum components required to make
|
|
111 # a primedseq
|
|
112 my $newkey;
|
|
113 foreach my $key (sort keys %arguments) {
|
|
114 ($newkey = $key) =~ s/-//;
|
|
115 $self->{$newkey} = $arguments{$key};
|
|
116 push @{$self->{arguments}},$newkey;
|
|
117 }
|
|
118 # and now the insurance- make sure that things are ok
|
|
119 if (!$self->{target_sequence} || !$self->{left_primer} || !$self->{right_primer} ) {
|
|
120 $self->throw("You must provide a target_sequence, left_primer, and right_primer to create this object.");
|
|
121 }
|
|
122 if (ref($self->{target_sequence}) ne "Bio::Seq") {
|
|
123 $self->throw("The target_sequence must be a Bio::Seq to create this object.");
|
|
124 }
|
|
125 if (ref($self->{left_primer}) ne "Bio::SeqFeature::Primer" || ref($self->{right_primer}) ne "Bio::SeqFeature::Primer") {
|
|
126 $self->throw("You must provide a left_primer and right_primer, both as Bio::SeqFeature::Primer to create this object.");
|
|
127 }
|
|
128 return $self;
|
|
129 }
|
|
130
|
|
131
|
|
132 =head2 get_left_primer
|
|
133
|
|
134 Title : get_left_primer();
|
|
135 Usage : $left_primer = $primedseq->get_left_primer();
|
|
136 Function: A getter for the left primer in thie PrimedSeq object.
|
|
137 Returns : A Bio::SeqFeature::Primer object
|
|
138 Args : None.
|
|
139
|
|
140 =cut
|
|
141
|
|
142 sub get_left_primer() {
|
|
143 my $self = shift;
|
|
144
|
|
145
|
|
146
|
|
147
|
|
148 }
|
|
149
|
|
150
|
|
151
|
|
152
|
|
153
|
|
154
|
|
155
|
|
156
|
|
157
|
|
158
|
|
159
|
|
160
|
|
161 =head2 Bio::RangeI methods
|
|
162
|
|
163 List of interfaces inherited from Bio::RangeI (see L<Bio::RangeI>
|
|
164 for details).
|
|
165
|
|
166 =head2 start
|
|
167
|
|
168 Title : start
|
|
169 Usage : $start = $feat->start
|
|
170 Function: Returns the start coordinate of the feature
|
|
171 Returns : integer
|
|
172 Args : none
|
|
173 Developer Notes:
|
|
174 This is entirely dependent on the sequence to which this primer is attached!
|
|
175 I think that there could be trouble if one takes this primer from sequence 1
|
|
176 and naively place it on sequence 2 without updating this
|
|
177 ** This is incomplete at this time.
|
|
178 =cut
|
|
179
|
|
180 sub start() {
|
|
181 my $self = shift;
|
|
182
|
|
183
|
|
184 }
|
|
185
|
|
186
|
|
187
|
|
188
|
|
189 =head2 end
|
|
190
|
|
191 Title : end
|
|
192 Usage : $end = $feat->end
|
|
193 Function: Returns the end coordinate of the feature
|
|
194 Returns : integer
|
|
195 Args : none
|
|
196 Developer Notes:
|
|
197 ** This is incomplete at this time.
|
|
198 =cut
|
|
199
|
|
200 sub end() {
|
|
201 my $self = shift;
|
|
202
|
|
203
|
|
204 }
|
|
205
|
|
206 =head2 strand
|
|
207
|
|
208 Title : strand
|
|
209 Usage : $strand = $feat->strand()
|
|
210 Function: Returns strand information, being 1,-1 or 0
|
|
211 Returns : -1,1 or 0
|
|
212 Args : none
|
|
213 Developer Notes:
|
|
214 ** This is incomplete at this time.
|
|
215
|
|
216
|
|
217 =cut
|
|
218
|
|
219 sub strand() {
|
|
220 my $self = shift;
|
|
221 }
|
|
222
|
|
223
|
|
224 =head2 SeqFeatureI specific methods
|
|
225
|
|
226 New method interfaces.
|
|
227
|
|
228 =head2 sub_SeqFeature
|
|
229
|
|
230 Title : sub_SeqFeature
|
|
231 Usage : @feats = $feat->sub_SeqFeature();
|
|
232 Function: Returns an array of sub Sequence Features
|
|
233 Returns : An array
|
|
234 Args : none
|
|
235
|
|
236 =cut
|
|
237
|
|
238 sub sub_SeqFeature{
|
|
239 my ($self,@args) = @_;
|
|
240
|
|
241 $self->throw_not_implemented();
|
|
242 }
|
|
243
|
|
244 =head2 display_id
|
|
245
|
|
246 Title : display_id
|
|
247 Usage : $name = $feat->display_id()
|
|
248 Function: Returns the human-readable ID of the
|
|
249 feature for displays.
|
|
250 Returns : a string
|
|
251 Args : none
|
|
252
|
|
253 =cut
|
|
254
|
|
255 sub display_id {
|
|
256 my ($self,@args) = @_;
|
|
257 $self->throw_not_implemented();
|
|
258 }
|
|
259
|
|
260 =head2 primary_tag
|
|
261
|
|
262 Title : primary_tag
|
|
263 Usage : $tag = $feat->primary_tag()
|
|
264 Function: Returns the primary tag for a feature,
|
|
265 eg 'exon'
|
|
266 Returns : a string
|
|
267 Args : none
|
|
268
|
|
269
|
|
270 =cut
|
|
271
|
|
272 sub primary_tag{
|
|
273 my ($self,@args) = @_;
|
|
274
|
|
275 $self->throw_not_implemented();
|
|
276
|
|
277 }
|
|
278
|
|
279 =head2 source_tag
|
|
280
|
|
281 Title : source_tag
|
|
282 Usage : $tag = $feat->source_tag()
|
|
283 Function: Returns the source tag for a feature,
|
|
284 eg, 'genscan'
|
|
285 Returns : a string
|
|
286 Args : none
|
|
287
|
|
288
|
|
289 =cut
|
|
290
|
|
291 sub source_tag{
|
|
292 my ($self,@args) = @_;
|
|
293
|
|
294 $self->throw_not_implemented();
|
|
295 }
|
|
296
|
|
297 =head2 has_tag
|
|
298
|
|
299 Title : has_tag
|
|
300 Usage : $tag_exists = $self->has_tag('some_tag')
|
|
301 Function:
|
|
302 Returns : TRUE if the specified tag exists, and FALSE otherwise
|
|
303 Args :
|
|
304
|
|
305
|
|
306 =cut
|
|
307
|
|
308 sub has_tag{
|
|
309 my ($self,@args) = @_;
|
|
310
|
|
311 $self->throw_not_implemented();
|
|
312
|
|
313 }
|
|
314
|
|
315 =head2 each_tag_value
|
|
316
|
|
317 Title : each_tag_value
|
|
318 Usage : @values = $self->each_tag_value('some_tag')
|
|
319 Function:
|
|
320 Returns : An array comprising the values of the specified tag.
|
|
321 Args :
|
|
322
|
|
323
|
|
324 =cut
|
|
325
|
|
326 sub each_tag_value {
|
|
327 my ($self,@args) = @_;
|
|
328
|
|
329 $self->throw_not_implemented();
|
|
330 }
|
|
331
|
|
332 =head2 all_tags
|
|
333
|
|
334 Title : all_tags
|
|
335 Usage : @tags = $feat->all_tags()
|
|
336 Function: gives all tags for this feature
|
|
337 Returns : an array of strings
|
|
338 Args : none
|
|
339
|
|
340
|
|
341 =cut
|
|
342
|
|
343 sub all_tags{
|
|
344 my ($self,@args) = @_;
|
|
345
|
|
346 $self->throw_not_implemented();
|
|
347 }
|
|
348
|
|
349 =head2 gff_string
|
|
350
|
|
351 Title : gff_string
|
|
352 Usage : $str = $feat->gff_string;
|
|
353 $str = $feat->gff_string($gff_formatter);
|
|
354 Function: Provides the feature information in GFF format.
|
|
355
|
|
356 The implementation provided here returns GFF2 by default. If you
|
|
357 want a different version, supply an object implementing a method
|
|
358 gff_string() accepting a SeqFeatureI object as argument. E.g., to
|
|
359 obtain GFF1 format, do the following:
|
|
360
|
|
361 my $gffio = Bio::Tools::GFF->new(-gff_version => 1);
|
|
362 $gff1str = $feat->gff_string($gff1io);
|
|
363
|
|
364 Returns : A string
|
|
365 Args : Optionally, an object implementing gff_string().
|
|
366
|
|
367
|
|
368 =cut
|
|
369
|
|
370 sub gff_string{
|
|
371 my ($self,$formatter) = @_;
|
|
372
|
|
373 $formatter = $self->_static_gff_formatter unless $formatter;
|
|
374 return $formatter->gff_string($self);
|
|
375 }
|
|
376
|
|
377 my $static_gff_formatter = undef;
|
|
378
|
|
379 =head2 _static_gff_formatter
|
|
380
|
|
381 Title : _static_gff_formatter
|
|
382 Usage :
|
|
383 Function:
|
|
384 Example :
|
|
385 Returns :
|
|
386 Args :
|
|
387
|
|
388
|
|
389 =cut
|
|
390
|
|
391 sub _static_gff_formatter{
|
|
392 my ($self,@args) = @_;
|
|
393
|
|
394 if( !defined $static_gff_formatter ) {
|
|
395 $static_gff_formatter = Bio::Tools::GFF->new('-gff_version' => 2);
|
|
396 }
|
|
397 return $static_gff_formatter;
|
|
398 }
|
|
399
|
|
400
|
|
401
|
|
402 =head1 RangeI methods
|
|
403
|
|
404 These methods are inherited from RangeI and can be used
|
|
405 directly from a SeqFeatureI interface. Remember that a
|
|
406 SeqFeature is-a RangeI, and so wherever you see RangeI you
|
|
407 can use a feature ($r in the below documentation).
|
|
408
|
|
409 =head2 overlaps
|
|
410
|
|
411 Title : overlaps
|
|
412 Usage : if($feat->overlaps($r)) { do stuff }
|
|
413 if($feat->overlaps(200)) { do stuff }
|
|
414 Function: tests if $feat overlaps $r
|
|
415 Args : a RangeI to test for overlap with, or a point
|
|
416 Returns : true if the Range overlaps with the feature, false otherwise
|
|
417
|
|
418
|
|
419 =head2 contains
|
|
420
|
|
421 Title : contains
|
|
422 Usage : if($feat->contains($r) { do stuff }
|
|
423 Function: tests whether $feat totally contains $r
|
|
424 Args : a RangeI to test for being contained
|
|
425 Returns : true if the argument is totaly contained within this range
|
|
426
|
|
427
|
|
428 =head2 equals
|
|
429
|
|
430 Title : equals
|
|
431 Usage : if($feat->equals($r))
|
|
432 Function: test whether $feat has the same start, end, strand as $r
|
|
433 Args : a RangeI to test for equality
|
|
434 Returns : true if they are describing the same range
|
|
435
|
|
436
|
|
437 =head1 Geometrical methods
|
|
438
|
|
439 These methods do things to the geometry of ranges, and return
|
|
440 triplets (start, stop, strand) from which new ranges could be built.
|
|
441
|
|
442 =head2 intersection
|
|
443
|
|
444 Title : intersection
|
|
445 Usage : ($start, $stop, $strand) = $feat->intersection($r)
|
|
446 Function: gives the range that is contained by both ranges
|
|
447 Args : a RangeI to compare this one to
|
|
448 Returns : nothing if they do not overlap, or the range that they do overlap
|
|
449
|
|
450 =head2 union
|
|
451
|
|
452 Title : union
|
|
453 Usage : ($start, $stop, $strand) = $feat->union($r);
|
|
454 : ($start, $stop, $strand) = Bio::RangeI->union(@ranges);
|
|
455 Function: finds the minimal range that contains all of the ranges
|
|
456 Args : a range or list of ranges to find the union of
|
|
457 Returns : the range containing all of the ranges
|
|
458
|
|
459 =cut
|
|
460
|
|
461 =head2 location
|
|
462
|
|
463 Title : location
|
|
464 Usage : my $location = $seqfeature->location()
|
|
465 Function: returns a location object suitable for identifying location
|
|
466 of feature on sequence or parent feature
|
|
467 Returns : Bio::LocationI object
|
|
468 Args : none
|
|
469
|
|
470
|
|
471 =cut
|
|
472
|
|
473 sub location {
|
|
474 my ($self) = @_;
|
|
475
|
|
476 $self->throw_not_implemented();
|
|
477 }
|
|
478
|
|
479
|
|
480 1;
|