Skip to content

Commit

Permalink
Updated trunk to 0.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
kgalinsky committed Oct 28, 2009
1 parent 3e7a1bf commit b70f30e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history for JCVI-Translator

0.5.5 Apr 23 2009
- Fixed bug in Base where Xs weren't being put in when base isn't found

0.5.4 Apr 15 2009
- Put use version on same line as $VERSION declared
- Added META.yml so make dist would work
Expand Down
2 changes: 1 addition & 1 deletion lib/JCVI/Translator.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ package JCVI::Translator;
use strict;
use warnings;

use version; our $VERSION = qv('0.5.4');
use version; our $VERSION = qv('0.5.5');

use base qw(Class::Accessor::Fast);
__PACKAGE__->mk_accessors(qw(table base));
Expand Down
6 changes: 3 additions & 3 deletions lib/JCVI/Translator/Base.pm
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ sub translate {

# Grab the codon, and look it up in the translation table
my $codon = substr( $$seq_ref, $index, 3 );
push @residues, $self->{table}->{$codon};
push @residues, $self->{table}->{$codon} || 'X';

# Increment the index
$index += $self->{increment};
Expand All @@ -212,7 +212,7 @@ sub start {
my ($self) = @_;

# If start == stop, don't do anything
return '' if ( $self->{start} == $self->{stop} );
return () if ( $self->{start} == $self->{stop} );

my $seq_ref = $self->{seq_ref};

Expand All @@ -221,7 +221,7 @@ sub start {
my $start = $self->{starts}->{$codon};

# Return the empty string if start isn't found in the translation table
return '' unless ($start);
return () unless ($start);

# Increment the start location and return the start codon
$self->{start} += $self->{increment};
Expand Down
12 changes: 6 additions & 6 deletions t/01-translate.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ is( ${ $translator->translate( \$seq, { strand => -1, upper => 59 } ) },
is( ${ $translator->translate( \$seq, { strand => -1, upper => 58 } ) },
'MGPRGTGGA*RSRMACMIS', 'Translate frame -3' );

is(
${ $translator->translate( \$seq, { partial => 1 } ) },
'LISCMPFSTAMRLLFLVGPK',
q{Translate 5' partial frame 1}
);
is( ${ $translator->translate( \$seq, { partial => 1 } ) },
'LISCMPFSTAMRLLFLVGPK', q{Translate 5' partial frame 1} );

is(
${
Expand All @@ -39,4 +36,7 @@ is(
},
'LGPRGTGGA*RSRMACMIS',
q{Translate 5' partial frame -3}
);
);

is( ${ $translator->translate( \'NNN' ) }, 'X',
q{Translate not found as 'X'} )

0 comments on commit b70f30e

Please sign in to comment.