BioPerl
view release on metacpan or search on metacpan
Bio/SeqEvolution/Factory.pm view on Meta::CPAN
Returns : an array of sequences mutated from the reference sequence
according to evolutionary parameters given
Args : -
=cut
sub each_seq{
my $self = shift;
my $number = shift;
$self->throw("[$number] ". ' should be a positive integer')
unless $number =~ /^[+\d]+$/;
my @array;
for (my $count=1; $count<$number; $count++) {
push @array, $self->next_seq();
}
return @array;
}
=head2 each_mutation
Title : each_mutation
Usage : $obj->each_mutation
Function: return the mutations leading to the last generated
sequence in objects
Returns : an array of Bio::Variation::DNAMutation objects
Args : optional argument to return an array of stringified names
=cut
sub each_mutation {
my $self = shift;
my $string = shift;
return @{$self->{'_mutations'}} if $string;
return map {
/(\d+)(\w*)>(\w*)/;
# print;
my $dnamut = Bio::Variation::DNAMutation->new
('-start' => $1,
'-end' => $1,
'-length' => 1,
'-isMutation' => 1
);
$dnamut->allele_ori( Bio::Variation::Allele->new(-seq => $2,
-alphabet => 'dna') );
$dnamut->add_Allele( Bio::Variation::Allele->new(-seq => $3,
-alphabet => 'dna') );
$dnamut;
} @{$self->{'_mutations'}}
}
sub get_alignment_identity {
my $self = shift;
return $self->{'_align'}->overall_percentage_identity;
}
sub get_alignmet {
my $self = shift;
return $self->{'_align'}->remove_gaps('-', 'all-gaps');
}
=head1 Internal methods
=cut
=head2 _increase_mutation_counter
Title : _increase_mutation_counter
Usage : $obj->_increase_mutation_counter()
Function: Internal method to increase the counter of mutations performed
Returns : value of counter
Args : -
=cut
sub _increase_mutation_counter{
return shift->{'_mutation_counter'}++;
}
=head2 _increase_sequence_counter
Title : _increase_sequence_counter
Usage : $obj->_increase_sequence_counter()
Function: Internal method to increase the counter of sequences created
Returns : value of counter
Args : -
=cut
sub _increase_sequence_counter{
return shift->{'_sequence_counter'}++;
}
1;
( run in 0.388 second using v1.01-cache-2.11-cpan-39bf76dae61 )