File Coverage

blib/lib/Bio/MUST/Core/GeneticCode.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition 2 3 66.6
subroutine 7 7 100.0
pod 1 1 100.0
total 33 34 97.0


line stmt bran cond sub pod time code
1             package Bio::MUST::Core::GeneticCode;
2             # ABSTRACT: Genetic code for conceptual translation
3             $Bio::MUST::Core::GeneticCode::VERSION = '0.212530';
4 17     17   11879 use Moose;
  17         54  
  17         122  
5 17     17   122768 use namespace::autoclean;
  17         45  
  17         149  
6              
7 17     17   1598 use autodie;
  17         49  
  17         133  
8 17     17   93275 use feature qw(say);
  17         56  
  17         1468  
9              
10 17     17   196 use Bio::MUST::Core::Constants qw(:gaps);
  17         63  
  17         2935  
11 17     17   153 use aliased 'Bio::MUST::Core::Seq';
  17         45  
  17         140  
12              
13              
14             has 'ncbi_id' => (
15             is => 'ro',
16             isa => 'Str',
17             required => 1,
18             );
19              
20             # _code private hash for translation
21             has '_code' => (
22             traits => ['Hash'],
23             is => 'ro',
24             isa => 'HashRef[Str]',
25             required => 1,
26             handles => {
27             aa_for => 'get',
28             amino_acid_for => 'get',
29             },
30             );
31              
32              
33              
34             sub translate { ## no critic (RequireArgUnpacking)
35 5     5 1 51 my $self = shift;
36 5         15 my $seq = shift;
37              
38             return Seq->new(
39             seq_id => $seq->full_id, # clone seq_id
40             seq => join q{}, map {
41 1491   66     53525 $self->aa_for(uc $_) // $FRAMESHIFT
42 5         48 } @{ $seq->codons(@_) }
  5         44  
43             ); # specify frame through currying
44             }
45              
46             __PACKAGE__->meta->make_immutable;
47             1;
48              
49             __END__
50              
51             =pod
52              
53             =head1 NAME
54              
55             Bio::MUST::Core::GeneticCode - Genetic code for conceptual translation
56              
57             =head1 VERSION
58              
59             version 0.212530
60              
61             =head1 SYNOPSIS
62              
63             # TODO
64              
65             =head1 DESCRIPTION
66              
67             # TODO
68              
69             =head1 METHODS
70              
71             =head2 translate
72              
73             =head1 AUTHOR
74              
75             Denis BAURAIN <denis.baurain@uliege.be>
76              
77             =head1 COPYRIGHT AND LICENSE
78              
79             This software is copyright (c) 2013 by University of Liege / Unit of Eukaryotic Phylogenomics / Denis BAURAIN.
80              
81             This is free software; you can redistribute it and/or modify it under
82             the same terms as the Perl 5 programming language system itself.
83              
84             =cut