AlignDB-Codon
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/AlignDB/Codon.pm view on Meta::CPAN
package AlignDB::Codon;
use Moose;
use Carp;
use AlignDB::IntSpan;
use List::MoreUtils::PP;
use YAML::Syck;
our $VERSION = '1.1.1';
# codon tables
has 'table_id' => ( is => 'ro', isa => 'Int', default => sub {1}, );
has 'table_name' => ( is => 'ro', isa => 'Str', );
has 'table_content' => ( is => 'ro', isa => 'Str', );
has 'table_starts' => ( is => 'ro', isa => 'Str', );
# codons
has 'codons' => ( is => 'ro', isa => 'ArrayRef', );
has 'codon_idx' => ( is => 'ro', isa => 'HashRef', );
has 'codon2aa' => ( is => 'ro', isa => 'HashRef', );
# lookup hash for the number of synonymous changes per codon
has 'syn_sites' => ( is => 'ro', isa => 'HashRef', );
# lookup hash of all pairwise combinations of codons differing by 1
# 1 = synonymous, 0 = non-synonymous, -1 = stop
has 'syn_changes' => ( is => 'ro', isa => 'HashRef', );
# One <=> Three
has 'one2three' => ( is => 'ro', isa => 'HashRef', );
has 'three2one' => ( is => 'ro', isa => 'HashRef', );
sub BUILD {
my $self = shift;
$self->_make_codons;
$self->change_codon_table( $self->{table_id} );
$self->_load_aa_code;
return;
}
sub _make_codons {
my $self = shift;
# makes all codon combinations
my @nucs = qw(T C A G);
my @codons;
for my $i (@nucs) {
for my $j (@nucs) {
for my $k (@nucs) {
push @codons, "$i$j$k";
}
}
}
$self->{codons} = \@codons;
my %codon_idx;
for my $i ( 0 .. $#codons ) {
$codon_idx{ $codons[$i] } = $i;
}
$self->{codon_idx} = \%codon_idx;
return;
}
sub change_codon_table {
my $self = shift;
my $id = shift;
my @NAMES = ( #id
'Strict', # 0, special option for ATG-only start
'Standard', # 1
'Vertebrate Mitochondrial', # 2
'Yeast Mitochondrial', # 3
'Mold, Protozoan, and Coelenterate Mitochondrial and Mycoplasma/Spiroplasma', # 4
'Invertebrate Mitochondrial', # 5
'Ciliate, Dasycladacean and Hexamita Nuclear', # 6
'', '',
'Echinoderm and Flatworm Mitochondrial', # 9
'Euplotid Nuclear', # 10
'Bacterial, Archaeal and Plant Plastid', # 11
'Alternative Yeast Nuclear', # 12
'Ascidian Mitochondrial', # 13
'Alternative Flatworm Mitochondrial', # 14
'Blepharisma Nuclear', # 15
'Chlorophycean Mitochondrial', # 16
'', '', '', '',
'Trematode Mitochondrial', # 21
'Scenedesmus obliquus Mitochondrial', # 22
'Thraustochytrium Mitochondrial', # 23
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.069 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-72ae3ad1e6da )