Variation/VariantI.pm

filter: Statementstmt 82.0% 142 / 173 Branchbran 75.0% 81 / 108 Conditioncond 66.6% 18 / 27 MC/DCmcdc 46.6% 7 / 15 Subroutinesub 84.0% 21 / 25 Podpod 100% 21 / 21 totaltotal 78.5% 290 / 369 CC 65 SCAR 21.8
CC
65
Cov
78%
restriction_changes
20.5
add_DBLink
20.0
id
12.0
CRAP 8.9
« Variation/DNAMutation.pm ↑ Summary Variation/Allele.pm »
1 #
2 # BioPerl module for Bio::Variation::VariantI
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Heikki Lehvaslaiho <heikki-at-bioperl-dot-org>
7 #
8 # Copyright Heikki Lehvaslaiho
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::Variation::VariantI - Sequence Change SeqFeature abstract class
17  
18 =head1 SYNOPSIS
19  
20 #get Bio::Variant::VariantI somehow
21 print $var->restriction_changes, "\n";
22 foreach $allele ($var->each_Allele) {
23 #work on Bio::Variation::Allele objects
24 }
25  
26 =head1 DESCRIPTION
27  
28 This superclass defines common methods to basic sequence changes. The
29 instantiable classes Bio::Variation::DNAMutation,
30 Bio::Variation::RNAChange and Bio::Variation::AAChange use them.
31 See L<Bio::Variation::DNAMutation>, L<Bio::Variation::RNAChange>,
32 and L<Bio::Variation::AAChange> for more information.
33  
34 These classes store information, heavy computation to determine allele
35 sequences is done elsewhere.
36  
37 The database cross-references are implemented as
38 Bio::Annotation::DBLink objects. The methods to access them are
39 defined in Bio::DBLinkContainerI. See L<Bio::Annotation::DBLink>
40 and L<Bio::DBLinkContainerI> for details.
41  
42 Bio::Variation::VariantI redifines and extends
43 Bio::SeqFeature::Generic for sequence variations. This class
44 describes specific sequence change events. These events are always
45 from a specific reference sequence to something different. See
46 L<Bio::SeqFeature::Generic> for more information.
47  
48 IMPORTANT: The notion of reference sequence permeates all
49 Bio::Variation classes. This is especially important to remember when
50 dealing with Alleles. In a polymorphic site, there can be a large
51 number of alleles. One of then has to be selected to be the reference
52 allele (allele_ori). ALL the rest has to be passed to the Variant
53 using the method add_Allele, including the mutated allele in a
54 canonical mutation. The IO modules and generated attributes depend on
55 it. They ignore the allele linked to using allele_mut and circulate
56 each Allele returned by each_Allele into allele_mut and calculate
57 the changes between that and allele_ori.
58  
59  
60 =head1 FEEDBACK
61  
62 =head2 Mailing Lists
63  
64 User feedback is an integral part of the evolution of this and other
65 Bioperl modules. Send your comments and suggestions preferably to the
66 Bioperl mailing lists Your participation is much appreciated.
67  
68 bioperl-l@bioperl.org - General discussion
69 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
70  
71 =head2 Support
72  
73 Please direct usage questions or support issues to the mailing list:
74  
75 I<bioperl-l@bioperl.org>
76  
77 rather than to the module maintainer directly. Many experienced and
78 reponsive experts will be able look at the problem and quickly
79 address it. Please include a thorough description of the problem
80 with code and data examples if at all possible.
81  
82 =head2 Reporting Bugs
83  
84 Report bugs to the Bioperl bug tracking system to help us keep track
85 the bugs and their resolution. Bug reports can be submitted via the
86 web:
87  
88 https://github.com/bioperl/bioperl-live/issues
89  
90 =head1 AUTHOR - Heikki Lehvaslaiho
91  
92 Email: heikki-at-bioperl-dot-org
93  
94 =head1 APPENDIX
95  
96 The rest of the documentation details each of the object
97 methods. Internal methods are usually preceded with a _
98  
99 =cut
100  
101  
102 # Let the code begin...
103  
104  
105 package Bio::Variation::VariantI;
106 12 $Bio::Variation::VariantI::VERSION = '1.7.5';
107 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
108 # Object preamble - inheritance
109  
110 12 ▶use base qw(Bio::Root::Root Bio::SeqFeature::Generic Bio::DBLinkContainerI);
Subroutine BEGIN: called CC=1 SCAR=0.0
111  
112 =head2 id
113  
114 Title : id
115 Usage : $obj->id
116 Function:
117  
118 Read only method. Returns the id of the variation object.
119 The id is the id of the first DBLink object attached to this object.
120  
121 Example :
122 Returns : scalar
123 Args : none
124  
125 =cut
126  
127 0 ▶sub id {
Subroutine id: not called CC=3 SCAR=24.8
Pod documented
128 0 my ($self) = @_;
129 0 my @ids = $self->each_DBLink;
130 0 ▶ my $id = $ids[0] if scalar @ids > 0;
Branch: 1 branch
BranchTrueFalseTotal
if scalar @ids > 0 0 0 0
131 0 ▶ return $id->database. "::". $id->primary_id if $id;
Branch: 1 branch
BranchTrueFalseTotal
if $id 0 0 0
132 }
133  
134  
135 =head2 add_Allele
136  
137 Title : add_Allele
138 Usage : $self->add_Allele($allele)
139 Function:
140  
141 Adds one Bio::Variation::Allele into the list of alleles.
142 Note that the method forces the convention that nucleotide
143 sequence is in lower case and amino acds are in upper
144 case.
145  
146 Example :
147 Returns : 1 when succeeds, 0 for failure.
148 Args : Allele object
149  
150 =cut
151  
152  
153 50 ▶sub add_Allele {
Subroutine add_Allele: called CC=6 SCAR=18.8
Pod documented
154 50 my ($self,$value) = @_;
155 50 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 50 0 50
156 50 ▶ if( ! $value->isa('Bio::Variation::Allele') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value->isa('Bio::Variation::Allele')) { } 0 50 50
157 0 my $com = ref $value;
158 0 $self->throw("Is not a Allele object but a [$com]");
159 0 return 0;
160 } else {
161 50 ▶ if ( $self->isa('Bio::Variation::AAChange') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa('Bio::Variation::AAChange')) { } 14 36 50
162 14 ▶ $value->seq( uc $value->seq) if $value->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $value->seq 13 1 14
163 } else {
164 36 ▶ $value->seq( lc $value->seq) if $value->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $value->seq 32 4 36
165 }
166 50 push(@{$self->{'alleles'}},$value);
167 50 $self->allele_mut($value); #????
168 50 return 1;
169 }
170 } else {
171 0 return 0;
172 }
173 }
174  
175  
176 =head2 each_Allele
177  
178 Title : alleles
179 Usage : $obj->each_Allele();
180 Function:
181  
182 Returns a list of Bio::Variation::Allele objects
183  
184 Example :
185 Returns : list of Alleles
186 Args : none
187  
188 =cut
189  
190 75 ▶sub each_Allele{
Subroutine each_Allele: called CC=1 SCAR=0.0
Pod documented
191 75 my ($self,@args) = @_;
192 75 return @{$self->{'alleles'}};
193 }
194  
195  
196 =head2 isMutation
197  
198 Title : isMutation
199 Usage : print join('/', $obj->each_Allele) if not $obj->isMutation;
200 Function:
201  
202 Returns or sets the boolean value indicating that the
203 variant described is a canonical mutation with two alleles
204 assinged to be the original (wild type) allele and mutated
205 allele, respectively. If this value is not set, it is
206 assumed that the Variant describes polymorphisms.
207  
208 Returns : a boolean
209  
210 =cut
211  
212 125 ▶sub isMutation {
Subroutine isMutation: called CC=3 SCAR=11.2
Pod documented
213 125 my ($self,$value) = @_;
214 125 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 46 79 125
215 46 ▶ if ($value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value) { } 46 0 46
216 46 $self->{'isMutation'} = 1;
217 } else {
218 0 $self->{'isMutation'} = 0;
219 }
220 }
221 125 return $self->{'isMutation'};
222 }
223  
224  
225 =head2 allele_ori
226  
227 Title : allele_ori
228 Usage : $obj->allele_ori();
229 Function:
230  
231 Links to and returns the Bio::Variation::Allele object.
232 If value is not set, returns false. All other Alleles are
233 compared to this.
234  
235 Amino acid sequences are stored in upper case characters,
236 others in lower case.
237  
238 Example :
239 Returns : string
240 Args : string
241  
242 See L<Bio::Variation::Allele> for more.
243  
244 =cut
245  
246 889 ▶sub allele_ori {
Subroutine allele_ori: called CC=7 SCAR=20.2
Pod documented
247 889 my ($self,$value) = @_;
248 889 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 53 836 889
249 53 ▶ if ( ! ref $value || ! $value->isa('Bio::Variation::Allele')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $value && $value->isa('Bio::Variation::Allele')) { } 0 53 53
Condition33%1/3
ref $value && $value->isa('Bio::Variation::Allele')
!ll&&!rl&&r
0053
MC/DC0%0/2
ref $value && $value->isa('Bio::Variation::Allele')
ref $value $value->isa('Bio::Variation::Allele')
Truth table33%1/3
A && B
A= ref $valueB= $value->isa('Bio::Variation::Allele')
ABresult
0X0
100
111
250 0 $self->throw("Value is not Bio::Variation::Allele but [$value]");
251 } else {
252 53 ▶ if ( $self->isa('Bio::Variation::AAChange') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa('Bio::Variation::AAChange')) { } 14 39 53
253 14 ▶ $value->seq( uc $value->seq) if $value->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $value->seq 14 0 14
254 } else {
255 39 ▶ $value->seq( lc $value->seq) if $value->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $value->seq 35 4 39
256 }
257 53 $self->{'allele_ori'} = $value;
258 }
259 }
260 889 return $self->{'allele_ori'};
261 }
262  
263  
264 =head2 allele_mut
265  
266 Title : allele_mut
267 Usage : $obj->allele_mut();
268 Function:
269  
270 Links to and returns the Bio::Variation::Allele
271 object. Sets and returns the mutated allele sequence.
272 If value is not set, returns false.
273  
274 Amino acid sequences are stored in upper case characters,
275 others in lower case.
276  
277 Example :
278 Returns : string
279 Args : string
280  
281 See L<Bio::Variation::Allele> for more.
282  
283 =cut
284  
285  
286 1087 ▶sub allele_mut {
Subroutine allele_mut: called CC=7 SCAR=19.9
Pod documented
287 1087 my ($self,$value) = @_;
288 1087 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 191 896 1087
289 191 ▶ if ( ! ref $value || ! $value->isa('Bio::Variation::Allele')) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $value && $value->isa('Bio::Variation::Allele')) { } 0 191 191
Condition33%1/3
ref $value && $value->isa('Bio::Variation::Allele')
!ll&&!rl&&r
00191
MC/DC0%0/2
ref $value && $value->isa('Bio::Variation::Allele')
ref $value $value->isa('Bio::Variation::Allele')
Truth table33%1/3
A && B
A= ref $valueB= $value->isa('Bio::Variation::Allele')
ABresult
0X0
100
111
290 0 $self->throw("Value is not Bio::Variation::Allele but [$value]");
291 } else {
292 191 ▶ if ( $self->isa('Bio::Variation::AAChange') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa('Bio::Variation::AAChange')) { } 53 138 191
293 53 ▶ $value->seq( uc $value->seq) if $value->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $value->seq 49 4 53
294 } else {
295 138 ▶ $value->seq( lc $value->seq) if $value->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $value->seq 122 16 138
296 }
297 191 $self->{'allele_mut'} = $value;
298 }
299 }
300 1087 return $self->{'allele_mut'};
301 }
302  
303 =head2 length
304  
305 Title : length
306 Usage : $obj->length();
307 Function:
308  
309 Sets and returns the length of the affected original
310 allele sequence. If value is not set, returns false == 0.
311  
312 Value 0 means that the variant position is before the
313 start=end sequence position. (Value 1 would denote a point
314 mutation). This follows the convension to report an
315 insertion (2insT) in equivalent way to a corresponding
316 deletion (2delT) (Think about indel polymorpism ATC <=> AC
317 where the origianal state is not known ).
318  
319 Example :
320 Returns : string
321 Args : string
322  
323 =cut
324  
325  
326 164 ▶sub length {
Subroutine length: called CC=3 SCAR=11.0
Pod documented
327 164 my ($self,$value) = @_;
328 164 ▶ if ( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 47 117 164
329 47 $self->{'length'} = $value;
330 }
331 164 ▶ if ( ! exists $self->{'length'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"length"}) 12 152 164
332 12 return 0;
333 }
334 152 return $self->{'length'};
335 }
336  
337 =head2 upStreamSeq
338  
339 Title : upStreamSeq
340 Usage : $obj->upStreamSeq();
341 Function:
342  
343 Sets and returns upstream flanking sequence string. If
344 value is not set, returns false. The sequence should be
345 >=25 characters long, if possible.
346  
347 Example :
348 Returns : string or false
349 Args : string
350  
351 =cut
352  
353  
354 308 ▶sub upStreamSeq {
Subroutine upStreamSeq: called CC=2 SCAR=6.9
Pod documented
355 308 my ($self,$value) = @_;
356 308 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 39 269 308
357 39 $self->{'upstreamseq'} = $value;
358 }
359 308 return $self->{'upstreamseq'};
360 }
361  
362  
363 =head2 dnStreamSeq
364  
365 Title : dnStreamSeq
366 Usage : $obj->dnStreamSeq();
367 Function:
368  
369 Sets and returns dnstream flanking sequence string. If
370 value is not set, returns false. The sequence should be
371 >=25 characters long, if possible.
372  
373 Example :
374 Returns : string or false
375 Args : string
376  
377 =cut
378  
379  
380 328 ▶sub dnStreamSeq {
Subroutine dnStreamSeq: called CC=2 SCAR=6.9
Pod documented
381 328 my ($self,$value) = @_;
382 328 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 39 289 328
383 39 $self->{'dnstreamseq'} = $value;
384 }
385 328 return $self->{'dnstreamseq'};
386  
387 }
388  
389  
390 =head2 label
391  
392 Title : label
393 Usage : $obj->label();
394 Function:
395  
396 Sets and returns mutation event label(s). If value is not
397 set, or no argument is given returns false. Each
398 instantiable class needs to implement this method. Valid
399 values are listed in 'Mutation event controlled vocabulary' in
400 http://www.ebi.ac.uk/mutations/recommendations/mutevent.html.
401  
402 Example :
403 Returns : string
404 Args : string
405  
406 =cut
407  
408  
409 0 ▶sub label {
Subroutine label: not called CC=1 SCAR=6.9
Pod documented
410 0 my ($self,$value) = @_;
411 0 $self->throw_not_implemented();
412 }
413  
414  
415  
416 =head2 status
417  
418 Title : status
419 Usage : $obj->status()
420 Function:
421  
422 Returns the status of the sequence change object.
423 Valid values are: 'suspected' and 'proven'
424  
425 Example : $obj->status('proven');
426 Returns : scalar
427 Args : valid string (optional, for setting)
428  
429  
430 =cut
431  
432  
433 6 ▶sub status {
Subroutine status: called CC=4 SCAR=14.5
Pod documented
434 6 my ($self,$value) = @_;
435 6 my %status = (suspected => 1,
436 proven => 1
437 );
438  
439 6 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 3 3 6
440 3 $value = lc $value;
441 3 ▶ if ($status{$value}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status{$value}) { } 3 0 3
442 3 $self->{'status'} = $value;
443 }
444 else {
445 0 $self->throw("$value is not valid status value!");
446 }
447 }
448 6 ▶ if( ! exists $self->{'status'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"status"}) 0 6 6
449 0 return "$self";
450 }
451 6 return $self->{'status'};
452 }
453  
454  
455 =head2 proof
456  
457 Title : proof
458 Usage : $obj->proof()
459 Function:
460  
461 Returns the proof of the sequence change object.
462 Valid values are: 'computed' and 'experimental'.
463  
464 Example : $obj->proof('computed');
465 Returns : scalar
466 Args : valid string (optional, for setting)
467  
468  
469 =cut
470  
471  
472 146 ▶sub proof {
Subroutine proof: called CC=3 SCAR=11.1
Pod documented
473 146 my ($self,$value) = @_;
474 146 my %proof = (computed => 1,
475 experimental => 1
476 );
477  
478 146 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 48 98 146
479 48 $value = lc $value;
480 48 ▶ if ($proof{$value}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proof{$value}) { } 48 0 48
481 48 $self->{'proof'} = $value;
482 } else {
483 0 $self->throw("$value is not valid proof value!");
484 }
485 }
486 146 return $self->{'proof'};
487 }
488  
489  
490 =head2 region
491  
492 Title : region
493 Usage : $obj->region();
494 Function:
495  
496 Sets and returns the name of the sequence region type or
497 protein domain at this location. If value is not set,
498 returns false.
499  
500 Example :
501 Returns : string
502 Args : string
503  
504 =cut
505  
506  
507 42 ▶sub region {
Subroutine region: called CC=2 SCAR=6.9
Pod documented
508 42 my ($self,$value) = @_;
509 42 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 6 36 42
510 6 $self->{'region'} = $value;
511 }
512 42 return $self->{'region'};
513 }
514  
515  
516 =head2 region_value
517  
518 Title : region_value
519 Usage : $obj->region_value();
520 Function:
521  
522 Sets and returns the name of the sequence region_value or
523 protein domain at this location. If value is not set,
524 returns false.
525  
526 Example :
527 Returns : string
528 Args : string
529  
530 =cut
531  
532  
533 50 ▶sub region_value {
Subroutine region_value: called CC=2 SCAR=6.9
Pod documented
534 50 my ($self,$value) = @_;
535 50 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 4 46 50
536 4 $self->{'region_value'} = $value;
537 }
538 50 return $self->{'region_value'};
539 }
540  
541 =head2 region_dist
542  
543 Title : region_dist
544 Usage : $obj->region_dist();
545 Function:
546  
547 Sets and returns the distance tot the closest region
548 (i.e. intro/exon or domain) boundary. If distance is not
549 set, returns false.
550  
551 Example :
552 Returns : integer
553 Args : integer
554  
555 =cut
556  
557  
558 60 ▶sub region_dist {
Subroutine region_dist: called CC=3 SCAR=11.2
Pod documented
559 60 my ($self,$value) = @_;
560 60 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 7 53 60
561 7 ▶ if ( not $value =~ /^[+-]?\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^[+-]?\d+$/) { } 0 7 7
562 0 $self->throw("[$value] for region_dist has to be an integer\n");
563 } else {
564 7 $self->{'region_dist'} = $value;
565 }
566 }
567 60 return $self->{'region_dist'};
568 }
569  
570  
571 =head2 numbering
572  
573 Title : numbering
574 Usage : $obj->numbering()
575 Function:
576  
577 Returns the numbering chema used locating sequnce features.
578 Valid values are: 'entry' and 'coding'
579  
580 Example : $obj->numbering('coding');
581 Returns : scalar
582 Args : valid string (optional, for setting)
583  
584  
585 =cut
586  
587  
588 6 ▶sub numbering {
Subroutine numbering: called CC=4 SCAR=14.5
Pod documented
589 6 my ($self,$value) = @_;
590 6 my %numbering = (entry => 1,
591 coding => 1
592 );
593  
594 6 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 3 3 6
595 3 $value = lc $value;
596 3 ▶ if ($numbering{$value}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($numbering{$value}) { } 3 0 3
597 3 $self->{'numbering'} = $value;
598 }
599 else {
600 0 $self->throw("'$value' is not a valid for numbering!");
601 }
602 }
603 6 ▶ if( ! exists $self->{'numbering'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $self->{"numbering"}) 0 6 6
604 0 return "$self";
605 }
606 6 return $self->{'numbering'};
607 }
608  
609 =head2 mut_number
610  
611 Title : mut_number
612 Usage : $num = $obj->mut_number;
613 : $num = $obj->mut_number($number);
614 Function:
615  
616 Returns or sets the number identifying the order in which the
617 mutation has been issued. Numbers shouldstart from 1.
618 If the number has never been set, the method will return ''
619  
620 If you want the output from IO modules look nice and, for
621 multivariant/allele variations, make sense you better set
622 this attribute.
623  
624 Returns : an integer
625  
626 =cut
627  
628  
629 259 ▶sub mut_number {
Subroutine mut_number: called CC=3 SCAR=11.2
Pod documented
630 259 my ($self,$value) = @_;
631 259 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 52 207 259
632 52 $self->{'mut_number'} = $value;
633 }
634 259 ▶ unless (exists $self->{'mut_number'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'mut_number'}) { } 259 0 259
635 0 return ('');
636 } else {
637 259 return $self->{'mut_number'};
638 }
639 }
640  
641  
642 =head2 SeqDiff
643  
644 Title : SeqDiff
645 Usage : $mutobj = $obj->SeqDiff;
646 : $mutobj = $obj->SeqDiff($objref);
647 Function:
648  
649 Returns or sets the link-reference to the umbrella
650 Bio::Variation::SeqDiff object. If there is no link,
651 it will return undef
652  
653 Note: Adding a variant into a SeqDiff object will
654 automatically set this value.
655  
656 Returns : an obj_ref or undef
657  
658 See L<Bio::Variation::SeqDiff> for more information.
659  
660 =cut
661  
662 157 ▶sub SeqDiff {
Subroutine SeqDiff: called CC=4 SCAR=14.2
Pod documented
663 157 my ($self,$value) = @_;
664 157 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 62 95 157
665 62 ▶ if( ! $value->isa('Bio::Variation::SeqDiff') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value->isa('Bio::Variation::SeqDiff')) { } 0 62 62
666 0 $self->throw("Is not a Bio::Variation::SeqDiff object but a [$value]");
667 0 return;
668 }
669 else {
670 62 $self->{'seqDiff'} = $value;
671 }
672 }
673 157 ▶ unless (exists $self->{'seqDiff'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'seqDiff'}) { } 150 7 157
674 7 return;
675 } else {
676 150 return $self->{'seqDiff'};
677 }
678 }
679  
680 =head2 add_DBLink
681  
682 Title : add_DBLink
683 Usage : $self->add_DBLink($ref)
684 Function: adds a link object
685 Example :
686 Returns :
687 Args :
688  
689  
690 =cut
691  
692  
693 0 ▶sub add_DBLink{
Subroutine add_DBLink: not called CC=4 SCAR=30.0
Pod documented
694 0 my ($self,$com) = @_;
695 0 ▶ if( $com && ! $com->isa('Bio::Annotation::DBLink') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($com and not $com->isa("Bio::Annotation::DBLink")) 0 0 0
Condition0%0/3
$com and not $com->isa("Bio::Annotation::DBLink")
!ll&&!rl&&r
000
MC/DC0%0/2
$com and not $com->isa("Bio::Annotation::DBLink")
$com not $com->isa("Bio::Annotation::DBLink")
Truth table0%0/3
A and not(B)
A= $comB= not $com->isa("Bio::Annotation::DBLink")
ABresult
0X0
100
111
696 0 $self->throw("Is not a link object but a [$com]");
697 }
698 0 ▶ $com && push(@{$self->{'link'}},$com);
Branch: 1 branch
BranchTrueFalseTotal
$com and push @{$$self{"link"};}, $com 0 0 0
699 }
700  
701 =head2 each_DBLink
702  
703 Title : each_DBLink
704 Usage : foreach $ref ( $self->each_DBlink() )
705 Function: gets an array of DBlink of objects
706 Example :
707 Returns :
708 Args :
709  
710  
711 =cut
712  
713 0 ▶sub each_DBLink{
Subroutine each_DBLink: not called CC=1 SCAR=6.9
Pod documented
714 0 my ($self) = @_;
715  
716 0 return @{$self->{'link'}};
717 }
718  
719 =head2 restriction_changes
720  
721 Title : restriction_changes
722 Usage : $obj->restriction_changes();
723 Function:
724  
725 Returns a string containing a list of restriction
726 enzyme changes of form +EcoRI, separated by
727 commas. Strings need to be valid restriction enzyme names
728 as stored in REBASE. allele_ori and allele_mut need to be assigned.
729  
730 Example :
731 Returns : string
732 Args : string
733  
734 =cut
735  
736 99 ▶sub restriction_changes {
Subroutine restriction_changes: called CC=20 SCAR=30.2
Pod documented
737 99 my ($self) = @_;
738  
739 99 ▶ if (not $self->{'re_changes'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"re_changes"}) 35 64 99
740 35 my %re = &_enzymes;
741  
742 # complain if used on AA data
743 35 ▶ if ($self->isa('Bio::Variation::AAChange')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa("Bio::Variation::AAChange")) 0 35 35
744 0 $self->throw('Restriction enzymes do not bite polypeptides!');
745 }
746  
747 #sanity checks
748 35 ▶ $self->warn('Upstream sequence is empty!')
Branch: 1 branch
BranchTrueFalseTotal
if $self->upStreamSeq eq "" 0 35 35
749 if $self->upStreamSeq eq '';
750 35 ▶ $self->warn('Downstream sequence is empty!')
Branch: 1 branch
BranchTrueFalseTotal
if $self->dnStreamSeq eq "" 0 35 35
751 if $self->dnStreamSeq eq '';
752 # $self->warn('Original allele sequence is empty!')
753 # if $self->allele_ori eq '';
754 # $self->warn('Mutated allele sequence is empty!')
755 # if $self->allele_mut eq '';
756  
757 #reuse the non empty DNA level list at RNA level if the flanks are identical
758 #Hint: Check DNAMutation object first
759 35 ▶ if ($self->isa('Bio::Variation::RNAChange') and $self->DNAMutation and
Branch: 1 branch
BranchTrueFalseTotal
if ($self->isa('Bio::Variation::RNAChange') and $self->DNAMutation and $self->upStreamSeq eq $self->DNAMutation->upStreamSeq and $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq and $self->DNAMutation->restriction_changes ne '') { } 15 20 35
Condition83%10/12
$self->isa("Bio::Variation::RNAChange") and $self->DNAMutation and $self->upStreamSeq eq $self->DNAMutation->upStreamSeq and $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq and $self->DNAMutation->restriction_changes ne ""
!ll&&!rl&&r
19115
$self->isa("Bio::Variation::RNAChange") and $self->DNAMutation and $self->upStreamSeq eq $self->DNAMutation->upStreamSeq and $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq
!ll&&!rl&&r
19016
$self->isa("Bio::Variation::RNAChange") and $self->DNAMutation and $self->upStreamSeq eq $self->DNAMutation->upStreamSeq
!ll&&!rl&&r
19016
$self->isa("Bio::Variation::RNAChange") and $self->DNAMutation
!ll&&!rl&&r
18116
MC/DC60%3/5
$self->isa("Bio::Variation::RNAChange") and $self->DNAMutation and $self->upStreamSeq eq $self->DNAMutation->upStreamSeq and $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq and $self->DNAMutation->restriction_changes ne ""
$self->isa("Bio::Variation::RNAChange") $self->DNAMutation $self->upStreamSeq eq $self->DNAMutation->upStreamSeq $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq $self->DNAMutation->restriction_changes ne ""
Truth table66%4/6
A and B and C and D and E
A= $self->isa("Bio::Variation::RNAChange")B= $self->DNAMutationC= $self->upStreamSeq eq $self->DNAMutation->upStreamSeqD= $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeqE= $self->DNAMutation->restriction_changes ne ""
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
760 $self->upStreamSeq eq $self->DNAMutation->upStreamSeq and
761 $self->dnStreamSeq eq $self->DNAMutation->dnStreamSeq and
762 $self->DNAMutation->restriction_changes ne '' ) {
763 15 $self->{'re_changes'} = $self->DNAMutation->restriction_changes;
764 } else {
765  
766 #maximum length of a type II restriction site in the current REBASE
767 20 my ($le_dn) = 15;
768 20 my ($le_up) = $le_dn;
769  
770 #reduce the flank lengths if the desired length is not available
771 20 ▶ $le_dn = CORE::length ($self->dnStreamSeq) if $le_dn > CORE::length ($self->dnStreamSeq);
Branch: 1 branch
BranchTrueFalseTotal
if $le_dn > CORE::length $self->dnStreamSeq 0 20 20
772 20 ▶ $le_up = CORE::length ($self->upStreamSeq) if $le_up > CORE::length ($self->upStreamSeq);
Branch: 1 branch
BranchTrueFalseTotal
if $le_up > CORE::length $self->upStreamSeq 0 20 20
773  
774 #Build sequence strings to compare
775 20 my ($oriseq, $mutseq);
776 20 $oriseq = $mutseq = substr($self->upStreamSeq, -$le_up, $le_up);
777 20 ▶ $oriseq .= $self->allele_ori->seq if $self->allele_ori->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $self->allele_ori->seq 18 2 20
778 20 ▶ $mutseq .= $self->allele_mut->seq if $self->allele_mut->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $self->allele_mut->seq 18 2 20
779 20 $oriseq .= substr($self->dnStreamSeq, 0, $le_dn);
780 20 $mutseq .= substr($self->dnStreamSeq, 0, $le_dn);
781  
782 # ... and their reverse complements
783 20 my $oriseq_rev = _revcompl ($oriseq);
784 20 my $mutseq_rev = _revcompl ($mutseq);
785  
786 # collect results into a string
787 20 my $rec = '';
788 20 foreach my $enz (sort keys (%re)) {
789 4520 my $site = $re{$enz};
790 4520 my @ori = ($oriseq=~ /$site/g);
791 4520 my @mut = ($mutseq=~ /$site/g);
792 4520 my @ori_r = ($oriseq_rev =~ /$site/g);
793 4520 my @mut_r = ($mutseq_rev =~ /$site/g);
794  
795 4520 ▶ $rec .= '+'. $enz. ", "
Branch: 1 branch
BranchTrueFalseTotal
if scalar @ori < scalar @mut or scalar @ori_r < scalar @mut_r 42 4478 4520
Condition100%3/3
scalar @ori < scalar @mut or scalar @ori_r < scalar @mut_r
l!l&&r!l&&!r
4114478
MC/DC100%2/2
scalar @ori < scalar @mut or scalar @ori_r < scalar @mut_r
scalar @ori < scalar @mut scalar @ori_r < scalar @mut_r
Truth table100%3/3
A or B
A= scalar @ori < scalar @mutB= scalar @ori_r < scalar @mut_r
ABresult
1X1
011
000
796 if (scalar @ori < scalar @mut) or (scalar @ori_r < scalar @mut_r);
797 4520 ▶ $rec .= '-'. $enz. ", "
Branch: 1 branch
BranchTrueFalseTotal
if scalar @ori > scalar @mut or scalar @ori_r > scalar @mut_r 38 4482 4520
Condition100%3/3
scalar @ori > scalar @mut or scalar @ori_r > scalar @mut_r
l!l&&r!l&&!r
24144482
MC/DC100%2/2
scalar @ori > scalar @mut or scalar @ori_r > scalar @mut_r
scalar @ori > scalar @mut scalar @ori_r > scalar @mut_r
Truth table100%3/3
A or B
A= scalar @ori > scalar @mutB= scalar @ori_r > scalar @mut_r
ABresult
1X1
011
000
798 if (scalar @ori > scalar @mut) or (scalar @ori_r > scalar @mut_r);
799  
800 }
801 20 ▶ $rec = substr($rec, 0, CORE::length($rec) - 2) if $rec ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $rec ne "" 17 3 20
802 20 $self->{'re_changes'} = $rec;
803 }
804 }
805 99 return $self->{'re_changes'}
806 }
807  
808  
809 40 ▶sub _revcompl {
Subroutine _revcompl: called CC=1 SCAR=0.0
810 # side effect: lower case letters
811 40 my ($seq) = shift;
812  
813 40 $seq = lc $seq;
814 40 $seq =~ tr/acgtrymkswhbvdnx/tgcayrkmswdvbhnx/;
815 40 return CORE::reverse $seq;
816 }
817  
818  
819 35 ▶sub _enzymes {
Subroutine _enzymes: called CC=1 SCAR=0.0
820 #REBASE version 005 type2.005
821 35 my %enzymes = (
822 'AarI' => 'cacctgc',
823 'AatII' => 'gacgtc',
824 'AccI' => 'gt[ac][gt]ac',
825 'AceIII' => 'cagctc',
826 'AciI' => 'ccgc',
827 'AclI' => 'aacgtt',
828 'AcyI' => 'g[ag]cg[ct]c',
829 'AflII' => 'cttaag',
830 'AflIII' => 'ac[ag][ct]gt',
831 'AgeI' => 'accggt',
832 'AhaIII' => 'tttaaa',
833 'AloI' => 'gaac[acgt][acgt][acgt][acgt][acgt][acgt]tcc',
834 'AluI' => 'agct',
835 'AlwNI' => 'cag[acgt][acgt][acgt]ctg',
836 'ApaBI' => 'gca[acgt][acgt][acgt][acgt][acgt]tgc',
837 'ApaI' => 'gggccc',
838 'ApaLI' => 'gtgcac',
839 'ApoI' => '[ag]aatt[ct]',
840 'AscI' => 'ggcgcgcc',
841 'AsuI' => 'gg[acgt]cc',
842 'AsuII' => 'ttcgaa',
843 'AvaI' => 'c[ct]cg[ag]g',
844 'AvaII' => 'gg[at]cc',
845 'AvaIII' => 'atgcat',
846 'AvrII' => 'cctagg',
847 'BaeI' => 'ac[acgt][acgt][acgt][acgt]gta[ct]c',
848 'BalI' => 'tggcca',
849 'BamHI' => 'ggatcc',
850 'BbvCI' => 'cctcagc',
851 'BbvI' => 'gcagc',
852 'BbvII' => 'gaagac',
853 'BccI' => 'ccatc',
854 'Bce83I' => 'cttgag',
855 'BcefI' => 'acggc',
856 'BcgI' => 'cga[acgt][acgt][acgt][acgt][acgt][acgt]tgc',
857 'BciVI' => 'gtatcc',
858 'BclI' => 'tgatca',
859 'BetI' => '[at]ccgg[at]',
860 'BfiI' => 'actggg',
861 'BglI' => 'gcc[acgt][acgt][acgt][acgt][acgt]ggc',
862 'BglII' => 'agatct',
863 'BinI' => 'ggatc',
864 'BmgI' => 'g[gt]gccc',
865 'BplI' => 'gag[acgt][acgt][acgt][acgt][acgt]ctc',
866 'Bpu10I' => 'cct[acgt]agc',
867 'BsaAI' => '[ct]acgt[ag]',
868 'BsaBI' => 'gat[acgt][acgt][acgt][acgt]atc',
869 'BsaXI' => 'ac[acgt][acgt][acgt][acgt][acgt]ctcc',
870 'BsbI' => 'caacac',
871 'BscGI' => 'cccgt',
872 'BseMII' => 'ctcag',
873 'BsePI' => 'gcgcgc',
874 'BseRI' => 'gaggag',
875 'BseSI' => 'g[gt]gc[ac]c',
876 'BsgI' => 'gtgcag',
877 'BsiI' => 'cacgag',
878 'BsiYI' => 'cc[acgt][acgt][acgt][acgt][acgt][acgt][acgt]gg',
879 'BsmAI' => 'gtctc',
880 'BsmI' => 'gaatgc',
881 'Bsp1407I' => 'tgtaca',
882 'Bsp24I' => 'gac[acgt][acgt][acgt][acgt][acgt][acgt]tgg',
883 'BspGI' => 'ctggac',
884 'BspHI' => 'tcatga',
885 'BspLU11I' => 'acatgt',
886 'BspMI' => 'acctgc',
887 'BspMII' => 'tccgga',
888 'BsrBI' => 'ccgctc',
889 'BsrDI' => 'gcaatg',
890 'BsrI' => 'actgg',
891 'BstEII' => 'ggt[acgt]acc',
892 'BstXI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt]tgg',
893 'BtrI' => 'cacgtc',
894 'BtsI' => 'gcagtg',
895 'Cac8I' => 'gc[acgt][acgt]gc',
896 'CauII' => 'cc[cg]gg',
897 'Cfr10I' => '[ag]ccgg[ct]',
898 'CfrI' => '[ct]ggcc[ag]',
899 'CjeI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt]gt',
900 'CjePI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt][acgt]tc',
901 'ClaI' => 'atcgat',
902 'CviJI' => '[ag]gc[ct]',
903 'CviRI' => 'tgca',
904 'DdeI' => 'ct[acgt]ag',
905 'DpnI' => 'gatc',
906 'DraII' => '[ag]gg[acgt]cc[ct]',
907 'DraIII' => 'cac[acgt][acgt][acgt]gtg',
908 'DrdI' => 'gac[acgt][acgt][acgt][acgt][acgt][acgt]gtc',
909 'DrdII' => 'gaacca',
910 'DsaI' => 'cc[ag][ct]gg',
911 'Eam1105I' => 'gac[acgt][acgt][acgt][acgt][acgt]gtc',
912 'EciI' => 'ggcgga',
913 'Eco31I' => 'ggtctc',
914 'Eco47III' => 'agcgct',
915 'Eco57I' => 'ctgaag',
916 'EcoNI' => 'cct[acgt][acgt][acgt][acgt][acgt]agg',
917 'EcoRI' => 'gaattc',
918 'EcoRII' => 'cc[at]gg',
919 'EcoRV' => 'gatatc',
920 'Esp3I' => 'cgtctc',
921 'EspI' => 'gct[acgt]agc',
922 'FauI' => 'cccgc',
923 'FinI' => 'gggac',
924 'Fnu4HI' => 'gc[acgt]gc',
925 'FnuDII' => 'cgcg',
926 'FokI' => 'ggatg',
927 'FseI' => 'ggccggcc',
928 'GdiII' => 'cggcc[ag]',
929 'GsuI' => 'ctggag',
930 'HaeI' => '[at]ggcc[at]',
931 'HaeII' => '[ag]gcgc[ct]',
932 'HaeIII' => 'ggcc',
933 'HaeIV' => 'ga[ct][acgt][acgt][acgt][acgt][acgt][ag]tc',
934 'HgaI' => 'gacgc',
935 'HgiAI' => 'g[at]gc[at]c',
936 'HgiCI' => 'gg[ct][ag]cc',
937 'HgiEII' => 'acc[acgt][acgt][acgt][acgt][acgt][acgt]ggt',
938 'HgiJII' => 'g[ag]gc[ct]c',
939 'HhaI' => 'gcgc',
940 'Hin4I' => 'ga[cgt][acgt][acgt][acgt][acgt][acgt][acg]tc',
941 'HindII' => 'gt[ct][ag]ac',
942 'HindIII' => 'aagctt',
943 'HinfI' => 'ga[acgt]tc',
944 'HpaI' => 'gttaac',
945 'HpaII' => 'ccgg',
946 'HphI' => 'ggtga',
947 'Hpy178III' => 'tc[acgt][acgt]ga',
948 'Hpy188I' => 'tc[acgt]ga',
949 'Hpy99I' => 'cg[at]cg',
950 'KpnI' => 'ggtacc',
951 'Ksp632I' => 'ctcttc',
952 'MaeI' => 'ctag',
953 'MaeII' => 'acgt',
954 'MaeIII' => 'gt[acgt]ac',
955 'MboI' => 'gatc',
956 'MboII' => 'gaaga',
957 'McrI' => 'cg[ag][ct]cg',
958 'MfeI' => 'caattg',
959 'MjaIV' => 'gt[acgt][acgt]ac',
960 'MluI' => 'acgcgt',
961 'MmeI' => 'tcc[ag]ac',
962 'MnlI' => 'cctc',
963 'MseI' => 'ttaa',
964 'MslI' => 'ca[ct][acgt][acgt][acgt][acgt][ag]tg',
965 'MstI' => 'tgcgca',
966 'MwoI' => 'gc[acgt][acgt][acgt][acgt][acgt][acgt][acgt]gc',
967 'NaeI' => 'gccggc',
968 'NarI' => 'ggcgcc',
969 'NcoI' => 'ccatgg',
970 'NdeI' => 'catatg',
971 'NheI' => 'gctagc',
972 'NlaIII' => 'catg',
973 'NlaIV' => 'gg[acgt][acgt]cc',
974 'NotI' => 'gcggccgc',
975 'NruI' => 'tcgcga',
976 'NspBII' => 'c[ac]gc[gt]g',
977 'NspI' => '[ag]catg[ct]',
978 'PacI' => 'ttaattaa',
979 'Pfl1108I' => 'tcgtag',
980 'PflMI' => 'cca[acgt][acgt][acgt][acgt][acgt]tgg',
981 'PleI' => 'gagtc',
982 'PmaCI' => 'cacgtg',
983 'PmeI' => 'gtttaaac',
984 'PpiI' => 'gaac[acgt][acgt][acgt][acgt][acgt]ctc',
985 'PpuMI' => '[ag]gg[at]cc[ct]',
986 'PshAI' => 'gac[acgt][acgt][acgt][acgt]gtc',
987 'PsiI' => 'ttataa',
988 'PstI' => 'ctgcag',
989 'PvuI' => 'cgatcg',
990 'PvuII' => 'cagctg',
991 'RleAI' => 'cccaca',
992 'RsaI' => 'gtac',
993 'RsrII' => 'cgg[at]ccg',
994 'SacI' => 'gagctc',
995 'SacII' => 'ccgcgg',
996 'SalI' => 'gtcgac',
997 'SanDI' => 'ggg[at]ccc',
998 'SapI' => 'gctcttc',
999 'SauI' => 'cct[acgt]agg',
1000 'ScaI' => 'agtact',
1001 'ScrFI' => 'cc[acgt]gg',
1002 'SduI' => 'g[agt]gc[act]c',
1003 'SecI' => 'cc[acgt][acgt]gg',
1004 'SexAI' => 'acc[at]ggt',
1005 'SfaNI' => 'gcatc',
1006 'SfeI' => 'ct[ag][ct]ag',
1007 'SfiI' => 'ggcc[acgt][acgt][acgt][acgt][acgt]ggcc',
1008 'SgfI' => 'gcgatcgc',
1009 'SgrAI' => 'c[ag]ccgg[ct]g',
1010 'SimI' => 'gggtc',
1011 'SmaI' => 'cccggg',
1012 'SmlI' => 'ct[ct][ag]ag',
1013 'SnaBI' => 'tacgta',
1014 'SnaI' => 'gtatac',
1015 'SpeI' => 'actagt',
1016 'SphI' => 'gcatgc',
1017 'SplI' => 'cgtacg',
1018 'SrfI' => 'gcccgggc',
1019 'Sse232I' => 'cgccggcg',
1020 'Sse8387I' => 'cctgcagg',
1021 'Sse8647I' => 'agg[at]cct',
1022 'SspI' => 'aatatt',
1023 'Sth132I' => 'cccg',
1024 'StuI' => 'aggcct',
1025 'StyI' => 'cc[at][at]gg',
1026 'SwaI' => 'atttaaat',
1027 'TaqI' => 'tcga',
1028 'TaqII' => 'gaccga',
1029 'TatI' => '[at]gtac[at]',
1030 'TauI' => 'gc[cg]gc',
1031 'TfiI' => 'ga[at]tc',
1032 'TseI' => 'gc[at]gc',
1033 'Tsp45I' => 'gt[cg]ac',
1034 'Tsp4CI' => 'ac[acgt]gt',
1035 'TspEI' => 'aatt',
1036 'TspRI' => 'ca[cg]tg[acgt][acgt]',
1037 'Tth111I' => 'gac[acgt][acgt][acgt]gtc',
1038 'Tth111II' => 'caa[ag]ca',
1039 'UbaGI' => 'cac[acgt][acgt][acgt][acgt]gtg',
1040 'UbaPI' => 'cgaacg',
1041 'VspI' => 'attaat',
1042 'XbaI' => 'tctaga',
1043 'XcmI' => 'cca[acgt][acgt][acgt][acgt][acgt][acgt][acgt][acgt][acgt]tgg',
1044 'XhoI' => 'ctcgag',
1045 'XhoII' => '[ag]gatc[ct]',
1046 'XmaIII' => 'cggccg',
1047 'XmnI' => 'gaa[acgt][acgt][acgt][acgt]ttc'
1048 );
1049  
1050 35 return %enzymes;
1051 }
1052  
1053 12 1;
« Variation/DNAMutation.pm ↑ Summary Variation/Allele.pm »