| 1 | package BioX::CLPM::Amino; | ||
| 2 | 2 | ▶ | use base qw(BioX::CLPM::Base); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | use Class::Std; | ||
| 4 | use Class::Std::Utils; | ||
| 5 | |||
| 6 | use warnings; | ||
| 7 | use strict; | ||
| 8 | use Carp; | ||
| 9 | |||
| 10 | use version; our $VERSION = qv('0.0.1'); | ||
| 11 | |||
| 12 | { | ||
| 13 | my %amino_acid_id_of :ATTR( :get<amino_acid_id> :set<amino_acid_id> :default<''> :init_arg<amino_acid_id> ); | ||
| 14 | my %letter_of :ATTR( :get<letter> :set<letter> :default<''> :init_arg<letter> ); | ||
| 15 | my %mass_of :ATTR( :get<mass> :set<mass> :default<''> :init_arg<mass> ); | ||
| 16 | my %type_of :ATTR( :get<type> :set<type> :default<''> :init_arg<type> ); | ||
| 17 | |||
| 18 | sub START { | ||
| 19 | my ($self, $ident, $arg_ref) = @_; | ||
| 20 | |||
| 21 | if ( defined $arg_ref->{amino_acid_id} ) { | ||
| 22 | $self->_load( $arg_ref ); | ||
| 23 | } | ||
| 24 | |||
| 25 | return; | ||
| 26 | } | ||
| 27 | |||
| 28 | sub _load { | ||
| 29 | my ( $self, $arg_ref ) = @_; | ||
| 30 | my $amino_acid_id = defined $arg_ref->{amino_acid_id} ? | ||
| 31 | $arg_ref->{amino_acid_id} : | ||
| 32 | $self->get_amino_acid_id(); | ||
| 33 | |||
| 34 | if ( defined $arg_ref->{amino_acid_id} ) { | ||
| 35 | $self->set_amino_acid_id($amino_acid_id); | ||
| 36 | } | ||
| 37 | |||
| 38 | my $sql = 'select letter, mass, type '; | ||
| 39 | $sql .= "from amino_acids where amino_acid_id = '$amino_acid_id'"; | ||
| 40 | my ( $letter, $mass, $type ) = $self->sqlexec( $sql, '@' ); | ||
| 41 | $self->set_letter( $letter ); | ||
| 42 | $self->set_mass( $mass ); | ||
| 43 | $self->set_type( $type ); | ||
| 44 | } | ||
| 45 | |||
| 46 | } | ||
| 47 | |||
| 48 | 1; # Magic true value required at end of module | ||
| 49 | __END__ | ||