Variation/Allele.pm

filter: Statementstmt 58.9% 33 / 56 Branchbran 41.6% 15 / 36 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 60.0% 6 / 10 Podpod 100% 8 / 8 totaltotal 51.5% 66 / 128 CC 23 SCAR 20.2
CC
23
Cov
50%
count
12.0
frequency
12.0
repeat_count
9.4
CRAP 7.6
« Variation/VariantI.pm ↑ Summary Variation/AAReverseMutate.pm »
1 #
2 # BioPerl module for Bio::Variation::Allele
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::Allele - Sequence object with allele-specific attributes
17  
18 =head1 SYNOPSIS
19  
20 $allele1 = Bio::Variation::Allele->new ( -seq => 'A',
21 -id => 'AC00001.1',
22 -alphabet => 'dna',
23 -is_reference => 1
24 );
25  
26 =head1 DESCRIPTION
27  
28 List of alleles describe known sequence alternatives in a variable region.
29 Alleles are contained in Bio::Variation::VariantI complying objects.
30 See L<Bio::Variation::VariantI> for details.
31  
32 Bio::Varation::Alleles are PrimarySeqI complying objects which can
33 contain database cross references as specified in
34 Bio::DBLinkContainerI interface, too.
35  
36 A lot of the complexity with dealing with Allele objects are caused by
37 null alleles; Allele objects that have zero length sequence string.
38  
39 In addition describing the allele by its sequence , it possible to
40 give describe repeat structure within the sequence. This done using
41 methods repeat_unit (e.g. 'ca') and repeat_count (e.g. 7).
42  
43 =head1 FEEDBACK
44  
45 =head2 Mailing Lists
46  
47 User feedback is an integral part of the evolution of this and other
48 Bioperl modules. Send your comments and suggestions preferably to the
49 Bioperl mailing lists Your participation is much appreciated.
50  
51 bioperl-l@bioperl.org - General discussion
52 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
53  
54 =head2 Support
55  
56 Please direct usage questions or support issues to the mailing list:
57  
58 I<bioperl-l@bioperl.org>
59  
60 rather than to the module maintainer directly. Many experienced and
61 reponsive experts will be able look at the problem and quickly
62 address it. Please include a thorough description of the problem
63 with code and data examples if at all possible.
64  
65 =head2 Reporting Bugs
66  
67 Report bugs to the Bioperl bug tracking system to help us keep track
68 the bugs and their resolution. Bug reports can be submitted via the
69 web:
70  
71 https://github.com/bioperl/bioperl-live/issues
72  
73 =head1 AUTHOR - Heikki Lehvaslaiho
74  
75 Email: heikki-at-bioperl-dot-org
76  
77 =head1 APPENDIX
78  
79 The rest of the documentation details each of the object
80 methods. Internal methods are usually preceded with a _
81  
82 =cut
83  
84  
85 # Let the code begin...
86  
87 package Bio::Variation::Allele;
88 12 $Bio::Variation::Allele::VERSION = '1.7.5';
89 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
90  
91 # Object preamble - inheritance
92  
93  
94 12 ▶use base qw(Bio::PrimarySeq Bio::DBLinkContainerI);
Subroutine BEGIN: called CC=1 SCAR=0.0
95  
96 108 ▶sub new {
Subroutine new: called CC=4 SCAR=14.3
Pod documented
97 108 my($class, @args) = @_;
98 108 my $self = $class->SUPER::new(@args);
99  
100 108 my($is_reference, $repeat_unit, $repeat_count) =
101 $self->_rearrange([qw(IS_REFERENCE
102 REPEAT_UNIT
103 REPEAT_COUNT
104 )],
105 @args);
106  
107 108 ▶ $is_reference && $self->is_reference($is_reference);
Branch: 1 branch
BranchTrueFalseTotal
$is_reference and $self->is_reference($is_reference) 0 108 108
108 108 ▶ $repeat_unit && $self->repeat_unit($repeat_unit);
Branch: 1 branch
BranchTrueFalseTotal
$repeat_unit and $self->repeat_unit($repeat_unit) 0 108 108
109 108 ▶ $repeat_count && $self->repeat_count($repeat_count);
Branch: 1 branch
BranchTrueFalseTotal
$repeat_count and $self->repeat_count($repeat_count) 0 108 108
110  
111 108 return $self; # success - we hope!
112 }
113  
114  
115 =head2 is_reference
116  
117 Title : is_reference
118 Usage : $obj->is_reference()
119 Function: sets and returns boolean values.
120 Unset values return false.
121 Example : $obj->is_reference()
122 Returns : boolean
123 Args : optional true of false value
124  
125  
126 =cut
127  
128  
129 2 ▶sub is_reference {
Subroutine is_reference: called CC=4 SCAR=14.3
Pod documented
130 2 my ($self,$value) = @_;
131 2 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 1 1 2
132 1 ▶ $value ? ($value = 1) : ($value = 0);
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 1 0 1
133 1 $self->{'is_reference'} = $value;
134 }
135 2 ▶ if( ! exists $self->{'is_reference'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $self->{'is_reference'}) { } 0 2 2
136 0 return 0;
137 }
138 else {
139 2 return $self->{'is_reference'};
140 }
141 }
142  
143  
144 =head2 add_DBLink
145  
146 Title : add_DBLink
147 Usage : $self->add_DBLink($ref)
148 Function: adds a link object
149 Example :
150 Returns :
151 Args :
152  
153  
154 =cut
155  
156  
157 0 ▶sub add_DBLink{
Subroutine add_DBLink: not called CC=2 SCAR=17.9
Pod documented
158 0 my ($self,$com) = @_;
159 0 ▶ if( ! $com->isa('Bio::Annotation::DBLink') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($com->isa("Bio::Annotation::DBLink")) 0 0 0
160 0 $self->throw("Is not a link object but a [$com]");
161 }
162 0 push(@{$self->{'link'}},$com);
163 }
164  
165 =head2 each_DBLink
166  
167 Title : each_DBLink
168 Usage : foreach $ref ( $self->each_DBlink() )
169 Function: gets an array of DBlink of objects
170 Example :
171 Returns :
172 Args :
173  
174  
175 =cut
176  
177 0 ▶sub each_DBLink{
Subroutine each_DBLink: not called CC=1 SCAR=6.9
Pod documented
178 0 my ($self) = @_;
179 0 return @{$self->{'link'}};
180 }
181  
182 =head2 repeat_unit
183  
184 Title : repeat_unit
185 Usage : $obj->repeat_unit('ca');
186 Function:
187  
188 Sets and returns the sequence of the repeat_unit the
189 allele is composed of.
190  
191 Example :
192 Returns : string
193 Args : string
194  
195 =cut
196  
197 2 ▶sub repeat_unit {
Subroutine repeat_unit: called CC=6 SCAR=22.1
Pod documented
198 2 my ($self,$value) = @_;
199 2 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 1 1 2
200 1 $self->{'repeat_unit'} = $value;
201 }
202 2 ▶ if ($self->{'seq'} && $self->{'repeat_unit'} && $self->{'repeat_count'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"seq"} and $self->{"repeat_unit"} and $self->{"repeat_count"}) 0 2 2
Condition33%2/6
$self->{"seq"} and $self->{"repeat_unit"} and $self->{"repeat_count"}
!ll&&!rl&&r
020
$self->{"seq"} and $self->{"repeat_unit"}
!ll&&!rl&&r
002
MC/DC0%0/3
$self->{"seq"} and $self->{"repeat_unit"} and $self->{"repeat_count"}
$self->{"seq"} $self->{"repeat_unit"} $self->{"repeat_count"}
Truth table25%1/4
A and B and C
A= $self->{"seq"}B= $self->{"repeat_unit"}C= $self->{"repeat_count"}
ABCresult
0XX0
10X0
1100
1111
203 $self->warn("Repeats do not add up!")
204 0 ▶ if ( $self->{'repeat_unit'} x $self->{'repeat_count'}) ne $self->{'seq'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"repeat_unit"} x $self->{"repeat_count"} ne $self->{"seq"} 0 0 0
205 }
206 2 return $self->{'repeat_unit'};
207 }
208  
209 =head2 repeat_count
210  
211 Title : repeat_count
212 Usage : $obj->repeat_count();
213 Function:
214  
215 Sets and returns the number of repeat units in the allele.
216  
217 Example :
218 Returns : string
219 Args : string
220  
221 =cut
222  
223  
224 2 ▶sub repeat_count {
Subroutine repeat_count: called CC=7 SCAR=22.4
Pod documented
225 2 my ($self,$value) = @_;
226 2 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 1 1 2
227 1 ▶ if ( not $value =~ /^\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^\d+$/) { } 0 1 1
228 0 $self->throw("[$value] for repeat_count has to be a positive integer\n");
229 } else {
230 1 $self->{'repeat_count'} = $value;
231 }
232 }
233 2 ▶ if ($self->{'seq'} && $self->{'repeat_unit'} && $self->{'repeat_count'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"seq"} and $self->{"repeat_unit"} and $self->{"repeat_count"}) 2 0 2
Condition33%2/6
$self->{"seq"} and $self->{"repeat_unit"} and $self->{"repeat_count"}
!ll&&!rl&&r
002
$self->{"seq"} and $self->{"repeat_unit"}
!ll&&!rl&&r
002
MC/DC0%0/3
$self->{"seq"} and $self->{"repeat_unit"} and $self->{"repeat_count"}
$self->{"seq"} $self->{"repeat_unit"} $self->{"repeat_count"}
Truth table25%1/4
A and B and C
A= $self->{"seq"}B= $self->{"repeat_unit"}C= $self->{"repeat_count"}
ABCresult
0XX0
10X0
1100
1111
234 $self->warn("Repeats do not add up!")
235 2 ▶ if ( $self->{'repeat_unit'} x $self->{'repeat_count'}) ne $self->{'seq'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"repeat_unit"} x $self->{"repeat_count"} ne $self->{"seq"} 0 2 2
236 }
237 2 return $self->{'repeat_count'};
238 }
239  
240 =head2 count
241  
242 Title : count
243 Usage : $obj->count();
244 Function:
245  
246 Sets and returns the number of times this allele was observed.
247  
248 Example :
249 Returns : string
250 Args : string
251  
252 =cut
253  
254 0 ▶sub count {
Subroutine count: not called CC=3 SCAR=24.8
Pod documented
255 0 my ($self,$value) = @_;
256 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
257 0 ▶ if ( not $value =~ /^\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^\d+$/) { } 0 0 0
258 0 $self->throw("[$value] for count has to be a positive integer\n");
259 } else {
260 0 $self->{'count'} = $value;
261 }
262 }
263 0 return $self->{'count'};
264 }
265  
266  
267 =head2 frequency
268  
269 Title : frequency
270 Usage : $obj->frequency();
271 Function:
272  
273 Sets and returns the frequency of the allele in the observed
274 population.
275  
276 Example :
277 Returns : string
278 Args : string
279  
280 =cut
281  
282 0 ▶sub frequency {
Subroutine frequency: not called CC=3 SCAR=24.8
Pod documented
283 0 my ($self,$value) = @_;
284 0 ▶ if( defined $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value) 0 0 0
285 0 ▶ if ( not $value =~ /^\d+$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $value =~ /^\d+$/) { } 0 0 0
286 0 $self->throw("[$value] for frequency has to be a positive integer\n");
287 } else {
288 0 $self->{'frequency'} = $value;
289 }
290 }
291 0 return $self->{'frequency'};
292 }
293  
294  
295 12 1;
« Variation/VariantI.pm ↑ Summary Variation/AAReverseMutate.pm »