2 # BioPerl module for Bio::Variation::Allele
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Heikki Lehvaslaiho <heikki-at-bioperl-dot-org>
8 # Copyright Heikki Lehvaslaiho
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
16 Bio::Variation::Allele - Sequence object with allele-specific attributes
20 $allele1 = Bio::Variation::Allele->new ( -seq => 'A',
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.
32 Bio::Varation::Alleles are PrimarySeqI complying objects which can
33 contain database cross references as specified in
34 Bio::DBLinkContainerI interface, too.
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.
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).
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.
51 bioperl-l@bioperl.org - General discussion
52 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
56 Please direct usage questions or support issues to the mailing list:
58 I<bioperl-l@bioperl.org>
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.
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
71 https://github.com/bioperl/bioperl-live/issues
73 =head1 AUTHOR - Heikki Lehvaslaiho
75 Email: heikki-at-bioperl-dot-org
79 The rest of the documentation details each of the object
80 methods. Internal methods are usually preceded with a _
85 # Let the code begin...
87 package Bio
::Variation
::Allele
;
91 # Object preamble - inheritance
94 use base
qw(Bio::PrimarySeq Bio::DBLinkContainerI);
97 my($class, @args) = @_;
98 my $self = $class->SUPER::new
(@args);
100 my($is_reference, $repeat_unit, $repeat_count) =
101 $self->_rearrange([qw(IS_REFERENCE
107 $is_reference && $self->is_reference($is_reference);
108 $repeat_unit && $self->repeat_unit($repeat_unit);
109 $repeat_count && $self->repeat_count($repeat_count);
111 return $self; # success - we hope!
118 Usage : $obj->is_reference()
119 Function: sets and returns boolean values.
120 Unset values return false.
121 Example : $obj->is_reference()
123 Args : optional true of false value
130 my ($self,$value) = @_;
131 if( defined $value) {
132 $value ?
($value = 1) : ($value = 0);
133 $self->{'is_reference'} = $value;
135 if( ! exists $self->{'is_reference'} ) {
139 return $self->{'is_reference'};
147 Usage : $self->add_DBLink($ref)
148 Function: adds a link object
158 my ($self,$com) = @_;
159 if( ! $com->isa('Bio::Annotation::DBLink') ) {
160 $self->throw("Is not a link object but a [$com]");
162 push(@
{$self->{'link'}},$com);
168 Usage : foreach $ref ( $self->each_DBlink() )
169 Function: gets an array of DBlink of objects
179 return @
{$self->{'link'}};
185 Usage : $obj->repeat_unit('ca');
188 Sets and returns the sequence of the repeat_unit the
189 allele is composed of.
198 my ($self,$value) = @_;
199 if( defined $value) {
200 $self->{'repeat_unit'} = $value;
202 if ($self->{'seq'} && $self->{'repeat_unit'} && $self->{'repeat_count'} ) {
203 $self->warn("Repeats do not add up!")
204 if ( $self->{'repeat_unit'} x
$self->{'repeat_count'}) ne $self->{'seq'};
206 return $self->{'repeat_unit'};
212 Usage : $obj->repeat_count();
215 Sets and returns the number of repeat units in the allele.
225 my ($self,$value) = @_;
226 if( defined $value) {
227 if ( not $value =~ /^\d+$/ ) {
228 $self->throw("[$value] for repeat_count has to be a positive integer\n");
230 $self->{'repeat_count'} = $value;
233 if ($self->{'seq'} && $self->{'repeat_unit'} && $self->{'repeat_count'} ) {
234 $self->warn("Repeats do not add up!")
235 if ( $self->{'repeat_unit'} x
$self->{'repeat_count'}) ne $self->{'seq'};
237 return $self->{'repeat_count'};
243 Usage : $obj->count();
246 Sets and returns the number of times this allele was observed.
255 my ($self,$value) = @_;
256 if( defined $value) {
257 if ( not $value =~ /^\d+$/ ) {
258 $self->throw("[$value] for count has to be a positive integer\n");
260 $self->{'count'} = $value;
263 return $self->{'count'};
270 Usage : $obj->frequency();
273 Sets and returns the frequency of the allele in the observed
283 my ($self,$value) = @_;
284 if( defined $value) {
285 if ( not $value =~ /^\d+$/ ) {
286 $self->throw("[$value] for frequency has to be a positive integer\n");
288 $self->{'frequency'} = $value;
291 return $self->{'frequency'};