Variation/RNAChange.pm

filter: Statementstmt 85.3% 140 / 164 Branchbran 70.3% 114 / 162 Conditioncond 48.1% 39 / 81 MC/DCmcdc 22.7% 10 / 44 Subroutinesub 86.6% 13 / 15 Podpod 100% 11 / 11 totaltotal 68.5% 327 / 477 CC 109 SCAR 32.1
CC
109
Cov
72%
label
37.0
new
32.0
region
30.9
CRAP 24.8
« Variation/IO/flat.pm ↑ Summary Variation/DNAMutation.pm »
1 #
2 # BioPerl module for Bio::Variation::RNAChange
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::RNAChange - Sequence change class for RNA level
17  
18 =head1 SYNOPSIS
19  
20 $rnachange = Bio::Variation::RNAChange->new
21 ('-start' => $start,
22 '-end' => $end,
23 '-length' => $len,
24 '-codon_pos' => $cp,
25 '-upStreamSeq' => $upflank,
26 '-dnStreamSeq' => $dnflank,
27 '-proof' => $proof,
28 '-isMutation' => 1,
29 '-mut_number' => $mut_number
30 );
31 $a1 = Bio::Variation::Allele->new;
32 $a1->seq('a');
33 $rnachange->allele_ori($a1);
34 my $a2 = Bio::Variation::Allele->new;
35 $a2->seq('t');
36 $rnachange->add_Allele($a2);
37 $rnachange->allele_mut($a2);
38  
39 print "The codon change is ", $rnachange->codon_ori,
40 ">", $rnachange->codon_mut, "\n";
41  
42 # add it to a SeqDiff container object
43 $seqdiff->add_Variant($rnachange);
44  
45 # and create links to and from DNA level mutation objects
46 $rnachange->DNAMutation($dnamut);
47 $dnamut->RNAChange($rnachange);
48  
49 =head1 DESCRIPTION
50  
51 The instantiable class Bio::Variation::DNAMutation describes basic
52 sequence changes at RNA molecule level. It uses methods defined in
53 superclass Bio::Variation::VariantI. See L<Bio::Variation::VariantI>
54 for details.
55  
56 You are normally expected to create a corresponding
57 Bio::Variation::DNAMutation object even if mutation is defined at
58 RNA level. The numbering follows then cDNA numbering. Link the
59 DNAMutation object to the RNAChange object using the method
60 DNAMutation(). If the variation described by a RNAChange object is
61 translated, link the corresponding Bio::Variation::AAChange object
62 to it using method AAChange(). See L<Bio::Variation::DNAMutation> and
63 L<Bio::Variation::AAChange> for more information.
64  
65  
66 =head1 FEEDBACK
67  
68 =head2 Mailing Lists
69  
70 User feedback is an integral part of the evolution of this and other
71 Bioperl modules. Send your comments and suggestions preferably to the
72 Bioperl mailing lists Your participation is much appreciated.
73  
74 bioperl-l@bioperl.org - General discussion
75 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
76  
77  
78 =head2 Support
79  
80 Please direct usage questions or support issues to the mailing list:
81  
82 I<bioperl-l@bioperl.org>
83  
84 rather than to the module maintainer directly. Many experienced and
85 reponsive experts will be able look at the problem and quickly
86 address it. Please include a thorough description of the problem
87 with code and data examples if at all possible.
88  
89 =head2 Reporting Bugs
90  
91 Report bugs to the Bioperl bug tracking system to help us keep track
92 the bugs and their resolution. Bug reports can be submitted via the
93 web:
94  
95 https://github.com/bioperl/bioperl-live/issues
96  
97 =head1 AUTHOR - Heikki Lehvaslaiho
98  
99 Email: heikki-at-bioperl-dot-org
100  
101 =head1 APPENDIX
102  
103 The rest of the documentation details each of the object
104 methods. Internal methods are usually preceded with a _
105  
106 =cut
107  
108  
109 # Let the code begin...
110  
111  
112 package Bio::Variation::RNAChange;
113 7 $Bio::Variation::RNAChange::VERSION = '1.7.5';
114 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
115  
116 # Object preamble - inheritance
117  
118 7 ▶use Bio::Tools::CodonTable;
Subroutine BEGIN: called CC=1 SCAR=0.0
119  
120 7 ▶use base qw(Bio::Variation::VariantI);
Subroutine BEGIN: called CC=1 SCAR=0.0
121  
122 21 ▶sub new {
Subroutine new: called CC=28 SCAR=34.7
Pod documented
123 21 my($class,@args) = @_;
124 21 my $self = $class->SUPER::new(@args);
125  
126 21 my ($start, $end, $length, $strand, $primary, $source,
127 $frame, $score, $gff_string,
128 $allele_ori, $allele_mut, $upstreamseq, $dnstreamseq,
129 $label, $status, $proof, $region, $region_value, $region_dist, $numbering,
130 $mut_number, $isMutation,
131 $codon_ori, $codon_mut, $codon_pos, $codon_table, $cds_end) =
132 $self->_rearrange([qw(START
133 END
134 LENGTH
135 STRAND
136 PRIMARY
137 SOURCE
138 FRAME
139 SCORE
140 GFF_STRING
141 ALLELE_ORI
142 ALLELE_MUT
143 UPSTREAMSEQ
144 DNSTREAMSEQ
145 LABEL
146 STATUS
147 PROOF
148 REGION
149 REGION_VALUE
150 REGION_DIST
151 NUMBERING
152 MUT_NUMBER
153 ISMUTATION
154 CODON_ORI
155 CODON_MUT
156 CODON_POS
157 TRANSLATION_TABLE
158 CDS_END
159 )],@args);
160  
161 21 $self->primary_tag("Variation");
162  
163 21 $self->{ 'alleles' } = [];
164  
165 21 ▶ $start && $self->start($start);
Branch: 1 branch
BranchTrueFalseTotal
$start and $self->start($start) 17 4 21
166 21 ▶ $end && $self->end($end);
Branch: 1 branch
BranchTrueFalseTotal
$end and $self->end($end) 17 4 21
167 21 ▶ $length && $self->length($length);
Branch: 1 branch
BranchTrueFalseTotal
$length and $self->length($length) 17 4 21
168 21 ▶ $strand && $self->strand($strand);
Branch: 1 branch
BranchTrueFalseTotal
$strand and $self->strand($strand) 0 21 21
169 21 ▶ $primary && $self->primary_tag($primary);
Branch: 1 branch
BranchTrueFalseTotal
$primary and $self->primary_tag($primary) 0 21 21
170 21 ▶ $source && $self->source_tag($source);
Branch: 1 branch
BranchTrueFalseTotal
$source and $self->source_tag($source) 0 21 21
171 21 ▶ $frame && $self->frame($frame);
Branch: 1 branch
BranchTrueFalseTotal
$frame and $self->frame($frame) 0 21 21
172 21 ▶ $score && $self->score($score);
Branch: 1 branch
BranchTrueFalseTotal
$score and $self->score($score) 0 21 21
173 21 ▶ $gff_string && $self->_from_gff_string($gff_string);
Branch: 1 branch
BranchTrueFalseTotal
$gff_string and $self->_from_gff_string($gff_string) 0 21 21
174  
175 21 ▶ $allele_ori && $self->allele_ori($allele_ori);
Branch: 1 branch
BranchTrueFalseTotal
$allele_ori and $self->allele_ori($allele_ori) 0 21 21
176 21 ▶ $allele_mut && $self->allele_mut($allele_mut);
Branch: 1 branch
BranchTrueFalseTotal
$allele_mut and $self->allele_mut($allele_mut) 0 21 21
177 21 ▶ $upstreamseq && $self->upStreamSeq($upstreamseq);
Branch: 1 branch
BranchTrueFalseTotal
$upstreamseq and $self->upStreamSeq($upstreamseq) 17 4 21
178 21 ▶ $dnstreamseq && $self->dnStreamSeq($dnstreamseq);
Branch: 1 branch
BranchTrueFalseTotal
$dnstreamseq and $self->dnStreamSeq($dnstreamseq) 17 4 21
179  
180 21 ▶ $label && $self->label($label);
Branch: 1 branch
BranchTrueFalseTotal
$label and $self->label($label) 0 21 21
181 21 ▶ $status && $self->status($status);
Branch: 1 branch
BranchTrueFalseTotal
$status and $self->status($status) 0 21 21
182 21 ▶ $proof && $self->proof($proof);
Branch: 1 branch
BranchTrueFalseTotal
$proof and $self->proof($proof) 16 5 21
183 21 ▶ $region && $self->region($region);
Branch: 1 branch
BranchTrueFalseTotal
$region and $self->region($region) 0 21 21
184 21 ▶ $region_value && $self->region_value($region_value);
Branch: 1 branch
BranchTrueFalseTotal
$region_value and $self->region_value($region_value) 0 21 21
185 21 ▶ $region_dist && $self->region_dist($region_dist);
Branch: 1 branch
BranchTrueFalseTotal
$region_dist and $self->region_dist($region_dist) 0 21 21
186 21 ▶ $numbering && $self->numbering($numbering);
Branch: 1 branch
BranchTrueFalseTotal
$numbering and $self->numbering($numbering) 0 21 21
187 21 ▶ $mut_number && $self->mut_number($mut_number);
Branch: 1 branch
BranchTrueFalseTotal
$mut_number and $self->mut_number($mut_number) 16 5 21
188 21 ▶ $isMutation && $self->isMutation($isMutation);
Branch: 1 branch
BranchTrueFalseTotal
$isMutation and $self->isMutation($isMutation) 3 18 21
189  
190 21 ▶ $codon_ori && $self->codon_ori($codon_ori);
Branch: 1 branch
BranchTrueFalseTotal
$codon_ori and $self->codon_ori($codon_ori) 3 18 21
191 21 ▶ $codon_mut && $self->codon_mut($codon_mut);
Branch: 1 branch
BranchTrueFalseTotal
$codon_mut and $self->codon_mut($codon_mut) 3 18 21
192 21 ▶ $codon_pos && $self->codon_pos($codon_pos);
Branch: 1 branch
BranchTrueFalseTotal
$codon_pos and $self->codon_pos($codon_pos) 4 17 21
193 21 ▶ $codon_table && $self->codon_table($codon_table);
Branch: 1 branch
BranchTrueFalseTotal
$codon_table and $self->codon_table($codon_table) 0 21 21
194 21 ▶ $cds_end && $self->cds_end($cds_end);
Branch: 1 branch
BranchTrueFalseTotal
$cds_end and $self->cds_end($cds_end) 1 20 21
195 21 return $self; # success - we hope!
196 }
197  
198  
199 =head2 codon_ori
200  
201 Title : codon_ori
202 Usage : $obj->codon_ori();
203 Function:
204  
205 Sets and returns codon_ori triplet. If value is not set,
206 creates the codon triplet from the codon position and
207 flanking sequences. The string has to be three characters
208 long. The character content is not checked.
209  
210 Example :
211 Returns : string
212 Args : string
213  
214 =cut
215  
216 110 ▶sub codon_ori {
Subroutine codon_ori: called CC=12 SCAR=26.5
Pod documented
217 110 my ($self,$value) = @_;
218 110 ▶ if (defined $value) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $value) { } 3 107 110
elsif (not $self->{'codon_ori'}) { } 14 93 107
219 3 ▶ if (length $value != 3) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $value != 3) 0 3 3
220 0 $self->warn("Codon string \"$value\" is not three characters long");
221 }
222 3 $self->{'codon_ori'} = $value;
223 }
224 elsif (! $self->{'codon_ori'}) {
225 14 my $codon_ori = '';
226  
227 14 ▶ if ($self->region eq 'coding' && $self->start && $self->start >= 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->region eq "coding" and $self->start and $self->start >= 1) 14 0 14
Condition33%2/6
$self->region eq "coding" and $self->start and $self->start >= 1
!ll&&!rl&&r
0014
$self->region eq "coding" and $self->start
!ll&&!rl&&r
0014
MC/DC0%0/3
$self->region eq "coding" and $self->start and $self->start >= 1
$self->region eq "coding" $self->start $self->start >= 1
Truth table25%1/4
A and B and C
A= $self->region eq "coding"B= $self->startC= $self->start >= 1
ABCresult
0XX0
10X0
1100
1111
228  
229 14 ▶ $self->warn('Codon position is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->codon_pos 0 14 14
230 if not defined $self->codon_pos;
231 14 ▶ $self->warn('Upstream flanking sequence is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->upStreamSeq 0 14 14
232 if not defined $self->upStreamSeq;
233 14 ▶ $self->warn('Downstream flanking sequence is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->dnStreamSeq 0 14 14
234 if not defined $self->dnStreamSeq;
235  
236 14 my $cpos = $self->codon_pos;
237 14 $codon_ori = substr($self->upStreamSeq, -$cpos +1 , $cpos-1);
238 14 ▶ $codon_ori .= substr($self->allele_ori->seq, 0, 4-$cpos)
Branch: 1 branch
BranchTrueFalseTotal
if $self->allele_ori and $self->allele_ori->seq 11 3 14
Condition100%3/3
$self->allele_ori and $self->allele_ori->seq
!ll&&!rl&&r
1211
MC/DC100%2/2
$self->allele_ori and $self->allele_ori->seq
$self->allele_ori $self->allele_ori->seq
Truth table100%3/3
A and B
A= $self->allele_oriB= $self->allele_ori->seq
ABresult
0X0
100
111
239 if $self->allele_ori and $self->allele_ori->seq;
240 14 $codon_ori .= substr($self->dnStreamSeq, 0, 3-length($codon_ori));
241 }
242 14 $self->{'codon_ori'} = lc $codon_ori;
243 }
244 110 return $self->{'codon_ori'};
245 }
246  
247  
248 =head2 codon_mut
249  
250 Title : codon_mut
251 Usage : $obj->codon_mut();
252 Function:
253  
254 Sets and returns codon_mut triplet. If value is not
255 set, creates the codon triplet from the codon position and
256 flanking sequences. Return undef for other than point mutations.
257  
258 Example :
259 Returns : string
260 Args : string
261  
262 =cut
263  
264  
265 49 ▶sub codon_mut {
Subroutine codon_mut: called CC=15 SCAR=33.5
Pod documented
266 49 my ($self,$value) = @_;
267 49 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 3 46 49
268 3 ▶ if (length $value != 3 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $value != 3) 0 3 3
269 0 $self->warn("Codon string \"$value\" is not three characters long");
270 }
271 3 $self->{'codon_mut'} = $value;
272 }
273 else {
274 46 my $codon_mut = '';
275 46 ▶ if ($self->allele_ori->seq and $self->allele_mut->seq and
Branch: 1 branch
BranchTrueFalseTotal
if ($self->allele_ori->seq and $self->allele_mut->seq and length $self->allele_ori->seq == 1 and length $self->allele_mut->seq == 1 and $self->region eq "coding" and $self->start >= 1) 46 0 46
Condition33%5/15
$self->allele_ori->seq and $self->allele_mut->seq and length $self->allele_ori->seq == 1 and length $self->allele_mut->seq == 1 and $self->region eq "coding" and $self->start >= 1
!ll&&!rl&&r
0046
$self->allele_ori->seq and $self->allele_mut->seq and length $self->allele_ori->seq == 1 and length $self->allele_mut->seq == 1 and $self->region eq "coding"
!ll&&!rl&&r
0046
$self->allele_ori->seq and $self->allele_mut->seq and length $self->allele_ori->seq == 1 and length $self->allele_mut->seq == 1
!ll&&!rl&&r
0046
$self->allele_ori->seq and $self->allele_mut->seq and length $self->allele_ori->seq == 1
!ll&&!rl&&r
0046
$self->allele_ori->seq and $self->allele_mut->seq
!ll&&!rl&&r
0046
MC/DC0%0/6
$self->allele_ori->seq and $self->allele_mut->seq and length $self->allele_ori->seq == 1 and length $self->allele_mut->seq == 1 and $self->region eq "coding" and $self->start >= 1
$self->allele_ori->seq $self->allele_mut->seq length $self->allele_ori->seq == 1 length $self->allele_mut->seq == 1 $self->region eq "coding" $self->start >= 1
Truth table14%1/7
A and B and C and D and E and F
A= $self->allele_ori->seqB= $self->allele_mut->seqC= length $self->allele_ori->seq == 1D= length $self->allele_mut->seq == 1E= $self->region eq "coding"F= $self->start >= 1
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
276 CORE::length($self->allele_ori->seq) == 1 and
277 CORE::length($self->allele_mut->seq) == 1 and
278 $self->region eq 'coding' and $self->start >= 1) {
279  
280 46 ▶ $self->warn('Codon position is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->codon_pos 0 46 46
281 if not defined $self->codon_pos;
282 46 ▶ $self->warn('Upstream flanking sequnce is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->upStreamSeq 0 46 46
283 if not defined $self->upStreamSeq;
284 46 ▶ $self->warn('Downstream flanking sequnce is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->dnStreamSeq 0 46 46
285 if not defined $self->dnStreamSeq;
286 46 ▶ $self->throw('Mutated allele is not defined')
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->allele_mut 0 46 46
287 if not defined $self->allele_mut;
288  
289 46 my $cpos = $self->codon_pos;
290 46 $codon_mut = substr($self->upStreamSeq, -$cpos +1 , $cpos-1);
291 46 ▶ $codon_mut .= substr($self->allele_mut->seq, 0, 4-$cpos)
Branch: 1 branch
BranchTrueFalseTotal
if $self->allele_mut and $self->allele_mut->seq 46 0 46
Condition33%1/3
$self->allele_mut and $self->allele_mut->seq
!ll&&!rl&&r
0046
MC/DC0%0/2
$self->allele_mut and $self->allele_mut->seq
$self->allele_mut $self->allele_mut->seq
Truth table33%1/3
A and B
A= $self->allele_mutB= $self->allele_mut->seq
ABresult
0X0
100
111
292 if $self->allele_mut and $self->allele_mut->seq;
293 46 $codon_mut .= substr($self->dnStreamSeq, 0, 3-length($codon_mut));
294  
295 46 $self->{'codon_mut'} = lc $codon_mut;
296 }
297 }
298 49 return $self->{'codon_mut'};
299 }
300  
301  
302 =head2 codon_pos
303  
304 Title : codon_pos
305 Usage : $obj->codon_pos();
306 Function:
307  
308 Sets and returns the position of the mutation start in the
309 codon. If value is not set, returns false.
310  
311 Example :
312 Returns : 1,2,3
313 Args : none if get, the new value if set
314  
315 =cut
316  
317  
318 154 ▶sub codon_pos {
Subroutine codon_pos: called CC=3 SCAR=11.2
Pod documented
319 154 my ($self,$value) = @_;
320 154 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 18 136 154
321 18 ▶ if ( $value !~ /[123]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value =~ /[123]/) 0 18 18
322 0 $self->throw("'$value' is not a valid codon position");
323 }
324 18 $self->{'codon_pos'} = $value;
325 }
326 154 return $self->{'codon_pos'};
327 }
328  
329  
330 =head2 codon_table
331  
332 Title : codon_table
333 Usage : $obj->codon_table();
334 Function:
335  
336 Sets and returns the codon table id of the RNA
337 If value is not set, returns 1, 'universal' code, as the default.
338  
339 Example :
340 Returns : integer
341 Args : none if get, the new value if set
342  
343 =cut
344  
345  
346 77 ▶sub codon_table {
Subroutine codon_table: called CC=4 SCAR=14.0
Pod documented
347 77 my ($self,$value) = @_;
348 77 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 13 64 77
349 13 ▶ if ( not $value =~ /^\d$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^\d$/) { } 0 13 13
350 0 $self->throw("'$value' is not a valid codon table ID\n".
351 "Has to be a positive integer. Defaulting to 1\n");
352 } else {
353 13 $self->{'codon_table'} = $value;
354 }
355 }
356 77 ▶ if( ! exists $self->{'codon_table'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $self->{'codon_table'}) { } 10 67 77
357 10 return 1;
358 } else {
359 67 return $self->{'codon_table'};
360 }
361 }
362  
363  
364 =head2 DNAMutation
365  
366 Title : DNAMutation
367 Usage : $mutobj = $obj->DNAMutation;
368 : $mutobj = $obj->DNAMutation($objref);
369 Function: Returns or sets the link-reference to a mutation/change object.
370 If there is no link, it will return undef
371 Returns : an obj_ref or undef
372  
373 =cut
374  
375  
376 109 ▶sub DNAMutation {
Subroutine DNAMutation: called CC=4 SCAR=14.2
Pod documented
377 109 my ($self,$value) = @_;
378 109 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 16 93 109
379 16 ▶ if( ! $value->isa('Bio::Variation::DNAMutation') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value->isa('Bio::Variation::DNAMutation')) { } 0 16 16
380 0 $self->throw("Is not a Bio::Variation::DNAMutation object but a [$self]");
381 0 return;
382 }
383 else {
384 16 $self->{'DNAMutation'} = $value;
385 }
386 }
387 109 ▶ unless (exists $self->{'DNAMutation'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'DNAMutation'}) { } 108 1 109
388 1 return;
389 } else {
390 108 return $self->{'DNAMutation'};
391 }
392 }
393  
394  
395 =head2 AAChange
396  
397 Title : AAChange
398 Usage : $mutobj = $obj->AAChange;
399 : $mutobj = $obj->AAChange($objref);
400 Function: Returns or sets the link-reference to a mutation/change object.
401 If there is no link, it will return undef
402 Returns : an obj_ref or undef
403  
404 =cut
405  
406 61 ▶sub AAChange {
Subroutine AAChange: called CC=4 SCAR=14.2
Pod documented
407 61 my ($self,$value) = @_;
408 61 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 13 48 61
409 13 ▶ if( ! $value->isa('Bio::Variation::AAChange') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value->isa('Bio::Variation::AAChange')) { } 0 13 13
410 0 $self->throw("Is not a Bio::Variation::AAChange object but a [$self]");
411 0 return;
412 }
413 else {
414 13 $self->{'AAChange'} = $value;
415 }
416 }
417 61 ▶ unless (exists $self->{'AAChange'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'AAChange'}) { } 57 4 61
418 4 return;
419 } else {
420 57 return $self->{'AAChange'};
421 }
422 }
423  
424  
425 =head2 exons_modified
426  
427 Title : exons_modified
428 Usage : $modified = $obj->exons_modified;
429 : $modified = $obj->exons_modified(1);
430 Function: Returns or sets information (example: a simple boolean flag) about
431 the modification of exons as a result of a mutation.
432  
433 =cut
434  
435 0 ▶sub exons_modified {
Subroutine exons_modified: not called CC=2 SCAR=17.9
Pod documented
436 0 my ($self,$value)=@_;
437 0 ▶ if (defined($value)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
438 0 $self->{'exons_modified'}=$value;
439 }
440 0 return ($self->{'exons_modified'});
441 }
442  
443 =head2 region
444  
445 Title : region
446 Usage : $obj->region();
447 Function:
448  
449 Sets and returns the name of the sequence region type or
450 protein domain at this location. If value is not set,
451 returns false.
452  
453 Example :
454 Returns : string
455 Args : string
456  
457 =cut
458  
459  
460  
461 131 ▶sub region {
Subroutine region: called CC=14 SCAR=34.3
Pod documented
462 131 my ($self,$value) = @_;
463 131 ▶ if( defined $value) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $value) { } 19 112 131
elsif (not defined $self->{'region'}) { } 2 110 112
464 19 $self->{'region'} = $value;
465 }
466 elsif (not defined $self->{'region'}) {
467  
468 2 ▶ $self->warn('Mutation start position is not defined')
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->start and $self->verbose 0 2 2
Condition33%1/3
not defined $self->start and $self->verbose
!ll&&!rl&&r
200
MC/DC0%0/2
not defined $self->start and $self->verbose
not defined $self->start $self->verbose
Truth table33%1/3
not(A) and B
A= not defined $self->startB= $self->verbose
ABresult
0X0
100
111
469 if not defined $self->start and $self->verbose;
470 2 ▶ $self->warn('Mutation end position is not defined')
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->end and $self->verbose 0 2 2
Condition33%1/3
not defined $self->end and $self->verbose
!ll&&!rl&&r
200
MC/DC0%0/2
not defined $self->end and $self->verbose
not defined $self->end $self->verbose
Truth table33%1/3
not(A) and B
A= not defined $self->endB= $self->verbose
ABresult
0X0
100
111
471 if not defined $self->end and $self->verbose;
472 2 ▶ $self->warn('Length of the CDS is not defined, the mutation can be beyond coding region!')
Branch: 1 branch
BranchTrueFalseTotal
if not defined $self->cds_end and $self->verbose 0 2 2
Condition33%1/3
not defined $self->cds_end and $self->verbose
!ll&&!rl&&r
200
MC/DC0%0/2
not defined $self->cds_end and $self->verbose
not defined $self->cds_end $self->verbose
Truth table33%1/3
not(A) and B
A= not defined $self->cds_endB= $self->verbose
ABresult
0X0
100
111
473 if not defined $self->cds_end and $self->verbose;
474  
475 2 $self->region('coding');
476 2 ▶ if ($self->end && $self->end < 0 ){
Branch: 2 branches
BranchTrueFalseTotal
if ($self->end and $self->end < 0) { } 0 2 2
elsif ($self->start and $self->cds_end and $self->start > $self->cds_end) { } 0 2 2
Condition33%1/3
$self->end and $self->end < 0
!ll&&!rl&&r
020
MC/DC0%0/2
$self->end and $self->end < 0
$self->end $self->end < 0
Truth table33%1/3
A and B
A= $self->endB= $self->end < 0
ABresult
0X0
100
111
477 0 $self->region('5\'UTR');
478 }
479 ▶ elsif ($self->start && $self->cds_end && $self->start > $self->cds_end ) {
Condition33%2/6
$self->start and $self->cds_end and $self->start > $self->cds_end
!ll&&!rl&&r
020
$self->start and $self->cds_end
!ll&&!rl&&r
002
MC/DC0%0/3
$self->start and $self->cds_end and $self->start > $self->cds_end
$self->start $self->cds_end $self->start > $self->cds_end
Truth table25%1/4
A and B and C
A= $self->startB= $self->cds_endC= $self->start > $self->cds_end
ABCresult
0XX0
10X0
1100
1111
480 0 $self->region('3\'UTR');
481 }
482 }
483 131 return $self->{'region'};
484 }
485  
486 =head2 cds_end
487  
488 Title : cds_end
489 Usage : $cds_end = $obj->get_cds_end();
490 Function:
491  
492 Sets or returns the cds_end from the beginning of the DNA sequence
493 to the coordinate start used to describe variants.
494 Should be the location of the last nucleotide of the
495 terminator codon of the gene.
496  
497 Example :
498 Returns : value of cds_end, a scalar
499 Args :
500  
501 =cut
502  
503  
504  
505 9 ▶sub cds_end {
Subroutine cds_end: called CC=4 SCAR=14.0
Pod documented
506 9 my ($self, $value) = @_;
507 9 ▶ if (defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) { } 2 7 9
508 2 ▶ $self->warn("[$value] is not a good value for sequence position")
Branch: 1 branch
BranchTrueFalseTotal
unless $value =~ /^\d+$/ 0 2 2
509 if not $value =~ /^\d+$/ ;
510 2 $self->{'cds_end'} = $value;
511 } else {
512 7 ▶ $self->{'cds_end'} = $self->SeqDiff->cds_end if $self->SeqDiff;
Branch: 1 branch
BranchTrueFalseTotal
if $self->SeqDiff 0 7 7
513 }
514 9 return $self->{'cds_end'};
515 }
516  
517  
518 =head2 label
519  
520 Title : label
521 Usage : $obj->label();
522 Function:
523  
524 Sets and returns mutation event label(s). If value is not
525 set, or no argument is given returns false. Each
526 instantiable subclass of L<Bio::Variation::VariantI> needs
527 to implement this method. Valid values are listed in
528 'Mutation event controlled vocabulary' in
529 http://www.ebi.ac.uk/mutations/recommendations/mutevent.html.
530  
531 Example :
532 Returns : string
533 Args : string
534  
535 =cut
536  
537 49 ▶sub label {
Subroutine label: called CC=27 SCAR=36.1
Pod documented
538 49 my ($self) = @_;
539 49 my ($o, $m, $type);
540 49 ▶ $o = $self->allele_ori->seq if $self->allele_ori and $self->allele_ori->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $self->allele_ori and $self->allele_ori->seq 36 13 49
Condition100%3/3
$self->allele_ori and $self->allele_ori->seq
!ll&&!rl&&r
31036
MC/DC100%2/2
$self->allele_ori and $self->allele_ori->seq
$self->allele_ori $self->allele_ori->seq
Truth table100%3/3
A and B
A= $self->allele_oriB= $self->allele_ori->seq
ABresult
0X0
100
111
541 49 ▶ $m = $self->allele_mut->seq if $self->allele_mut and $self->allele_mut->seq;
Branch: 1 branch
BranchTrueFalseTotal
if $self->allele_mut and $self->allele_mut->seq 38 11 49
Condition100%3/3
$self->allele_mut and $self->allele_mut->seq
!ll&&!rl&&r
3838
MC/DC100%2/2
$self->allele_mut and $self->allele_mut->seq
$self->allele_mut $self->allele_mut->seq
Truth table100%3/3
A and B
A= $self->allele_mutB= $self->allele_mut->seq
ABresult
0X0
100
111
542  
543 49 my $ct = Bio::Tools::CodonTable -> new ( -id => $self->codon_table );
544 49 ▶ if ($o and $m and CORE::length($o) == 1 and CORE::length($m) == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o and $m and length $o == 1 and length $m == 1) { } 22 27 49
Condition88%8/9
$o and $m and length $o == 1 and length $m == 1
!ll&&!rl&&r
27022
$o and $m and length $o == 1
!ll&&!rl&&r
21622
$o and $m
!ll&&!rl&&r
13828
MC/DC75%3/4
$o and $m and length $o == 1 and length $m == 1
$o $m length $o == 1 length $m == 1
Truth table80%4/5
A and B and C and D
A= $oB= $mC= length $o == 1D= length $m == 1
ABCDresult
0XXX0
10XX0
110X0
11100
11111
545 22 ▶ if (defined $self->AAChange) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->AAChange) { } 18 4 22
546 18 ▶ if ($self->start > 0 and $self->start < 4 ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($self->start > 0 and $self->start < 4) { } 0 18 18
elsif ($self->codon_ori and $ct->is_ter_codon($self->codon_ori)) { } 0 18 18
elsif ($self->codon_mut and $ct->is_ter_codon($self->codon_mut)) { } 5 13 18
elsif ($o and $m and $o eq $m || $self->AAChange->allele_ori->seq eq $self->AAChange->allele_mut->seq) { } 0 13 13
Condition33%1/3
$self->start > 0 and $self->start < 4
!ll&&!rl&&r
0180
MC/DC0%0/2
$self->start > 0 and $self->start < 4
$self->start > 0 $self->start < 4
Truth table33%1/3
A and B
A= $self->start > 0B= $self->start < 4
ABresult
0X0
100
111
547 0 $type = 'initiation codon';
548 }
549 ▶ elsif ($self->codon_ori && $ct->is_ter_codon($self->codon_ori) ) {
Condition33%1/3
$self->codon_ori and $ct->is_ter_codon($self->codon_ori)
!ll&&!rl&&r
0180
MC/DC0%0/2
$self->codon_ori and $ct->is_ter_codon($self->codon_ori)
$self->codon_ori $ct->is_ter_codon($self->codon_ori)
Truth table33%1/3
A and B
A= $self->codon_oriB= $ct->is_ter_codon($self->codon_ori)
ABresult
0X0
100
111
550 #AAChange->allele_ori and $self->AAChange->allele_ori->seq eq '*' ) {
551 0 $type = 'termination codon';
552 }
553 ▶ elsif ($self->codon_mut && $ct->is_ter_codon($self->codon_mut) ) {
Condition66%2/3
$self->codon_mut and $ct->is_ter_codon($self->codon_mut)
!ll&&!rl&&r
0135
MC/DC50%1/2
$self->codon_mut and $ct->is_ter_codon($self->codon_mut)
$self->codon_mut $ct->is_ter_codon($self->codon_mut)
Truth table66%2/3
A and B
A= $self->codon_mutB= $ct->is_ter_codon($self->codon_mut)
ABresult
0X0
100
111
554 #elsif ($self->AAChange->allele_mut and $self->AAChange->allele_mut->seq eq "*") {
555 5 $type = 'nonsense';
556 }
557 ▶ elsif ($o and $m and ($o eq $m or
Condition33%3/9
$o and $m and $o eq $m || $self->AAChange->allele_ori->seq eq $self->AAChange->allele_mut->seq
!ll&&!rl&&r
0130
$o and $m
!ll&&!rl&&r
0013
$o eq $m or $self->AAChange->allele_ori->seq eq $self->AAChange->allele_mut->seq
l!l&&r!l&&!r
0013
MC/DC0%0/4
$o and $m and $o eq $m || $self->AAChange->allele_ori->seq eq $self->AAChange->allele_mut->seq
$o $m $o eq $m $self->AAChange->allele_ori->seq eq $self->AAChange->allele_mut->seq
Truth table20%1/5
A and B and C or D
A= $oB= $mC= $o eq $mD= $self->AAChange->allele_ori->seq eq $self->AAChange->allele_mut->seq
ABCDresult
0XXX0
10XX0
11000
111X1
11011
558 $self->AAChange->allele_ori->seq eq
559 $self->AAChange->allele_mut->seq)) {
560 0 $type = 'silent';
561 } else {
562 13 $type = 'missense';
563 }
564 } else {
565 4 $type = 'unknown';
566 }
567 } else {
568 27 my $len = 0;
569 27 ▶ $len = CORE::length($o) if $o;
Branch: 1 branch
BranchTrueFalseTotal
if $o 14 13 27
570 27 ▶ $len -= CORE::length($m) if $m;
Branch: 1 branch
BranchTrueFalseTotal
if $m 16 11 27
571 27 ▶ if ($len%3 == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len % 3 == 0) { } 12 15 27
572 12 $type = 'inframe';
573 } else {
574 15 $type = 'frameshift';
575 }
576 27 ▶ if (not $m ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $m) { } 11 16 27
elsif (not $o) { } 10 6 16
577 11 $type .= ', '. 'deletion';
578 }
579 elsif (not $o ) {
580 10 $type .= ', '. 'insertion';
581 }
582 else {
583 6 $type .= ', '. 'complex';
584 }
585 27 ▶ if ($self->codon_ori && $ct->is_ter_codon($self->codon_ori) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->codon_ori and $ct->is_ter_codon($self->codon_ori)) 0 27 27
Condition33%1/3
$self->codon_ori and $ct->is_ter_codon($self->codon_ori)
!ll&&!rl&&r
0270
MC/DC0%0/2
$self->codon_ori and $ct->is_ter_codon($self->codon_ori)
$self->codon_ori $ct->is_ter_codon($self->codon_ori)
Truth table33%1/3
A and B
A= $self->codon_oriB= $ct->is_ter_codon($self->codon_ori)
ABresult
0X0
100
111
586 0 $type .= ', '. 'termination codon';
587 }
588 }
589  
590 49 $self->{'label'} = $type;
591 49 return $self->{'label'};
592 }
593  
594  
595 =head2 _change_codon_pos
596  
597 Title : _change_codon_pos
598 Usage : $newCodonPos = _change_codon_pos($myCodonPos, 5)
599 Function:
600  
601 Keeps track of the codon position in a changeing sequence
602  
603 Returns : codon_pos = integer 1, 2 or 3
604 Args : valid codon position
605 signed integer offset to a new location in sequence
606  
607 =cut
608  
609  
610 0 ▶sub _change_codon_pos ($$) {
Subroutine _change_codon_pos: not called CC=3 SCAR=24.8
611 0 my ($cpos, $i) = @_;
612  
613 0 $cpos = ($cpos + $i%3)%3;
614 0 ▶ if ($cpos > 3 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($cpos > 3) { } 0 0 0
elsif ($cpos < 1) { } 0 0 0
615 0 $cpos = $cpos - 3;
616 }
617 elsif ($cpos < 1 ) {
618 0 $cpos = $cpos + 3;
619 }
620 0 return $cpos;
621 }
622  
623 7 1;
« Variation/IO/flat.pm ↑ Summary Variation/DNAMutation.pm »