2 # BioPerl module for Bio::Variation::AAReverseMutate
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::AAReverseMutate - point mutation and codon
17 information from single amino acid changes
21 $aamut = Bio::Variation::AAReverseMutate->new
24 -codon_ori => 'ttc', # optional
25 -codon_table => '3' # defaults to 1
28 @points = $aamut->each_Variant;
30 if (scalar @points > 0 ) {
31 foreach $rnachange ( @points ) {
32 # $rnachange is a Bio::Variation::RNAChange object
33 print " ", $rnachange->allele_ori->seq, ">",
34 $rnachange->allele_mut->seq, " in ",
35 $rnachange->codon_ori, ">", $rnachange->codon_mut,
36 " at position ", $rnachange->codon_pos, "\n";
39 print "No point mutations possible\n",
44 Bio::Variation::AAReverseMutate objects take in reference and mutated
45 amino acid information and deduces potential point mutations at RNA
46 level leading to this change. The choice can be further limited by
47 letting the object know what is the the codon in the reference
48 sequence. The results are returned as L<Bio::Variation::RNAChange>
55 User feedback is an integral part of the evolution of this and other
56 Bioperl modules. Send your comments and suggestions preferably to the
57 Bioperl mailing lists Your participation is much appreciated.
59 bioperl-l@bioperl.org - General discussion
60 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
64 Please direct usage questions or support issues to the mailing list:
66 I<bioperl-l@bioperl.org>
68 rather than to the module maintainer directly. Many experienced and
69 reponsive experts will be able look at the problem and quickly
70 address it. Please include a thorough description of the problem
71 with code and data examples if at all possible.
75 Report bugs to the Bioperl bug tracking system to help us keep track
76 the bugs and their resolution. Bug reports can be submitted via the
79 https://github.com/bioperl/bioperl-live/issues
81 =head1 AUTHOR - Heikki Lehvaslaiho
83 Email: heikki-at-bioperl-dot-org
87 The rest of the documentation details each of the object
88 methods. Internal methods are usually preceded with a _
93 # Let the code begin...
95 package Bio
::Variation
::AAReverseMutate
;
99 # Object preamble - inheritance
100 use Bio
::Tools
::CodonTable
;
101 use Bio
::Variation
::RNAChange
;
102 use Bio
::Variation
::Allele
;
104 use base
qw(Bio::Root::Root);
107 my($class,@args) = @_;
108 my $self = $class->SUPER::new
(@args);
110 my ($aa_ori, $aa_mut, $codon_ori, $codon_table) =
111 $self->_rearrange([qw(AA_ORI
117 $aa_ori && $self->aa_ori($aa_ori);
118 $aa_mut && $self->aa_mut($aa_mut);
119 $codon_ori && $self->codon_ori($codon_ori);
120 $codon_table && $self->codon_table($codon_table);
122 return $self; # success - we hope!
130 Usage : $obj->aa_ori();
133 Sets and returns original aa sequence. If value is not
136 Amino acid sequences are stored in upper case characters,
137 others in lower case.
141 Args : single character amino acid code
146 my ($self,$value) = @_;
147 if( defined $value) {
148 if ( uc($value) !~ /^[ARNDCQEGHILKMFPSTWYVBZX*]$/ ) {
149 $self->throw("'$value' is not a valid one letter amino acid symbol\n");
151 $self->{'aa_ori'} = uc $value;
154 return $self->{'aa_ori'};
161 Usage : $obj->aa_mut();
164 Sets and returns the mutated allele sequence. If value is not
169 Args : single character amino acid code
175 my ($self,$value) = @_;
176 if( defined $value) {
177 if ( uc($value) !~ /^[ARNDCQEGHILKMFPSTWYVBZX*]$/ ) {
178 $self->throw("'$value' is not a valid one letter amino acid symbol\n");
180 $self->{'aa_mut'} = uc $value;
183 return $self->{'aa_mut'};
190 Usage : $obj->codon_ori();
193 Sets and returns codon_ori triplet. If value is not set,
194 returns false. The string has to be three characters
195 long. The character content is not checked.
204 my ($self,$value) = @_;
205 if( defined $value) {
206 if (length $value != 3 or lc $value =~ /[^atgc]/) {
207 $self->warn("Codon string \"$value\" is not valid unique codon");
209 $self->{'codon_ori'} = lc $value;
211 return $self->{'codon_ori'};
217 Usage : $obj->codon_table();
220 Sets and returns the codon table id of the RNA
221 If value is not set, returns 1, 'universal' code, as the default.
225 Args : none if get, the new value if set
231 my ($self,$value) = @_;
232 if( defined $value) {
233 if ( not $value =~ /^\d+$/ ) {
234 $self->throw("'$value' is not a valid codon table ID\n".
235 "Has to be a positive integer. Defaulting to 1\n");
237 $self->{'codon_table'} = $value;
240 if( ! exists $self->{'codon_table'} ) {
243 return $self->{'codon_table'};
251 Usage : $obj->each_Variant();
254 Returns a list of Variants.
257 Returns : list of Variants
263 my ($self,@args) = @_;
265 $self->throw("aa_ori is not defined\n") if not defined $self->aa_ori;
266 $self->throw("aa_mut is not defined\n") if not defined $self->aa_mut;
268 my (@points, $codon_pos, $allele_ori, $allele_mut);
269 my $ct = Bio
::Tools
::CodonTable
->new( '-id' => $self->codon_table );
270 foreach my $codon_ori ($ct->revtranslate($self->aa_ori)) {
271 next if $self->codon_ori and $self->codon_ori ne $codon_ori;
272 foreach my $codon_mut ($ct->revtranslate($self->aa_mut)) {
275 $codon_pos = $allele_ori = $allele_mut = undef;
277 my $nt_ori = substr ($codon_ori, $k, 1);
278 my $nt_mut = substr ($codon_mut, $k, 1);
279 if ($nt_ori ne $nt_mut) {
282 $allele_ori = $nt_ori;
283 $allele_mut = $nt_mut;
288 my $rna = Bio
::Variation
::RNAChange
->new
290 '-codon_ori' => $codon_ori,
291 '-codon_mut' => $codon_mut,
292 '-codon_pos' => $codon_pos,
295 my $all_ori = Bio
::Variation
::Allele
->new('-seq'=>$allele_ori);
296 $rna->allele_ori($all_ori);
297 my $all_mut = Bio
::Variation
::Allele
->new('-seq'=>$allele_mut);
298 $rna->allele_mut($all_mut);